- added beneficiary stats page;

This commit is contained in:
Vitalii Kiiko
2025-02-10 17:16:34 +01:00
parent 7fa06b5b8c
commit 22453db220
8 changed files with 230 additions and 198 deletions

View File

@@ -1,10 +1,10 @@
import React, { useEffect, useState } from 'react';
import { __ } from '@wordpress/i18n';
import { Tooltip, ResponsiveContainer, Cell, Pie, PieChart } from 'recharts';
import { Tooltip, ResponsiveContainer, Cell, Pie, PieChart, Legend } from 'recharts';
import { isEmpty } from 'ramda';
import getBandoLabel from '../../helpers/getBandoLabel';
// components
// tools
import getBandoLabel from '../../helpers/getBandoLabel';
const ChartDomandePerStato = ({ title, data = [] }) => {
@@ -36,15 +36,13 @@ const ChartDomandePerStato = ({ title, data = [] }) => {
}
return acc;
}, {
inProgress: {value: 0, label: 'In corso'},
approved: {value: 0, label: 'Approvato'},
rejected: {value: 0, label: 'Respinto'}
inProgress: {value: 0, label: __('In corso', 'gepafin')},
approved: {value: 0, label: __('Approvato', 'gepafin')},
rejected: {value: 0, label: __('Respinto', 'gepafin')}
});
setChartData(grouped)
}, [data]);
console.log('chartData', chartData)
return (<div className="chartCard">
{title ? <span className="chartCard__title">{title}</span> : null}
{chartData && !isEmpty(chartData)
@@ -70,6 +68,7 @@ const ChartDomandePerStato = ({ title, data = [] }) => {
))}
</Pie>
<Tooltip content={<CustomTooltip />} />
<Legend verticalAlign="top" height={36}/>
</PieChart>
</ResponsiveContainer>
</div> : null}