maintenance input,header
This commit is contained in:
commit
2b194dc5d1
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"cSpell.language": "pt-BR,en"
|
||||||
|
}
|
||||||
@ -8,6 +8,7 @@ export const BannerView = styled.div`
|
|||||||
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 20%;
|
height: 20%;
|
||||||
|
max-height: 200px;
|
||||||
|
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
|
|
||||||
|
|||||||
@ -125,7 +125,7 @@ export function LineBarChart2({ title, subtitle, data1, data2, data3, label, red
|
|||||||
type: 'bar' as const,
|
type: 'bar' as const,
|
||||||
label: dataset2? dataset2 : 'Dataset 2',
|
label: dataset2? dataset2 : 'Dataset 2',
|
||||||
backgroundColor: (value, ctx) => {
|
backgroundColor: (value, ctx) => {
|
||||||
return hashurado? data1[value.dataIndex].dad_estimado == false? '#C2D5FB' : pattern.draw('diagonal', '#C2D5FB') : '#C2D5FB'
|
return hashurado? data1[value.dataIndex]?.dad_estimado == false? '#C2D5FB' : pattern.draw('diagonal', '#C2D5FB') : '#C2D5FB'
|
||||||
},
|
},
|
||||||
data: data3.map(value => value.custo_cativo),
|
data: data3.map(value => value.custo_cativo),
|
||||||
},
|
},
|
||||||
@ -134,7 +134,7 @@ export function LineBarChart2({ title, subtitle, data1, data2, data3, label, red
|
|||||||
label: dataset3? dataset3 : 'Dataset 2',
|
label: dataset3? dataset3 : 'Dataset 2',
|
||||||
// backgroundColor: '#255488',
|
// backgroundColor: '#255488',
|
||||||
backgroundColor: (value, ctx) => {
|
backgroundColor: (value, ctx) => {
|
||||||
return hashurado? data1[value.dataIndex].dad_estimado == false? '#255488' : pattern.draw('diagonal', '#255488') : '#255488'
|
return hashurado? data1[value.dataIndex]?.dad_estimado == false? '#255488' : pattern.draw('diagonal', '#255488') : '#255488'
|
||||||
},
|
},
|
||||||
data: data2.map(value => value.custo_livre),
|
data: data2.map(value => value.custo_livre),
|
||||||
},
|
},
|
||||||
|
|||||||
@ -75,9 +75,9 @@ export function SingleBar({ title, subtitle, dataProps, label, dataset, barLabel
|
|||||||
labels,
|
labels,
|
||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
label: '',
|
label: 'Estimado',
|
||||||
data: [],
|
data: [],
|
||||||
backgroundColor: 'transparent',
|
backgroundColor: '#C2d5fb',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: dataset,
|
label: dataset,
|
||||||
|
|||||||
@ -9,59 +9,28 @@ import { parseCookies } from 'nookies';
|
|||||||
import { GetServerSideProps } from 'next';
|
import { GetServerSideProps } from 'next';
|
||||||
import getAPIClient from '../../services/ssrApi';
|
import getAPIClient from '../../services/ssrApi';
|
||||||
|
|
||||||
function stringToColor(string: string) {
|
|
||||||
let hash = 0;
|
|
||||||
let i;
|
|
||||||
|
|
||||||
for (i = 0; i < string.length; i += 1) {
|
|
||||||
hash = string.charCodeAt(i) + ((hash << 5) - hash);
|
|
||||||
}
|
|
||||||
|
|
||||||
let color = '#';
|
|
||||||
|
|
||||||
for (i = 0; i < 3; i += 1) {
|
|
||||||
const value = (hash >> (i * 8)) & 0xff;
|
|
||||||
color += `00${value.toString(16)}`.slice(-2);
|
|
||||||
}
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
function stringAvatar(profile_picture: string) {
|
|
||||||
return {
|
|
||||||
|
|
||||||
children: `${profile_picture}`,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
interface headerInterface {
|
interface headerInterface {
|
||||||
name: string,
|
name: string,
|
||||||
admin?: boolean | undefined
|
admin?: boolean | undefined
|
||||||
logo?: string
|
logo?: string
|
||||||
profile_picture: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Header({ name, admin, }: headerInterface) {
|
export default function Header({name, admin}: headerInterface) {
|
||||||
|
const { ['user-profile_picture']: profile_picture } = parseCookies()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HeaderView>
|
<HeaderView>
|
||||||
<section>
|
<div className='icon' >
|
||||||
</section>
|
<p>
|
||||||
<section>
|
olá, {name}
|
||||||
{
|
</p>
|
||||||
!admin?
|
</div>
|
||||||
// <Image src={logo} width={170} height={50} />
|
{
|
||||||
null
|
!admin && profile_picture?
|
||||||
:
|
<Image src={profile_picture} height={50} width={75}/>
|
||||||
null
|
:
|
||||||
}
|
null
|
||||||
<div className='icon' >
|
}
|
||||||
<p>
|
|
||||||
olá, {name}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
</HeaderView>
|
</HeaderView>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -70,6 +39,7 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
|||||||
const apiClient = getAPIClient(ctx)
|
const apiClient = getAPIClient(ctx)
|
||||||
const { ['@smartAuth-token']: token } = parseCookies(ctx)
|
const { ['@smartAuth-token']: token } = parseCookies(ctx)
|
||||||
const { ['user-name']: userName } = parseCookies(ctx)
|
const { ['user-name']: userName } = parseCookies(ctx)
|
||||||
|
const { ['user-profile_picture']: profile_picture } = parseCookies()
|
||||||
|
|
||||||
let userData = [];
|
let userData = [];
|
||||||
|
|
||||||
@ -91,7 +61,8 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
|||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
userData,
|
userData,
|
||||||
userName
|
userName,
|
||||||
|
profile_picture
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,24 +2,10 @@ import styled from "styled-components";
|
|||||||
|
|
||||||
export const HeaderView = styled.header`
|
export const HeaderView = styled.header`
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: flex-end;
|
||||||
|
|
||||||
margin: 0 0 75px 0;
|
|
||||||
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
section {
|
|
||||||
width: 30%;
|
|
||||||
|
|
||||||
:last-child {
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-end;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
height: fit-content;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -32,6 +18,8 @@ export const HeaderView = styled.header`
|
|||||||
|
|
||||||
background-color: #254F7F;
|
background-color: #254F7F;
|
||||||
|
|
||||||
|
margin-right: 20px;
|
||||||
|
|
||||||
p{
|
p{
|
||||||
color: white;
|
color: white;
|
||||||
margin-left: 15%;
|
margin-left: 15%;
|
||||||
|
|||||||
@ -64,6 +64,9 @@ export function AuthProvider({children}: {children: React.ReactNode}) {
|
|||||||
if (user.client_id)
|
if (user.client_id)
|
||||||
setCookie(undefined, 'user-client_id', user.client_id)
|
setCookie(undefined, 'user-client_id', user.client_id)
|
||||||
|
|
||||||
|
if (user.profile_picture)
|
||||||
|
setCookie(undefined, 'user-profile_picture', user.profile_picture)
|
||||||
|
|
||||||
api.defaults.headers['Authorization'] = `Bearer ${token}`
|
api.defaults.headers['Authorization'] = `Bearer ${token}`
|
||||||
|
|
||||||
if (!exception) {
|
if (!exception) {
|
||||||
|
|||||||
@ -5,58 +5,46 @@ import { parseCookies } from 'nookies'
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import Banner from '../components/banner/Banner'
|
import Banner from '../components/banner/Banner'
|
||||||
import Header from '../components/header/Header'
|
import Header from '../components/header/Header'
|
||||||
|
import getAPIClient from '../services/ssrApi'
|
||||||
import { AboutUsView } from '../styles/layouts/aboutUs/AboutUsView'
|
import { AboutUsView } from '../styles/layouts/aboutUs/AboutUsView'
|
||||||
|
|
||||||
export default function aboutUs({userName}) {
|
export default function aboutUs({userName, text}) {
|
||||||
return (
|
return (
|
||||||
<AboutUsView>
|
<AboutUsView>
|
||||||
<Head>
|
<Head>
|
||||||
<title>Smart Energia - About Us</title>
|
<title>Smart Energia - About Us</title>
|
||||||
</Head>
|
</Head>
|
||||||
<Header name={userName} />
|
|
||||||
|
{/* <Header name={userName}/> */}
|
||||||
<Banner title='Quem Somos' subtitle='Soluções inteligentes em Gestão de Energia' imgSource='/assets/banners/aboutUsBanner.png' />
|
<Banner title='Quem Somos' subtitle='Soluções inteligentes em Gestão de Energia' imgSource='/assets/banners/aboutUsBanner.png' />
|
||||||
|
|
||||||
<section>
|
<section dangerouslySetInnerHTML={{__html: text[0].about}}/>
|
||||||
<p>A <strong>SMART ENERGIA</strong> é uma consultoria independente especializada em Gestão de Energia Elétrica, consolidada como uma das três maiores consultorias do Brasil.
|
<article>
|
||||||
Devido à grande experiência em operações na CCEE – Câmara de Comercialização de Energia Elétrica e ANEEL, entrega resultados que superam as expectativas.</p>
|
<aside style={{alignSelf: 'flex-end'}}>
|
||||||
|
<h2>Apoio a projetos sociais</h2>
|
||||||
<p>Nasceu para gerenciar a compra de energia com inovação, transparência e imparcialidade sendo o elo forte e necessário entre os Consumidores e os
|
<div>
|
||||||
Vendedores de energia. </p>
|
<Image src='/assets/stamps/whiteStamp.png' width={200} height={200} />
|
||||||
|
<Image src='/assets/stamps/blueStamp.png' width={200} height={200} />
|
||||||
<p>Baseada em sua experiência no setor elétrico adquirida desde 2001 e em mais de 900 unidades migradas, atua na negociação de contratos de compra e venda de
|
</div>
|
||||||
energia, na Gestão de Energia no Mercado Livre e criação de produtos diferenciados para atender as necessidades específicas dos consumidores.</p>
|
</aside>
|
||||||
|
</article>
|
||||||
<p>Apoiada pela sólida experiência de seus gestores, conhecendo as premissas dos agentes de Comercialização e Geração para a compra e venda de energia,
|
|
||||||
aplicamos as mesmas premissas a favor dos Consumidores, disponibilizando assim um diferencial único para a tomada de decisão e elaboração das estratégias de
|
|
||||||
contratação de energia.</p>
|
|
||||||
<ul>
|
|
||||||
<li><Image src='/assets/listIcon.svg' width={25} height={25} />{'Informação'}</li>
|
|
||||||
<li><Image src='/assets/listIcon.svg' width={25} height={25} />{'Economia'}</li>
|
|
||||||
<li><Image src='/assets/listIcon.svg' width={25} height={25} />{'Gestão de Energia'}</li>
|
|
||||||
<li><Image src='/assets/listIcon.svg' width={25} height={25} />{'Imparcialidade'}</li>
|
|
||||||
<li><Image src='/assets/listIcon.svg' width={25} height={25} />{'Previsão de Custos'}</li>
|
|
||||||
<li><Image src='/assets/listIcon.svg' width={25} height={25} />{'Experiência'}</li>
|
|
||||||
<li><Image src='/assets/listIcon.svg' width={25} height={25} />{'Relacionamento'}</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<article>
|
|
||||||
<aside>
|
|
||||||
<h2>Apoio a projetos sociais</h2>
|
|
||||||
<div>
|
|
||||||
<Image src='/assets/stamps/whiteStamp.png' width={200} height={200} />
|
|
||||||
<Image src='/assets/stamps/blueStamp.png' width={200} height={200} />
|
|
||||||
</div>
|
|
||||||
</aside>
|
|
||||||
</article>
|
|
||||||
</section>
|
|
||||||
</AboutUsView>
|
</AboutUsView>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
||||||
|
const apiClient = getAPIClient(ctx)
|
||||||
const { ['@smartAuth-token']: token } = parseCookies(ctx)
|
const { ['@smartAuth-token']: token } = parseCookies(ctx)
|
||||||
const { ['user-name']: userName } = parseCookies(ctx)
|
const { ['user-name']: userName } = parseCookies(ctx)
|
||||||
|
|
||||||
|
let text = []
|
||||||
|
|
||||||
|
await apiClient.get('/aboutUs').then(res => {
|
||||||
|
text = res.data.data
|
||||||
|
}).catch(res => {
|
||||||
|
console.log(res)
|
||||||
|
})
|
||||||
|
|
||||||
if (!token) {
|
if (!token) {
|
||||||
return {
|
return {
|
||||||
redirect: {
|
redirect: {
|
||||||
@ -68,7 +56,8 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
userName
|
userName,
|
||||||
|
text
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,16 +19,16 @@ export default function AccumulatedSavings({graphData, years, userName}: any) {
|
|||||||
<title>Smart Energia - Economia Bruta Mensal</title>
|
<title>Smart Energia - Economia Bruta Mensal</title>
|
||||||
</Head>
|
</Head>
|
||||||
<Header name={userName} />
|
<Header name={userName} />
|
||||||
<PageTitle title='Economia Bruta Mensal' subtitle='Economia Bruta Estimada e Acumulada mensal (Valores em R$ mil)' />
|
<PageTitle title='Economia Bruta Mensal' subtitle='Economia Bruta Estimada e Acumulada mensal - Valores em R$ mil' />
|
||||||
<section>
|
<section>
|
||||||
<SingleBar title='Economia Bruta Estimada e Acumulada' subtitle='(Valores em R$ mil)' dataset='Consolidada'
|
<SingleBar title='' subtitle='' dataset='Consolidada'
|
||||||
dataset1='Estimada' dataProps={graphData.sort((a, b) => {
|
dataProps={graphData.sort((a, b) => {
|
||||||
if (parseFloat(a.mes.slice(0,2)) > parseFloat(b.mes.slice(1,2))) return 1
|
if (parseFloat(a.mes.slice(0,2)) > parseFloat(b.mes.slice(1,2))) return 1
|
||||||
if (parseFloat(a.mes.slice(0,2)) < parseFloat(b.mes.slice(1,2))) return -1
|
if (parseFloat(a.mes.slice(0,2)) < parseFloat(b.mes.slice(1,2))) return -1
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
})}
|
})}
|
||||||
label={years} barLabel month/>
|
label={years} barLabel/>
|
||||||
</section>
|
</section>
|
||||||
</AccumulatedSavingsView>
|
</AccumulatedSavingsView>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -8,12 +8,23 @@ import Header from '../../components/header/Header';
|
|||||||
import PageTitle from '../../components/pageTitle/PageTitle';
|
import PageTitle from '../../components/pageTitle/PageTitle';
|
||||||
import { api } from '../../services/api';
|
import { api } from '../../services/api';
|
||||||
import { GeneralView } from '../../styles/layouts/general/GeneralView'
|
import { GeneralView } from '../../styles/layouts/general/GeneralView'
|
||||||
|
import MuiAlert, { AlertProps } from '@mui/material/Alert'
|
||||||
|
import Snackbar from '@mui/material/Snackbar';
|
||||||
|
|
||||||
|
const Alert = React.forwardRef<HTMLDivElement, AlertProps>(function Alert(
|
||||||
|
props,
|
||||||
|
ref
|
||||||
|
) {
|
||||||
|
return <MuiAlert elevation={6} ref={ref} variant="filled" {...props} />
|
||||||
|
})
|
||||||
|
|
||||||
export default function index({userName}: any) {
|
export default function index({userName}: any) {
|
||||||
const editorRef = useRef(null);
|
const editorRef = useRef(null);
|
||||||
const [text, setText] = useState('');
|
const [text, setText] = useState('');
|
||||||
|
|
||||||
|
const [openSnackSuccess, setOpenSnackSuccess] = useState<boolean>(false)
|
||||||
|
const [openSnackError, setOpenSnackError] = useState<boolean>(false)
|
||||||
|
|
||||||
const log = () => {
|
const log = () => {
|
||||||
if (editorRef.current) {
|
if (editorRef.current) {
|
||||||
console.log(editorRef.current.getContent());
|
console.log(editorRef.current.getContent());
|
||||||
@ -24,16 +35,54 @@ export default function index({userName}: any) {
|
|||||||
setText(event.target.value);
|
setText(event.target.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleCloseSnack = (
|
||||||
|
event?: React.SyntheticEvent | Event,
|
||||||
|
reason?: string
|
||||||
|
) => {
|
||||||
|
if (reason === 'clickaway') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
setOpenSnackError(false)
|
||||||
|
setOpenSnackSuccess(false)
|
||||||
|
}
|
||||||
|
|
||||||
async function handleRegisterAboutUs() {
|
async function handleRegisterAboutUs() {
|
||||||
await api.post('/aboutUs', {
|
await api.post('/aboutUs', {
|
||||||
about: editorRef.current.value
|
about: text
|
||||||
}).then(res => {
|
})
|
||||||
console.log(res)
|
.then(res => setOpenSnackSuccess(true))
|
||||||
}).catch(res => console.log(res))
|
.catch(res => setOpenSnackError(false))
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GeneralView>
|
<GeneralView>
|
||||||
|
<Snackbar
|
||||||
|
open={openSnackSuccess}
|
||||||
|
autoHideDuration={4000}
|
||||||
|
onClose={handleCloseSnack}
|
||||||
|
>
|
||||||
|
<Alert
|
||||||
|
onClose={handleCloseSnack}
|
||||||
|
severity="success"
|
||||||
|
sx={{ width: '100%' }}
|
||||||
|
>
|
||||||
|
Cadastrado com Sucesso!
|
||||||
|
</Alert>
|
||||||
|
</Snackbar>
|
||||||
|
<Snackbar
|
||||||
|
open={openSnackError}
|
||||||
|
autoHideDuration={4000}
|
||||||
|
onClose={handleCloseSnack}
|
||||||
|
>
|
||||||
|
<Alert
|
||||||
|
onClose={handleCloseSnack}
|
||||||
|
severity="error"
|
||||||
|
sx={{ width: '100%' }}
|
||||||
|
>
|
||||||
|
Não cadastrado!
|
||||||
|
</Alert>
|
||||||
|
</Snackbar>
|
||||||
<Header name={userName} admin/>
|
<Header name={userName} admin/>
|
||||||
<PageTitle title='Sobre nós' subtitle='Alterar texto de sobre nós'/>
|
<PageTitle title='Sobre nós' subtitle='Alterar texto de sobre nós'/>
|
||||||
<div style={{width: '100%', display: 'flex', justifyContent: 'flex-start', alignItems: 'flex-start', marginTop: '30px', marginBottom: '10px'}}>
|
<div style={{width: '100%', display: 'flex', justifyContent: 'flex-start', alignItems: 'flex-start', marginTop: '30px', marginBottom: '10px'}}>
|
||||||
@ -43,6 +92,8 @@ export default function index({userName}: any) {
|
|||||||
<br />
|
<br />
|
||||||
<Editor
|
<Editor
|
||||||
onInit={(evt, editor) => editorRef.current = editor}
|
onInit={(evt, editor) => editorRef.current = editor}
|
||||||
|
onChange={value => console.log(value)}
|
||||||
|
onEditorChange={(newText) => setText(newText)}
|
||||||
initialValue=' <p>A <strong>SMART ENERGIA</strong> é uma consultoria independente especializada em Gestão de Energia Elétrica, consolidada como uma das três maiores consultorias do Brasil.
|
initialValue=' <p>A <strong>SMART ENERGIA</strong> é uma consultoria independente especializada em Gestão de Energia Elétrica, consolidada como uma das três maiores consultorias do Brasil.
|
||||||
Devido à grande experiência em operações na CCEE – Câmara de Comercialização de Energia Elétrica e ANEEL, entrega resultados que superam as expectativas.</p>
|
Devido à grande experiência em operações na CCEE – Câmara de Comercialização de Energia Elétrica e ANEEL, entrega resultados que superam as expectativas.</p>
|
||||||
|
|
||||||
|
|||||||
@ -4,50 +4,21 @@ import { parseCookies } from 'nookies'
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
import Chart from '../components/graph/Chart'
|
import Chart from '../components/graph/Chart'
|
||||||
import { SingleBar } from '../components/graph/SingleBar'
|
|
||||||
import Header from '../components/header/Header'
|
import Header from '../components/header/Header'
|
||||||
import PageTitle from '../components/pageTitle/PageTitle'
|
import PageTitle from '../components/pageTitle/PageTitle'
|
||||||
import { dataEconomiaBruta } from '../services/economiaBruta'
|
|
||||||
import { dataEconomiaIndicador } from '../services/economiaIndicador'
|
|
||||||
import getAPIClient from '../services/ssrApi'
|
import getAPIClient from '../services/ssrApi'
|
||||||
import { CostIndicatorView } from '../styles/layouts/economy/costIndicator/CostIndicatorView'
|
import { CostIndicatorView } from '../styles/layouts/economy/costIndicator/CostIndicatorView'
|
||||||
|
|
||||||
function verifyDataByYear(data) {
|
|
||||||
const currentYear = []
|
|
||||||
const currentYearAux = data.filter(value => value.mes.slice(3, 7).includes('2021'))
|
|
||||||
console.log(currentYear.length)
|
|
||||||
console.log(currentYearAux.length)
|
|
||||||
|
|
||||||
currentYearAux.sort((a, b) => {
|
|
||||||
if (parseFloat(a.mes.slice(0,2)) > parseFloat(b.mes.slice(1,2))) return 1
|
|
||||||
if (parseFloat(a.mes.slice(0,2)) < parseFloat(b.mes.slice(1,2))) return -1
|
|
||||||
|
|
||||||
return 0
|
|
||||||
})
|
|
||||||
|
|
||||||
// for (let i=0; currentYear.length <= currentYearAux.length; i++) {
|
|
||||||
// console.log(i, 'dentro do for')
|
|
||||||
// // console.log(currentYearAux.length, 'tamanho aux')
|
|
||||||
// if (currentYearAux[i].mes.slice(1,2)==i) {
|
|
||||||
// currentYear.push(currentYearAux[i])
|
|
||||||
// console.log(currentYear.length, 'tamanho')
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
console.log(currentYearAux)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function CostIndicator({graphData, userName}: any) {
|
export default function CostIndicator({graphData, userName}: any) {
|
||||||
// console.log(graphData.filter((value, index) => value.mes.slice(3, 7).includes('2021')).map(value => value.custo_unit))
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CostIndicatorView>
|
<CostIndicatorView>
|
||||||
<Head>
|
<Head>
|
||||||
<title>Smart Energia - Indicador de Custos</title>
|
<title>Smart Energia - Indicador de Custos</title>
|
||||||
</Head>
|
</Head>
|
||||||
<Header name={userName} />
|
<Header name={userName} />
|
||||||
<PageTitle title='Indicador de Custo' subtitle='Valores em R$/MWh'/>
|
<PageTitle title='Indicador de Custo' subtitle='Indicador de Custo - Valores em R$/MWh'/>
|
||||||
<section>
|
<section>
|
||||||
<Chart title='Indicador de Custo' subtitle='(Valores em R$/MWh)'
|
<Chart title='' subtitle=''
|
||||||
data1={graphData.filter((value, index) => value.mes.slice(3, 7).includes('2021')).sort((a, b) => {
|
data1={graphData.filter((value, index) => value.mes.slice(3, 7).includes('2021')).sort((a, b) => {
|
||||||
if (parseFloat(a.mes.slice(0,2)) > parseFloat(b.mes.slice(1,2))) return 1
|
if (parseFloat(a.mes.slice(0,2)) > parseFloat(b.mes.slice(1,2))) return 1
|
||||||
if (parseFloat(a.mes.slice(0,2)) < parseFloat(b.mes.slice(1,2))) return -1
|
if (parseFloat(a.mes.slice(0,2)) < parseFloat(b.mes.slice(1,2))) return -1
|
||||||
|
|||||||
@ -19,11 +19,11 @@ export default function EstimatedCost({graphData, userName}: any) {
|
|||||||
<title>Smart Energia - Custos Estimados</title>
|
<title>Smart Energia - Custos Estimados</title>
|
||||||
</Head>
|
</Head>
|
||||||
<Header name={userName} />
|
<Header name={userName} />
|
||||||
<PageTitle title='Cativo x Livre mensal' subtitle='Comparativo de Custo Estimado' />
|
<PageTitle title='Cativo x Livre mensal' subtitle='Comparativo de custo Estimado - Valores em R$' />
|
||||||
<section>
|
<section>
|
||||||
<LineBarChart2 data1={graphData} data2={graphData} data3={graphData}
|
<LineBarChart2 data1={graphData} data2={graphData} data3={graphData}
|
||||||
dataset1="Economia (R$)" dataset2='Cativo' dataset3='Livre'
|
dataset1="Economia (R$)" dataset2='Cativo' dataset3='Livre'
|
||||||
label={ConsumoEstimado.label} title='Cativo x Livre mensal' subtitle='' barLabel hashurado />
|
label={ConsumoEstimado.label} title='' subtitle='' barLabel hashurado />
|
||||||
</section>
|
</section>
|
||||||
</EstimatedCostView>
|
</EstimatedCostView>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -19,13 +19,13 @@ export default function GrossSavings({graphData, years, userName}: any) {
|
|||||||
<title>Smart Energia - Economia Acumulada</title>
|
<title>Smart Energia - Economia Acumulada</title>
|
||||||
</Head>
|
</Head>
|
||||||
<Header name={userName} />
|
<Header name={userName} />
|
||||||
<PageTitle title='Economia Bruta Anual' subtitle='Economia Bruta Estimada e Acumulada anual (Valores em R$ mil)' />
|
<PageTitle title='Economia Bruta Anual' subtitle='Economia Bruta Estimada e Acumulada anual - Valores em R$ mil' />
|
||||||
<section>
|
<section>
|
||||||
<SingleBar title='Economia Bruta' subtitle='(Valores em R$ mil)'
|
<SingleBar title='' subtitle=''
|
||||||
dataset='Consolidada' dataset1='Estimada'
|
dataset='Consolidada'
|
||||||
|
|
||||||
dataProps={graphData}
|
dataProps={graphData}
|
||||||
label={years} barLabel year/>
|
label={years} barLabel/>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
</GrossSavingsView>
|
</GrossSavingsView>
|
||||||
|
|||||||
@ -146,7 +146,7 @@ export default function Home() {
|
|||||||
</IconButton>
|
</IconButton>
|
||||||
</InputAdornment>
|
</InputAdornment>
|
||||||
}
|
}
|
||||||
label="Password"
|
label="Senha"
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<Link href='verifyEmail'>Esqueceu a senha ?</Link>
|
<Link href='verifyEmail'>Esqueceu a senha ?</Link>
|
||||||
|
|||||||
@ -12,44 +12,38 @@ import getAPIClient from '../services/ssrApi';
|
|||||||
import { Button, NewsView } from '../styles/layouts/news/NewsView'
|
import { Button, NewsView } from '../styles/layouts/news/NewsView'
|
||||||
|
|
||||||
export default function aboutUs({userName, news}: any) {
|
export default function aboutUs({userName, news}: any) {
|
||||||
console.log(news)
|
console.log(news.channel.item)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NewsView>
|
<NewsView>
|
||||||
<Head>
|
<Head>
|
||||||
<title>Smart Energia - Noticias</title>
|
<title>Smart Energia - Noticias</title>
|
||||||
</Head>
|
</Head>
|
||||||
<Header name={userName} />
|
{/* <Header name={userName} /> */}
|
||||||
<Banner title='Notícias' subtitle='Tudo de importante no setor de energia' imgSource='/assets/banners/news.png' />
|
<Banner title='Notícias' subtitle='Tudo de importante no setor de energia' imgSource='/assets/banners/news.png'/>
|
||||||
|
|
||||||
<section>
|
{
|
||||||
<h2>19 Abril 2022</h2>
|
news.channel.item.map(data => {
|
||||||
<strong>ANEEL APROVA REAJUSTE TARIFÁRIO ANUAL DA ENERGISA SERGIPE DE 16,46 % PARA O CONSUMIDOR RESIDENCIAL</strong>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<p>A Agência Nacional de Energia Elétrica (ANEEL) aprovou, nesta terça-feira (19/04) o reajuste tarifário anual da Energisa Sergipe – Distribuidora de Energia S.A (ESE).
|
|
||||||
As novas tarifas da empresa, que atende cerca de e 825 mil unidades consumidoras no Sergipe, entram em vigor nesta sexta, 22/04, com reajuste de 16,46 % para
|
|
||||||
o consumidor residencial. <br />
|
|
||||||
Os itens que mais impactaram a correção foram os encargos setoriais, os custos de distribuição, a retirada dos componentes financeiros..</p>
|
|
||||||
<Button>
|
|
||||||
<fieldset>
|
|
||||||
<legend> <BasicButton title='Ver Mais...' onClick={() => console.log()}/></legend>
|
|
||||||
</fieldset>
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<h2>19 Abril 2022</h2>
|
return <>
|
||||||
<strong>NEEL APROVA REAJUSTE MÉDIO DE 20,36% NA TARIFA DE ENERGIA NO RN</strong>
|
<section>
|
||||||
<br />
|
<h2 dangerouslySetInnerHTML={{__html: data.pubDate}} />
|
||||||
<br />
|
<strong dangerouslySetInnerHTML={{__html: data.title}} />
|
||||||
<p>A Agência Nacional de Energia Elétrica (ANEEL) aprovou, nesta terça-feira (19/04) o reajuste tarifário anual da Energisa Sergipe – Distribuidora de Energia S.A (ESE).
|
<strong>ANEEL APROVA REAJUSTE TARIFÁRIO ANUAL DA ENERGISA SERGIPE DE 16,46 % PARA O CONSUMIDOR RESIDENCIAL</strong>
|
||||||
As novas tarifas da empresa, que atende cerca de e 825 mil unidades consumidoras no Sergipe, entram em vigor nesta sexta, 22/04, com reajuste de 16,46 % para
|
<br />
|
||||||
o consumidor residencial. <br />
|
<br />
|
||||||
Os itens que mais impactaram a correção foram os encargos setoriais, os custos de distribuição, a retirada dos componentes financeiros..</p>
|
{
|
||||||
<Button>
|
<p dangerouslySetInnerHTML={{__html: data.description}} />
|
||||||
<fieldset>
|
}
|
||||||
<legend> <BasicButton title='Ver Mais...' onClick={() => console.log()}/></legend>
|
<Button>
|
||||||
</fieldset>
|
<fieldset>
|
||||||
</Button>
|
<legend> <BasicButton title='Ver Mais...' onClick={() => console.log()}/></legend>
|
||||||
</section>
|
</fieldset>
|
||||||
|
</Button>
|
||||||
|
</section>
|
||||||
|
</>
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
<a href='https://www.energiasmart.com.br/noticias/'
|
<a href='https://www.energiasmart.com.br/noticias/'
|
||||||
target={"_blank"}
|
target={"_blank"}
|
||||||
@ -63,10 +57,10 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
|||||||
const { ['@smartAuth-token']: token } = parseCookies(ctx)
|
const { ['@smartAuth-token']: token } = parseCookies(ctx)
|
||||||
const { ['user-name']: userName } = parseCookies(ctx)
|
const { ['user-name']: userName } = parseCookies(ctx)
|
||||||
|
|
||||||
let news;
|
let news = [];
|
||||||
|
|
||||||
await axios.get('https://www.energiasmart.com.br/noticias/feed/').then(res => {
|
await apiClient.get('/news').then(res => {
|
||||||
news = res.data
|
news = res.data.data
|
||||||
}).catch(res => {
|
}).catch(res => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -16,15 +16,18 @@ export default function Notifications({notificationData, userName}: any) {
|
|||||||
<title>Smart Energia - Notificações</title>
|
<title>Smart Energia - Notificações</title>
|
||||||
</Head>
|
</Head>
|
||||||
<Header name={userName} />
|
<Header name={userName} />
|
||||||
<PageTitle title='Notificações' subtitle='Aqui estão as notificaões publicadas para voce!' />
|
<PageTitle title='Notificações' subtitle='Aqui estão as notificações publicadas para você!' />
|
||||||
<section className='CommonQuestionsSection' >
|
<section className='CommonQuestionsSection' >
|
||||||
{
|
{
|
||||||
|
notificationData?
|
||||||
notificationData.map((value, index ) => {
|
notificationData.map((value, index ) => {
|
||||||
return <>
|
return <>
|
||||||
<NotificationQuestionsCard key={index} title={value.title} body={value.body}/>
|
<NotificationQuestionsCard key={index} title={value.title} body={value.body}/>
|
||||||
<hr />
|
<hr />
|
||||||
</>
|
</>
|
||||||
})
|
})
|
||||||
|
:
|
||||||
|
<p style={{alignSelf: 'center'}}>Você não tem notificações!</p>
|
||||||
}
|
}
|
||||||
</section>
|
</section>
|
||||||
</FaqView>
|
</FaqView>
|
||||||
|
|||||||
@ -160,7 +160,12 @@ export default function pld({tableData, graphByHourData, graphByMonthData, userN
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{
|
{
|
||||||
tableData.data.map(data => {
|
tableData.data.sort((a, b) => {
|
||||||
|
if (parseFloat(a.year_month_formatted.slice(0,2)) > parseFloat(b.year_month_formatted.slice(1,2))) return 1
|
||||||
|
if (parseFloat(a.year_month_formatted.slice(0,2)) < parseFloat(b.year_month_formatted.slice(1,2))) return -1
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}).map(data => {
|
||||||
return <>
|
return <>
|
||||||
<tr>
|
<tr>
|
||||||
<td className='tg-gceh'>{data.year_month_formatted}</td>
|
<td className='tg-gceh'>{data.year_month_formatted}</td>
|
||||||
@ -210,7 +215,7 @@ export default function pld({tableData, graphByHourData, graphByMonthData, userN
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div className='btnDownload'>
|
<div className='btnDownload'>
|
||||||
<BasicButton onClick={''} title='Download'/>
|
<BasicButton onClick={() => console.log()} title='Download'/>
|
||||||
</div>
|
</div>
|
||||||
<section>
|
<section>
|
||||||
|
|
||||||
@ -251,9 +256,9 @@ export default function pld({tableData, graphByHourData, graphByMonthData, userN
|
|||||||
</FormControl>
|
</FormControl>
|
||||||
</div>
|
</div>
|
||||||
<FormControl sx={{
|
<FormControl sx={{
|
||||||
width: '22%',
|
width: '22%',
|
||||||
ml: 1
|
ml: 1
|
||||||
}}>
|
}}>
|
||||||
<InputLabel id="demo-simple-select-label">Mês</InputLabel>
|
<InputLabel id="demo-simple-select-label">Mês</InputLabel>
|
||||||
<Select
|
<Select
|
||||||
value={day}
|
value={day}
|
||||||
@ -261,7 +266,6 @@ export default function pld({tableData, graphByHourData, graphByMonthData, userN
|
|||||||
displayEmpty
|
displayEmpty
|
||||||
placeholder='dia'
|
placeholder='dia'
|
||||||
label="Age"
|
label="Age"
|
||||||
|
|
||||||
>
|
>
|
||||||
<MenuItem value={'0'}>Nenhum</MenuItem>
|
<MenuItem value={'0'}>Nenhum</MenuItem>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -163,7 +163,7 @@ export default function ResumoOperacao({tableData, clientsData, userName, client
|
|||||||
<tr>
|
<tr>
|
||||||
<td key={index} className='tg-gceh'>{value.cod_smart_unidade}</td>
|
<td key={index} className='tg-gceh'>{value.cod_smart_unidade}</td>
|
||||||
<td key={index} className='tg-uulg'>{value.operacao}</td>
|
<td key={index} className='tg-uulg'>{value.operacao}</td>
|
||||||
<td key={index} className='tg-gceh'>{value.montante_nf}</td>
|
<td key={index} className='tg-gceh'>{parseFloat(value.montante_nf).toLocaleString('pt-br')}</td>
|
||||||
<td key={index} className='tg-gceh'>{value.contraparte}</td>
|
<td key={index} className='tg-gceh'>{value.contraparte}</td>
|
||||||
<td key={index} className='tg-uulg'>{parseFloat(value.nf_c_icms).toLocaleString('pt-br',{style: 'currency', currency: 'BRL', minimumFractionDigits: 2})}</td>
|
<td key={index} className='tg-uulg'>{parseFloat(value.nf_c_icms).toLocaleString('pt-br',{style: 'currency', currency: 'BRL', minimumFractionDigits: 2})}</td>
|
||||||
<td key={index} className='tg-gceh'>{parseFloat(value.preco_nf).toLocaleString('pt-br',{style: 'currency', currency: 'BRL', minimumFractionDigits: 2})}</td>
|
<td key={index} className='tg-gceh'>{parseFloat(value.preco_nf).toLocaleString('pt-br',{style: 'currency', currency: 'BRL', minimumFractionDigits: 2})}</td>
|
||||||
|
|||||||
@ -14,9 +14,10 @@ interface SignInRequestData {
|
|||||||
type UserObjectType = {
|
type UserObjectType = {
|
||||||
name: string;
|
name: string;
|
||||||
email: string;
|
email: string;
|
||||||
client_id: number
|
client_id: number;
|
||||||
id: number,
|
id: number;
|
||||||
role: number
|
role: number;
|
||||||
|
profile_picture?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function signInRequest(data: SignInRequestData) {
|
export async function signInRequest(data: SignInRequestData) {
|
||||||
@ -33,7 +34,8 @@ export async function signInRequest(data: SignInRequestData) {
|
|||||||
email: res.data.user.email,
|
email: res.data.user.email,
|
||||||
client_id: res.data.user.client_id,
|
client_id: res.data.user.client_id,
|
||||||
id: res.data.user.id,
|
id: res.data.user.id,
|
||||||
role: res.data.user.roles[0].pivot.role_id
|
role: res.data.user.roles[0].pivot.role_id,
|
||||||
|
profile_picture: res.data.user.profile_picture
|
||||||
}
|
}
|
||||||
}).catch(res => {
|
}).catch(res => {
|
||||||
exception = res
|
exception = res
|
||||||
@ -46,7 +48,8 @@ export async function signInRequest(data: SignInRequestData) {
|
|||||||
email: user?.email,
|
email: user?.email,
|
||||||
client_id: user?.client_id,
|
client_id: user?.client_id,
|
||||||
id: user?.id,
|
id: user?.id,
|
||||||
role: user?.role
|
role: user?.role,
|
||||||
|
profile_picture: user?.profile_picture
|
||||||
},
|
},
|
||||||
exception
|
exception
|
||||||
}
|
}
|
||||||
@ -62,7 +65,8 @@ export default async function recoverUserInformation(id) {
|
|||||||
email: res.data.user.email,
|
email: res.data.user.email,
|
||||||
client_id: res.data.user.client_id,
|
client_id: res.data.user.client_id,
|
||||||
id: res.data.user.id,
|
id: res.data.user.id,
|
||||||
role: res.data.user.roles[0].pivot.role_id
|
role: res.data.user.roles[0].pivot.role_id,
|
||||||
|
profile_picture: res.data.user.profile_picture
|
||||||
}
|
}
|
||||||
}).catch(res => {
|
}).catch(res => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
@ -73,7 +77,8 @@ export default async function recoverUserInformation(id) {
|
|||||||
name: user?.name,
|
name: user?.name,
|
||||||
email: user?.email,
|
email: user?.email,
|
||||||
client_id: user?.client_id,
|
client_id: user?.client_id,
|
||||||
id: user?.id
|
id: user?.id,
|
||||||
|
profile_picture: user?.profile_picture
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,21 +22,19 @@ export const AboutUsView = styled.main`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
section {
|
article {
|
||||||
article {
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
aside {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
aside {
|
width: fit-content;
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
width: fit-content;
|
flex-direction: column;
|
||||||
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user