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