- added codice ateco as dynamic data;
- stat charts to admin dashboard page;
This commit is contained in:
@@ -4,33 +4,31 @@ import { useNavigate } from 'react-router-dom';
|
||||
import { pathOr } from 'ramda';
|
||||
import NumberFlow from '@number-flow/react';
|
||||
|
||||
// store
|
||||
//import { storeSet } from '../../store';
|
||||
|
||||
// api
|
||||
import DashboardService from '../../service/dashboard-service';
|
||||
|
||||
// components
|
||||
import LatestBandiTable from './components/LatestBandiTable';
|
||||
//import LatestUsersActivityTable from './components/LatestUsersActivityTable';
|
||||
import { Button } from 'primereact/button';
|
||||
//import MyEvaluationsTable from '../DashboardPreInstructor/components/PreInstructorDomandeTable';
|
||||
import AllDomandeTable from '../Domande/components/AllDomandeTable';
|
||||
import DraftApplicationsTable from './components/DraftApplicationsTable';
|
||||
import ChartDomandePerBando from '../../components/ChartDomandePerBando';
|
||||
import ChartStatoDomande from '../../components/ChartStatoDomande';
|
||||
|
||||
const Dashboard = () => {
|
||||
const navigate = useNavigate();
|
||||
const [mainStats, setMainStats] = useState({});
|
||||
const [chartStats, setChartStats] = useState({});
|
||||
|
||||
const onGoToCreateNewBando = () => {
|
||||
navigate('/bandi/new');
|
||||
}
|
||||
|
||||
/*const onGoToUsers = () => {
|
||||
console.log('onGoToUsers')
|
||||
const onGoToUsers = () => {
|
||||
navigate('/utenti');
|
||||
}
|
||||
|
||||
const onGoToStats = () => {
|
||||
/*const onGoToStats = () => {
|
||||
console.log('onGoToStats')
|
||||
}
|
||||
|
||||
@@ -45,16 +43,18 @@ const Dashboard = () => {
|
||||
const getStats = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
setMainStats(data.data.widget1);
|
||||
setChartStats(data.data.widgetBars);
|
||||
}
|
||||
}
|
||||
|
||||
const errGetStats = () => {}
|
||||
const errGetStats = () => {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
DashboardService.getAdminStats(getStats, errGetStats);
|
||||
}, []);
|
||||
|
||||
return(
|
||||
return (
|
||||
<div className="appPage">
|
||||
<div className="appPage__pageHeader">
|
||||
<h1>{__('Dashboard', 'gepafin')}</h1>
|
||||
@@ -147,20 +147,36 @@ const Dashboard = () => {
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
{chartStats.applicationPerCall
|
||||
? <div className="appPageSection">
|
||||
<h2>{__('Statistiche di sistema', 'gepafin')}</h2>
|
||||
<div className="appPageSection columns">
|
||||
<ChartDomandePerBando
|
||||
title={__('Domande per bando', 'gepafin')}
|
||||
data={chartStats.applicationPerCall}/>
|
||||
<ChartStatoDomande
|
||||
title={__('Stato domande', 'gepafin')}
|
||||
data={chartStats.applicationPerStatus}/>
|
||||
</div>
|
||||
</div> : null}
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
<div className="appPageSection__hr">
|
||||
<span>{__('Azioni rapide', 'gepafin')}</span>
|
||||
</div>
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
<div className="appPageSection">
|
||||
<div className="appPageSection__actions">
|
||||
<Button
|
||||
onClick={onGoToCreateNewBando}
|
||||
label={__('Crea nuovo bando', 'gepafin')} icon="pi pi-plus" iconPos="right"/>
|
||||
{/*<Button
|
||||
disabled={true}
|
||||
<Button
|
||||
onClick={onGoToUsers}
|
||||
label={__('Gestione utenti', 'gepafin')} icon="pi pi-users" iconPos="right"/>
|
||||
<Button
|
||||
{/*<Button
|
||||
disabled={true}
|
||||
onClick={onGoToStats}
|
||||
label={__('Report mensile', 'gepafin')} icon="pi pi-chart-bar" iconPos="right"/>
|
||||
|
||||
Reference in New Issue
Block a user