This commit is contained in:
joseCorte-exe 2023-04-14 13:29:28 -03:00
parent fc460bf343
commit 682181d130
4 changed files with 31 additions and 34 deletions

View File

@ -334,7 +334,7 @@ export default function ClientTable({ clients, onChange }: ClientsTableInterface
.then((res) => { .then((res) => {
setOpenSnackSuccess(true) setOpenSnackSuccess(true)
setOpenModalInativar(false) setOpenModalInativar(false)
window.location.reload() // window.location.reload()
}) })
.catch((res) => { .catch((res) => {
setOpenSnackError(true) setOpenSnackError(true)

View File

@ -1,21 +1,20 @@
import React from 'react'
import { draw } from 'patternomaly' import { draw } from 'patternomaly';
import { Bar } from 'react-chartjs-2';
import { import {
Chart as ChartJS,
CategoryScale,
LinearScale,
BarElement, BarElement,
CategoryScale,
Chart as ChartJS,
Legend,
LinearScale,
Title, Title,
Tooltip, Tooltip
Legend } from 'chart.js';
} from 'chart.js' import { Bar } from 'react-chartjs-2';
import { CostIndicatorChartView } from './CostIndicatorChartView';
import ChartTitle from '../ChartTitle'; import ChartTitle from '../ChartTitle';
import { config } from '../config'; import { config } from '../config';
import { CostIndicatorChartView } from './CostIndicatorChartView';
ChartJS.register( ChartJS.register(
CategoryScale, CategoryScale,
@ -42,11 +41,13 @@ export default function CostIndicatorChart({ title, data1, data2, label, subtitl
const options: any = config(miniature) const options: any = config(miniature)
console.log(new Date().getFullYear())
const data = { const data = {
labels, labels,
datasets: [ datasets: [
{ {
label: '2021', label: new Date().getFullYear() - 1,
data: data1?.map(value => value), data: data1?.map(value => value),
skipNull: data2?.map(value => value)?.includes(null), skipNull: data2?.map(value => value)?.includes(null),
borderRadius: 8, borderRadius: 8,
@ -64,7 +65,7 @@ export default function CostIndicatorChart({ title, data1, data2, label, subtitl
}, },
}, },
{ {
label: '2022', label: new Date().getFullYear(),
data: data2?.map(value => value), data: data2?.map(value => value),
skipNull: data1?.map(value => value)?.includes(null), skipNull: data1?.map(value => value)?.includes(null),
borderRadius: 8, borderRadius: 8,

View File

@ -356,7 +356,6 @@ export default function clients({ clients, userName }) {
</div> </div>
</InputUploadView> </InputUploadView>
<div className='select'> <div className='select'>
<FormControl sx={{ width: 350, ml: 5, mt: 2 }}> <FormControl sx={{ width: 350, ml: 5, mt: 2 }}>

View File

@ -1,31 +1,28 @@
import React, { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import { DashboardView } from '../../styles/layouts/dashboard/DashboardView' import { DashboardView } from '../../styles/layouts/dashboard/DashboardView'
import MapCard from '../../components/mapCard/MapCard' import Link from 'next/link'
import GraphCard from '../../components/graph/graphCard/ChartCard' import GraphCard from '../../components/graph/graphCard/ChartCard'
import Header from '../../components/header/Header' import Header from '../../components/header/Header'
import MapCard from '../../components/mapCard/MapCard'
import PageTitle from '../../components/pageTitle/PageTitle' import PageTitle from '../../components/pageTitle/PageTitle'
import Link from 'next/link'
import { parseCookies, setCookie } from 'nookies'
import { GetServerSideProps } from 'next'
import getAPIClient from '../../services/ssrApi'
import { GrossAnualChart } from '../../components/graph/grossAnualChart/GrossAnualChart'
import CostIndicatorChart from '../../components/graph/costIndicatorChart'
import { CativoXLivreChart } from '../../components/graph/cativoXLivreChart'
import GrossMensalChart from '../../components/graph/grossMensalChart/GrossMensalChart'
import Head from 'next/head'
import AccumulatedEconomyTitle from '../../components/accumulatedEconomyTitle/AccumulatedEconomyTitle'
import { format } from 'date-fns' import { format } from 'date-fns'
import { GetServerSideProps } from 'next'
import Head from 'next/head'
import { parseCookies, setCookie } from 'nookies'
import AccumulatedEconomyTitle from '../../components/accumulatedEconomyTitle/AccumulatedEconomyTitle'
import { CativoXLivreChart } from '../../components/graph/cativoXLivreChart'
import CostIndicatorChart from '../../components/graph/costIndicatorChart'
import { GrossAnualChart } from '../../components/graph/grossAnualChart/GrossAnualChart'
import GrossMensalChart from '../../components/graph/grossMensalChart/GrossMensalChart'
import getAPIClient from '../../services/ssrApi'
import Box from '@mui/material/Box'; import Box from '@mui/material/Box'
import Button from '@mui/material/Button'; import Modal from '@mui/material/Modal'
import Typography from '@mui/material/Typography'; import Typography from '@mui/material/Typography'
import Modal from '@mui/material/Modal';
import RenderIf from '../../utils/renderIf'
import BasicButton from '../../components/buttons/basicButton/BasicButton' import BasicButton from '../../components/buttons/basicButton/BasicButton'
import ConfirmModal from '../../components/modal/ConfirmModal'
const style = { const style = {
position: 'absolute' as const, position: 'absolute' as const,
@ -141,8 +138,8 @@ export default function Dashboard({ grossAnualGraph, grossAnualYears, grossMensa
<GraphCard title='Indicador de Custo' subtitle='Indicador de Custo - Valores em R$/MWh'> <GraphCard title='Indicador de Custo' subtitle='Indicador de Custo - Valores em R$/MWh'>
<CostIndicatorChart title='' subtitle='' <CostIndicatorChart title='' subtitle=''
data1={costIndicator?.filter((value, index) => value?.mes.slice(0, 4).includes('2021')).map(value => value?.custo_unit && !!parseInt(value?.custo_unit) ? value.custo_unit : null)} data1={costIndicator?.filter((value, index) => value?.mes.slice(0, 4).includes(costIndicator[0].mes.slice(0, 4))).map(value => value?.custo_unit && !!parseInt(value?.custo_unit) ? value.custo_unit : null)}
data2={costIndicator?.filter((value, index) => value?.mes.slice(0, 4).includes('2022')).map(value => value?.custo_unit && !!parseInt(value?.custo_unit) ? value.custo_unit : null)} data2={costIndicator?.filter((value, index) => value?.mes.slice(0, 4).includes(costIndicator[costIndicator.length - 1].mes.slice(0, 4))).map(value => value?.custo_unit && !!parseInt(value?.custo_unit) ? value.custo_unit : null)}
label={months} label={months}
miniature miniature
/> />