- added amendment stats;
- improved displaying messages during application validation;
This commit is contained in:
@@ -165,19 +165,32 @@ const BandoApplication = () => {
|
||||
const validateApplicationCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
if (data.data.status) {
|
||||
setApplicationStatus(data.data.status); // ask why not 'applicationStatus'?
|
||||
setApplicationStatus(data.data.status);
|
||||
}
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
const errValidateApplicationCallback = (data) => {
|
||||
if (toast.current) {
|
||||
toast.current.show({
|
||||
severity: 'error',
|
||||
summary: '',
|
||||
detail: data.message
|
||||
});
|
||||
if (data.status === 'VALIDATION_ERROR') {
|
||||
if (formMsgs.current) {
|
||||
formMsgs.current.show([
|
||||
{
|
||||
id: '99',
|
||||
sticky: true, severity: 'error', summary: '',
|
||||
detail: data.data.join(' '),
|
||||
closable: true
|
||||
}
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
if (toast.current) {
|
||||
toast.current.show({
|
||||
severity: 'error',
|
||||
summary: '',
|
||||
detail: data.message
|
||||
});
|
||||
}
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
@@ -260,7 +273,7 @@ const BandoApplication = () => {
|
||||
{
|
||||
id: '99',
|
||||
sticky: true, severity: 'error', summary: '',
|
||||
detail: data.data.join(', '),
|
||||
detail: data.data.join(' '),
|
||||
closable: true
|
||||
}
|
||||
]);
|
||||
@@ -420,7 +433,9 @@ const BandoApplication = () => {
|
||||
icon="pi pi-arrow-right"
|
||||
iconPos="right"/> : null}
|
||||
<Button
|
||||
type="button"
|
||||
disabled={'SUBMIT' === applicationStatus || isExpired}
|
||||
onClick={onValidate}
|
||||
label={__('Convalidare', 'gepafin')}
|
||||
icon="pi pi-check"
|
||||
iconPos="right"/>
|
||||
@@ -678,7 +693,7 @@ const BandoApplication = () => {
|
||||
iconPos="right"/>
|
||||
</div> : null}
|
||||
|
||||
{'DRAFT' !== applicationStatus
|
||||
{'AWAITING' === applicationStatus
|
||||
? <div className="appPageSection">
|
||||
<div className="appForm__field">
|
||||
<label htmlFor="signedPdfFile">
|
||||
@@ -701,7 +716,7 @@ const BandoApplication = () => {
|
||||
</div>
|
||||
: null}
|
||||
|
||||
{'DRAFT' !== applicationStatus
|
||||
{['AWAITING', 'READY'].includes(applicationStatus)
|
||||
? <div className="appPageSection">
|
||||
<Button
|
||||
type="button"
|
||||
|
||||
@@ -162,18 +162,18 @@ const BandoFlowEdit = () => {
|
||||
const shoudDisableSaving = useCallback(() => {
|
||||
const nonEmptyFlowItems = flowStructure.flowData.filter(o => isEmpty(o.chosenField)).filter(o => !isEmpty(o.chosenValue));
|
||||
|
||||
/*if (flowForms.length > 2) {
|
||||
console.log('disable BTN:', nonEmptyFlowItems.length !== flowForms.length - 2, isEmpty(flowEdges), 'PUBLISH' === bandoStatus,
|
||||
isEmpty(initialForm), isEmpty(finalForm));
|
||||
/*if (forms.length > 2) {
|
||||
console.log('disable BTN:', nonEmptyFlowItems.length !== forms.length - 2, isEmpty(flowStructure.flowEdges), 'PUBLISH' === bandoStatus,
|
||||
isEmpty(flowStructure.initialForm), isEmpty(flowStructure.finalForm));
|
||||
} else {
|
||||
console.log('disable BTN:', nonEmptyFlowItems.length !== 1, isEmpty(flowEdges), 'PUBLISH' === bandoStatus,
|
||||
isEmpty(initialForm), isEmpty(finalForm));
|
||||
console.log('disable BTN (2 forms):', isEmpty(flowStructure.flowEdges), 'PUBLISH' === bandoStatus,
|
||||
isEmpty(flowStructure.initialForm), isEmpty(flowStructure.finalForm));
|
||||
}*/
|
||||
|
||||
return forms.length > 2
|
||||
? nonEmptyFlowItems.length !== forms.length - 2 || isEmpty(flowStructure.flowEdges) || 'PUBLISH' === bandoStatus
|
||||
|| isEmpty(flowStructure.initialForm) || isEmpty(flowStructure.finalForm)
|
||||
: nonEmptyFlowItems.length !== 1 || isEmpty(flowStructure.flowEdges) || 'PUBLISH' === bandoStatus
|
||||
: isEmpty(flowStructure.flowEdges) || 'PUBLISH' === bandoStatus
|
||||
|| isEmpty(flowStructure.initialForm) || isEmpty(flowStructure.finalForm);
|
||||
}, [flowStructure, forms]);
|
||||
|
||||
|
||||
@@ -564,14 +564,14 @@ const DomandaEditPreInstructor = () => {
|
||||
</p>
|
||||
{APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
|
||||
? <p className="appPageSection__pMeta">
|
||||
<span>{__('NDG', 'gepafin')}</span>
|
||||
<span>{data.ndg}</span>
|
||||
</p> : null}
|
||||
<span>{__('NDG', 'gepafin')}</span>
|
||||
<span>{data.ndg}</span>
|
||||
</p> : null}
|
||||
{APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
|
||||
? <p className="appPageSection__pMeta">
|
||||
<span>{__('Appuntamento', 'gepafin')}</span>
|
||||
<span>{data.appointmentId}</span>
|
||||
</p> : null}
|
||||
<span>{__('Appuntamento', 'gepafin')}</span>
|
||||
<span>{data.appointmentId}</span>
|
||||
</p> : null}
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Bando', 'gepafin')}</span>
|
||||
<span>{data.callName}</span>
|
||||
@@ -817,13 +817,12 @@ const DomandaEditPreInstructor = () => {
|
||||
onClick={doCreateAppointment}
|
||||
label={__('Crea l\'appuntamento', 'gepafin')}
|
||||
/> : null}
|
||||
{APP_EVALUATION_FLOW_ID === '1'
|
||||
? <Button
|
||||
type="button"
|
||||
disabled={!data.id || !['APPOINTMENT'].includes(data.applicationStatus) || evaluationShouldBeBlocked(data)}
|
||||
onClick={doMakeAdmisible}
|
||||
label={__('Ammissibile formalmente', 'gepafin')}
|
||||
/> : null}
|
||||
<Button
|
||||
type="button"
|
||||
disabled={!data.id || !['APPOINTMENT'].includes(data.applicationStatus) || evaluationShouldBeBlocked(data)}
|
||||
onClick={doMakeAdmisible}
|
||||
label={__('Ammissibile formalmente', 'gepafin')}
|
||||
/>
|
||||
{data.id
|
||||
? <Button
|
||||
type="button"
|
||||
@@ -840,7 +839,7 @@ const DomandaEditPreInstructor = () => {
|
||||
type="button"
|
||||
disabled={APP_EVALUATION_FLOW_ID === '1'
|
||||
&& (!['EVALUATION', 'ADMISSIBLE', 'APPOINTMENT'].includes(data.applicationStatus)
|
||||
|| evaluationShouldBeBlocked(data))}
|
||||
|| evaluationShouldBeBlocked(data))}
|
||||
onClick={initiateRejecting}
|
||||
label={__('Respingi Domanda', 'gepafin')}
|
||||
icon="pi pi-times" iconPos="right"/> : null}
|
||||
|
||||
@@ -819,13 +819,12 @@ const DomandaEditPreInstructor = () => {
|
||||
onClick={doCreateAppointment}
|
||||
label={__('Crea l\'appuntamento', 'gepafin')}
|
||||
/> : null}
|
||||
{APP_EVALUATION_FLOW_ID === '1'
|
||||
? <Button
|
||||
type="button"
|
||||
disabled={!data.id || !['APPOINTMENT'].includes(data.applicationStatus) || evaluationShouldBeBlocked(data)}
|
||||
onClick={doMakeAdmisible}
|
||||
label={__('Ammissibile formalmente', 'gepafin')}
|
||||
/> : null}
|
||||
<Button
|
||||
type="button"
|
||||
disabled={!data.id || !['APPOINTMENT'].includes(data.applicationStatus) || evaluationShouldBeBlocked(data)}
|
||||
onClick={doMakeAdmisible}
|
||||
label={__('Ammissibile formalmente', 'gepafin')}
|
||||
/>
|
||||
{data.id
|
||||
? <Button
|
||||
type="button"
|
||||
|
||||
@@ -200,7 +200,7 @@ const Domande = () => {
|
||||
<span><NumberFlow
|
||||
value={getStatValue('evaluationAverageTime', 0)}
|
||||
format={{ notation: 'compact' }}
|
||||
suffix={` ${__('minuti', 'gepafin')}`}
|
||||
suffix={` ${__('giorni', 'gepafin')}`}
|
||||
locales="it-IT"/></span>
|
||||
</div>
|
||||
<div className="statsBigBadges__gridItem">
|
||||
|
||||
@@ -1,10 +1,31 @@
|
||||
import React from 'react';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
|
||||
// components
|
||||
import PreInstructorSoccorsiTable from './components/PreInstructorSoccorsiTable';
|
||||
import DashboardService from '../../service/dashboard-service';
|
||||
import { pathOr } from 'ramda';
|
||||
import NumberFlow from '@number-flow/react';
|
||||
|
||||
const SoccorsoIstruttorioPreInstructor = () => {
|
||||
const [mainStats, setMainStats] = useState({});
|
||||
|
||||
const getStats = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
setMainStats(data.data);
|
||||
}
|
||||
}
|
||||
|
||||
const errGetStats = () => {}
|
||||
|
||||
const getStatValue = (key, fallback = '') => {
|
||||
return pathOr(fallback, [key], mainStats);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
DashboardService.getAmendmentsStats(getStats, errGetStats);
|
||||
}, []);
|
||||
|
||||
return(
|
||||
<div className="appPage">
|
||||
<div className="appPage__pageHeader">
|
||||
@@ -16,6 +37,57 @@ const SoccorsoIstruttorioPreInstructor = () => {
|
||||
<div className="appPageSection">
|
||||
<PreInstructorSoccorsiTable/>
|
||||
</div>
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
<div className="appPageSection statsBigBadges">
|
||||
<h2>{__('Riepilogo', 'gepafin')}</h2>
|
||||
<div className="statsBigBadges__grid applStats">
|
||||
<div className="statsBigBadges__gridItem">
|
||||
<span>{__('Totale richieste', 'gepafin')}</span>
|
||||
<span><NumberFlow
|
||||
value={getStatValue('totalAmendments', 0)}
|
||||
format={{ notation: 'compact' }}
|
||||
locales="it-IT"/></span>
|
||||
</div>
|
||||
<div className="statsBigBadges__gridItem">
|
||||
<span>{__('In attesa risposta', 'gepafin')}</span>
|
||||
<span><NumberFlow
|
||||
value={getStatValue('waitingForResponseAmendments', 0)}
|
||||
format={{ notation: 'compact' }}
|
||||
locales="it-IT"/></span>
|
||||
</div>
|
||||
<div className="statsBigBadges__gridItem">
|
||||
<span>{__('Risposte ricevute', 'gepafin')}</span>
|
||||
<span><NumberFlow
|
||||
value={getStatValue('responseReceivedAmendments', 0)}
|
||||
format={{ notation: 'compact' }}
|
||||
locales="it-IT"/></span>
|
||||
</div>
|
||||
<div className="statsBigBadges__gridItem">
|
||||
<span>{__('Tempo medio di risposta', 'gepafin')}</span>
|
||||
<span><NumberFlow
|
||||
value={getStatValue('averageResponseDays', 0)}
|
||||
format={{ notation: 'compact' }}
|
||||
suffix={` ${__('giorni', 'gepafin')}`}
|
||||
locales="it-IT"/></span>
|
||||
</div>
|
||||
<div className="statsBigBadges__gridItem">
|
||||
<span>{__('Scadute', 'gepafin')}</span>
|
||||
<span><NumberFlow
|
||||
value={getStatValue('expiredAmendments', 0)}
|
||||
format={{ notation: 'compact' }}
|
||||
locales="it-IT"/></span>
|
||||
</div>
|
||||
<div className="statsBigBadges__gridItem">
|
||||
<span>{__('Richieste in scadenza (48h)', 'gepafin')}</span>
|
||||
<span><NumberFlow
|
||||
value={getStatValue('expiringRequestsIn48Hours', 0)}
|
||||
format={{ notation: 'compact' }}
|
||||
locales="en-US"/></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -12,6 +12,10 @@ export default class DashboardService {
|
||||
NetworkService.get(`${API_BASE_URL}/dashboard/application`, callback, errCallback);
|
||||
};
|
||||
|
||||
static getAmendmentsStats = (callback, errCallback) => {
|
||||
NetworkService.get(`${API_BASE_URL}/dashboard/amendment`, callback, errCallback);
|
||||
};
|
||||
|
||||
static getBeneficiaryStatsForCompany = (id, callback, errCallback) => {
|
||||
NetworkService.get(`${API_BASE_URL}/dashboard/beneficiary/company/${id}`, callback, errCallback);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user