- updates;
This commit is contained in:
111
src/pages/DashboardDirector/index.js
Normal file
111
src/pages/DashboardDirector/index.js
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
import React, { useEffect, useState } from 'react';
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
import { pathOr } from 'ramda';
|
||||||
|
import NumberFlow from '@number-flow/react';
|
||||||
|
|
||||||
|
// api
|
||||||
|
import DashboardService from '../../service/dashboard-service';
|
||||||
|
|
||||||
|
// components
|
||||||
|
import DomandeTablePreInstructorAsync from '../DashboardPreInstructor/components/DomandeTablePreInstructorAsync';
|
||||||
|
|
||||||
|
const REACT_APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
||||||
|
|
||||||
|
const DashboardDirector = () => {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const [mainStats, setMainStats] = useState({});
|
||||||
|
|
||||||
|
const getStatValue = (key, fallback = '') => {
|
||||||
|
return pathOr(fallback, [key], mainStats);
|
||||||
|
}
|
||||||
|
|
||||||
|
const getStats = (data) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
setMainStats(data.data.widget1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const errGetStats = () => {
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
DashboardService.getAdminStats(getStats, errGetStats);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="appPage">
|
||||||
|
<div className="appPage__pageHeader">
|
||||||
|
<h1>{__('Dashboard', 'gepafin')}</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
|
<div className="appPageSection statsBigBadges">
|
||||||
|
<h2>{__('Panoramica di Sistema', 'gepafin')}</h2>
|
||||||
|
<div className="statsBigBadges__grid">
|
||||||
|
<div className="statsBigBadges__gridItem">
|
||||||
|
<span>{__('Bandi attivi', 'gepafin')}</span>
|
||||||
|
<span><NumberFlow
|
||||||
|
value={getStatValue('numberOfActiveCalls', 0)}
|
||||||
|
format={{ notation: 'compact' }}
|
||||||
|
locales="it-IT"/></span>
|
||||||
|
</div>
|
||||||
|
<div className="statsBigBadges__gridItem">
|
||||||
|
<span>{__('Utenti registrati', 'gepafin')}</span>
|
||||||
|
<span><NumberFlow
|
||||||
|
value={getStatValue('numberOfResgisteredUsers', 0)}
|
||||||
|
format={{ notation: 'compact' }}
|
||||||
|
locales="it-IT"/></span>
|
||||||
|
</div>
|
||||||
|
<div className="statsBigBadges__gridItem">
|
||||||
|
<span>{__('Domande in pre-istruttoria', 'gepafin')}</span>
|
||||||
|
<span><NumberFlow
|
||||||
|
value={getStatValue('numberOfSubmittedApplications', 0)}
|
||||||
|
format={{ notation: 'compact' }}
|
||||||
|
locales="it-IT"/></span>
|
||||||
|
</div>
|
||||||
|
<div className="statsBigBadges__gridItem">
|
||||||
|
<span>{__('Domande in bozza', 'gepafin')}</span>
|
||||||
|
<span><NumberFlow
|
||||||
|
value={getStatValue('numberOfDraftApplications', 0)}
|
||||||
|
format={{ notation: 'compact' }}
|
||||||
|
locales="it-IT"/></span>
|
||||||
|
</div>
|
||||||
|
<div className="statsBigBadges__gridItem">
|
||||||
|
<span>{__('Aziende', 'gepafin')}</span>
|
||||||
|
<span><NumberFlow
|
||||||
|
value={getStatValue('numberOfCompany', 0)}
|
||||||
|
format={{ notation: 'compact' }}
|
||||||
|
locales="it-IT"/></span>
|
||||||
|
</div>
|
||||||
|
<div className="statsBigBadges__gridItem">
|
||||||
|
<span>{__('Totale finanziamenti attivi', 'gepafin')}</span>
|
||||||
|
<span><NumberFlow
|
||||||
|
value={getStatValue('totalActiveFinancing', 0)}
|
||||||
|
format={{
|
||||||
|
notation: 'compact',
|
||||||
|
compactDisplay: 'short',
|
||||||
|
roundingMode: 'trunc',
|
||||||
|
style: 'currency',
|
||||||
|
currency: 'EUR',
|
||||||
|
currencyDisplay: 'symbol'
|
||||||
|
}}
|
||||||
|
locales="pl-PL"/></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
|
<div className="appPageSection">
|
||||||
|
<h2>{__('Autorizazzioni', 'gepafin')}</h2>
|
||||||
|
<DomandeTablePreInstructorAsync statuses={['OPEN', 'SOCCORSO']} userId={0}/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPage__spacer"></div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DashboardDirector;
|
||||||
@@ -55,6 +55,7 @@ import DocumentsBeneficiary from './pages/DocumentsBeneficiary';
|
|||||||
import LoginConfidi from './pages/LoginConfidi';
|
import LoginConfidi from './pages/LoginConfidi';
|
||||||
import ResetPasswordAdmin from './pages/ResetPasswordAdmin';
|
import ResetPasswordAdmin from './pages/ResetPasswordAdmin';
|
||||||
import DashboardBeneficiarioConfidi from './pages/DashboardBeneficiarioConfidi';
|
import DashboardBeneficiarioConfidi from './pages/DashboardBeneficiarioConfidi';
|
||||||
|
import DashboardDirector from './pages/DashboardDirector';
|
||||||
|
|
||||||
const routes = ({ role, chosenCompanyId }) => {
|
const routes = ({ role, chosenCompanyId }) => {
|
||||||
|
|
||||||
@@ -62,6 +63,7 @@ const routes = ({ role, chosenCompanyId }) => {
|
|||||||
<Routes>
|
<Routes>
|
||||||
<Route element={<ProtectedRoute/>}>
|
<Route element={<ProtectedRoute/>}>
|
||||||
<Route path="/" element={<DefaultLayout>
|
<Route path="/" element={<DefaultLayout>
|
||||||
|
{/*{'ROLE_SUPER_ADMIN' === role ? <DashboardDirector/> : null}*/}
|
||||||
{'ROLE_SUPER_ADMIN' === role ? <Dashboard/> : null}
|
{'ROLE_SUPER_ADMIN' === role ? <Dashboard/> : null}
|
||||||
{'ROLE_BENEFICIARY' === role ? <DashboardBeneficiario/> : null}
|
{'ROLE_BENEFICIARY' === role ? <DashboardBeneficiario/> : null}
|
||||||
{'ROLE_CONFIDI' === role ? <DashboardBeneficiarioConfidi/> : null}
|
{'ROLE_CONFIDI' === role ? <DashboardBeneficiarioConfidi/> : null}
|
||||||
|
|||||||
Reference in New Issue
Block a user