diff --git a/src/components/administrativeTables/ClientsTable.tsx b/src/components/administrativeTables/ClientsTable.tsx index 5c2bb10..f39feb3 100644 --- a/src/components/administrativeTables/ClientsTable.tsx +++ b/src/components/administrativeTables/ClientsTable.tsx @@ -334,7 +334,7 @@ export default function ClientTable({ clients, onChange }: ClientsTableInterface .then((res) => { setOpenSnackSuccess(true) setOpenModalInativar(false) - window.location.reload() + // window.location.reload() }) .catch((res) => { setOpenSnackError(true) diff --git a/src/components/graph/costIndicatorChart/index.tsx b/src/components/graph/costIndicatorChart/index.tsx index e3937fe..f3a800e 100644 --- a/src/components/graph/costIndicatorChart/index.tsx +++ b/src/components/graph/costIndicatorChart/index.tsx @@ -1,21 +1,20 @@ -import React from 'react' -import { draw } from 'patternomaly' +import { draw } from 'patternomaly'; -import { Bar } from 'react-chartjs-2'; import { - Chart as ChartJS, - CategoryScale, - LinearScale, BarElement, + CategoryScale, + Chart as ChartJS, + Legend, + LinearScale, Title, - Tooltip, - Legend -} from 'chart.js' + Tooltip +} from 'chart.js'; +import { Bar } from 'react-chartjs-2'; -import { CostIndicatorChartView } from './CostIndicatorChartView'; import ChartTitle from '../ChartTitle'; import { config } from '../config'; +import { CostIndicatorChartView } from './CostIndicatorChartView'; ChartJS.register( CategoryScale, @@ -42,11 +41,13 @@ export default function CostIndicatorChart({ title, data1, data2, label, subtitl const options: any = config(miniature) + console.log(new Date().getFullYear()) + const data = { labels, datasets: [ { - label: '2021', + label: new Date().getFullYear() - 1, data: data1?.map(value => value), skipNull: data2?.map(value => value)?.includes(null), 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), skipNull: data1?.map(value => value)?.includes(null), borderRadius: 8, diff --git a/src/pages/administrative/clients/index.tsx b/src/pages/administrative/clients/index.tsx index 2dde4d1..9341b80 100644 --- a/src/pages/administrative/clients/index.tsx +++ b/src/pages/administrative/clients/index.tsx @@ -356,7 +356,6 @@ export default function clients({ clients, userName }) { -
diff --git a/src/pages/dashboard/index.tsx b/src/pages/dashboard/index.tsx index a929b9f..897c925 100644 --- a/src/pages/dashboard/index.tsx +++ b/src/pages/dashboard/index.tsx @@ -1,31 +1,28 @@ -import React, { useEffect, useState } from 'react' +import { useEffect, useState } from 'react' 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 Header from '../../components/header/Header' +import MapCard from '../../components/mapCard/MapCard' 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 { 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 Button from '@mui/material/Button'; -import Typography from '@mui/material/Typography'; -import Modal from '@mui/material/Modal'; -import RenderIf from '../../utils/renderIf' +import Box from '@mui/material/Box' +import Modal from '@mui/material/Modal' +import Typography from '@mui/material/Typography' import BasicButton from '../../components/buttons/basicButton/BasicButton' -import ConfirmModal from '../../components/modal/ConfirmModal' const style = { position: 'absolute' as const, @@ -141,8 +138,8 @@ export default function Dashboard({ grossAnualGraph, grossAnualYears, grossMensa value?.mes.slice(0, 4).includes('2021')).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)} + 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(costIndicator[costIndicator.length - 1].mes.slice(0, 4))).map(value => value?.custo_unit && !!parseInt(value?.custo_unit) ? value.custo_unit : null)} label={months} miniature />