Merge branch 'dev' of https://gitlab.com/kluppsoftware/smart-energia-web into dev
This commit is contained in:
commit
cbafcb1642
@ -2,5 +2,5 @@ import React from 'react'
|
|||||||
import { AccumulatedEconomyTitleView } from './AccumulatedEconomyTitleView'
|
import { AccumulatedEconomyTitleView } from './AccumulatedEconomyTitleView'
|
||||||
|
|
||||||
export default function AccumulatedEconomyTitle({value}: {value: string}) {
|
export default function AccumulatedEconomyTitle({value}: {value: string}) {
|
||||||
return <AccumulatedEconomyTitleView>Economia Acumulada:<p>R${parseFloat(value).toLocaleString('pt-br',{currency: 'BRL', minimumFractionDigits: 2, maximumFractionDigits: 2})}</p></AccumulatedEconomyTitleView>
|
return <AccumulatedEconomyTitleView>Economia Acumulada:<p>R${(parseFloat(value)*1000).toLocaleString('pt-br',{currency: 'BRL', minimumFractionDigits: 2, maximumFractionDigits: 2})}</p></AccumulatedEconomyTitleView>
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ const config = (miniature: boolean | undefined): ChartOptions<ChartType> => {
|
|||||||
},
|
},
|
||||||
ticks: {
|
ticks: {
|
||||||
font: {
|
font: {
|
||||||
size: !miniature? window.innerWidth/90 : window.innerWidth/110
|
size: !miniature? window.innerWidth/90 : window.innerWidth/125
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -22,7 +22,7 @@ const config = (miniature: boolean | undefined): ChartOptions<ChartType> => {
|
|||||||
},
|
},
|
||||||
ticks: {
|
ticks: {
|
||||||
font: {
|
font: {
|
||||||
size: !miniature? window.innerWidth/90 : window.innerWidth/110
|
size: !miniature? window.innerWidth/90 : window.innerWidth/125
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -45,7 +45,7 @@ const config = (miniature: boolean | undefined): ChartOptions<ChartType> => {
|
|||||||
align: "end",
|
align: "end",
|
||||||
font: {
|
font: {
|
||||||
weight: 'bold',
|
weight: 'bold',
|
||||||
size: !miniature? window.innerWidth/80 : window.innerWidth/105
|
size: !miniature? window.innerWidth/80 : window.innerWidth/125
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
|
|||||||
@ -46,7 +46,7 @@ export function GrossAnualChart({ title, subtitle, dataProps, label, dataset, ba
|
|||||||
},
|
},
|
||||||
ticks: {
|
ticks: {
|
||||||
font: {
|
font: {
|
||||||
size: !miniature? window.innerWidth/90 : window.innerWidth/110
|
size: !miniature? window.innerWidth/90 : window.innerWidth/125
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -57,7 +57,7 @@ export function GrossAnualChart({ title, subtitle, dataProps, label, dataset, ba
|
|||||||
},
|
},
|
||||||
ticks: {
|
ticks: {
|
||||||
font: {
|
font: {
|
||||||
size: !miniature? window.innerWidth/90 : window.innerWidth/110
|
size: !miniature? window.innerWidth/90 : window.innerWidth/125
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -86,7 +86,7 @@ export function GrossAnualChart({ title, subtitle, dataProps, label, dataset, ba
|
|||||||
align: "start",
|
align: "start",
|
||||||
font: {
|
font: {
|
||||||
weight: 'bold',
|
weight: 'bold',
|
||||||
size: !miniature? window.innerWidth/80 : window.innerWidth/105,
|
size: !miniature? window.innerWidth/80 : window.innerWidth/125,
|
||||||
},
|
},
|
||||||
color: (value) => {
|
color: (value) => {
|
||||||
return value.dataset.label==='Consolidada'? '#fff' : '#255488'
|
return value.dataset.label==='Consolidada'? '#fff' : '#255488'
|
||||||
@ -102,12 +102,14 @@ export function GrossAnualChart({ title, subtitle, dataProps, label, dataset, ba
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
let labels: string[];
|
const labels: string[] = label.filter(function(item, pos) {
|
||||||
if (bruta) {
|
return label.indexOf(item) == pos;
|
||||||
labels = [`Até ${new Date().getFullYear()-1}`, `${new Date().getFullYear()}`]
|
});
|
||||||
} else {
|
//if (bruta) {
|
||||||
labels = label
|
// labels = [`Até ${new Date().getFullYear()-1}`, `${new Date().getFullYear()}`]
|
||||||
}
|
//} else {
|
||||||
|
// labels = label;
|
||||||
|
//}
|
||||||
|
|
||||||
const data: any = {
|
const data: any = {
|
||||||
labels,
|
labels,
|
||||||
@ -126,10 +128,13 @@ export function GrossAnualChart({ title, subtitle, dataProps, label, dataset, ba
|
|||||||
type: 'bar',
|
type: 'bar',
|
||||||
stacked: true,
|
stacked: true,
|
||||||
label: 'Estimado',
|
label: 'Estimado',
|
||||||
data: dataProps.filter(value => value.ano === '2022').map((value, index) => {
|
spanGaps: true,
|
||||||
|
data: [null].concat(dataProps.filter(value => value.dad_estimado === true).map((value, index) => {
|
||||||
if (value.dad_estimado)
|
if (value.dad_estimado)
|
||||||
return parseFloat(value.economia_acumulada)
|
return parseFloat(value.economia_acumulada)
|
||||||
}),
|
else
|
||||||
|
return 0
|
||||||
|
})),
|
||||||
borderRadius: 10,
|
borderRadius: 10,
|
||||||
backgroundColor: draw('diagonal-right-left', '#C2d5fb'),
|
backgroundColor: draw('diagonal-right-left', '#C2d5fb'),
|
||||||
},
|
},
|
||||||
|
|||||||
@ -55,7 +55,7 @@ export default function GrossMensalChart({ title, data1, data2, label, subtitle,
|
|||||||
while (index < data1.length) {
|
while (index < data1.length) {
|
||||||
data1[index].dad_estimado? lastData=data1[index].economia_acumulada : null
|
data1[index].dad_estimado? lastData=data1[index].economia_acumulada : null
|
||||||
index++
|
index++
|
||||||
setLastData(`economia acumulada: R$ ${parseFloat(lastData).toFixed(3)}`)
|
setLastData(`economia acumulada: R$ ${parseFloat(lastData).toLocaleString('pt-br', {minimumFractionDigits: 2})}`)
|
||||||
}
|
}
|
||||||
}, [data1])
|
}, [data1])
|
||||||
|
|
||||||
|
|||||||
@ -36,6 +36,8 @@ export const HeaderView = styled.header`
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
width: 40%;
|
width: 40%;
|
||||||
|
max-width: 120px;
|
||||||
|
max-height: 100px;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
@ -92,7 +92,8 @@ export default function Dashboard({grossAnualGraph, grossAnualYears, grossMensal
|
|||||||
<GrossMensalChart title='' subtitle=''
|
<GrossMensalChart title='' subtitle=''
|
||||||
data1={grossMensalGraph}
|
data1={grossMensalGraph}
|
||||||
data2={grossMensalGraph}
|
data2={grossMensalGraph}
|
||||||
label={grossMensalGraph.map((value) => value.mes)}
|
//label={grossMensalGraph.map((value) => value.mes)}
|
||||||
|
label={months}
|
||||||
miniature
|
miniature
|
||||||
/>
|
/>
|
||||||
</GraphCard>
|
</GraphCard>
|
||||||
|
|||||||
@ -74,7 +74,7 @@ export default function economy({userName, anual, years, brutaMensal, catLiv, cl
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
api.post('/economy/estimates', unity!==''?{
|
api.post('/economy/estimates', unity!==''?{
|
||||||
"filters": [
|
"filters": [
|
||||||
{"type" : "=", "field":"dados_cadastrais.cod_smart_unidade", "value": unity!=="default"? null : unity}
|
{"type" : "=", "field":"dados_cadastrais.cod_smart_unidade", "value": unity === "default" ? unity : unity}
|
||||||
]
|
]
|
||||||
}:{}).then(res => {
|
}:{}).then(res => {
|
||||||
setCatLivDataState(res.data.data)
|
setCatLivDataState(res.data.data)
|
||||||
@ -82,7 +82,7 @@ export default function economy({userName, anual, years, brutaMensal, catLiv, cl
|
|||||||
|
|
||||||
api.post('/economy/MWh', unity!==''?{
|
api.post('/economy/MWh', unity!==''?{
|
||||||
"filters": [
|
"filters": [
|
||||||
{"type" : "=", "field":"dados_cadastrais.cod_smart_unidade", "value": unity!=="default"? null : unity}
|
{"type" : "=", "field":"dados_cadastrais.cod_smart_unidade", "value": unity === "default"? unity : unity}
|
||||||
]
|
]
|
||||||
}:{}).then(res => {
|
}:{}).then(res => {
|
||||||
setIndicatorDataState(res.data.data)
|
setIndicatorDataState(res.data.data)
|
||||||
@ -161,7 +161,7 @@ export default function economy({userName, anual, years, brutaMensal, catLiv, cl
|
|||||||
onChange={value => setUnity(value.target.value)}
|
onChange={value => setUnity(value.target.value)}
|
||||||
fullWidth
|
fullWidth
|
||||||
>
|
>
|
||||||
<MenuItem value="default">Todas</MenuItem>
|
<MenuItem value="">Todas</MenuItem>
|
||||||
{
|
{
|
||||||
clients.map((value) => {
|
clients.map((value) => {
|
||||||
return <MenuItem key={1} value={value.cod_smart_unidade}>{value.unidade}</MenuItem>
|
return <MenuItem key={1} value={value.cod_smart_unidade}>{value.unidade}</MenuItem>
|
||||||
@ -190,7 +190,7 @@ export default function economy({userName, anual, years, brutaMensal, catLiv, cl
|
|||||||
onChange={value => setUnity(value.target.value)}
|
onChange={value => setUnity(value.target.value)}
|
||||||
fullWidth
|
fullWidth
|
||||||
>
|
>
|
||||||
<MenuItem value="default">Todas</MenuItem>
|
<MenuItem value="">Todas</MenuItem>
|
||||||
{/* <MenuItem value="RSZFNAENTR101P">RSZFNAENTR101P</MenuItem> COMENTARIO DE OPÇAO COM DADOS TESTES */}
|
{/* <MenuItem value="RSZFNAENTR101P">RSZFNAENTR101P</MenuItem> COMENTARIO DE OPÇAO COM DADOS TESTES */}
|
||||||
{
|
{
|
||||||
clients.map((value) => {
|
clients.map((value) => {
|
||||||
|
|||||||
@ -184,7 +184,7 @@ export default function ResumoOperacao({tableData, clients, userName, clientMont
|
|||||||
return <tr>
|
return <tr>
|
||||||
<td key={value.mes} className='tg-gceh'>{value.mes}</td>
|
<td key={value.mes} className='tg-gceh'>{value.mes}</td>
|
||||||
<td key={value.cod_smart_unidade} className='tg-gceh'>{value.unidade}</td>
|
<td key={value.cod_smart_unidade} className='tg-gceh'>{value.unidade}</td>
|
||||||
<td key={value.operacao} className='tg-gceh'>{value.operacao}</td>
|
<td key={value.operacao} className='tg-gceh'>{value.nf_c_icms > 0 ? 'Compra' : 'Cessão'}</td>
|
||||||
<td key={value.contraparte} className='tg-gceh'>{value.contraparte}</td>
|
<td key={value.contraparte} className='tg-gceh'>{value.contraparte}</td>
|
||||||
<td key={value.montante_nf} className='tg-gceh'>{parseFloat(value.montante_nf).toLocaleString('pt-br')}</td>
|
<td key={value.montante_nf} className='tg-gceh'>{parseFloat(value.montante_nf).toLocaleString('pt-br')}</td>
|
||||||
<td key={value.preco_nf} className='tg-gceh'>{parseFloat(value.preco_nf).toLocaleString('pt-br',{style: 'currency', currency: 'BRL', minimumFractionDigits: 2})}</td>
|
<td key={value.preco_nf} className='tg-gceh'>{parseFloat(value.preco_nf).toLocaleString('pt-br',{style: 'currency', currency: 'BRL', minimumFractionDigits: 2})}</td>
|
||||||
|
|||||||
@ -51,7 +51,7 @@ export const DashboardView = styled.main`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 1195px) {
|
@media (max-width: 1650px) {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user