- added saving evaluation v2;
This commit is contained in:
@@ -43,6 +43,75 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.statsBigBadges__gridItemDoubleStats {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 16px;
|
||||||
|
border-radius: 6px;
|
||||||
|
border: 1px solid #858585;
|
||||||
|
background: #cecece;
|
||||||
|
align-items: center;
|
||||||
|
gap: 32px;
|
||||||
|
|
||||||
|
span {
|
||||||
|
color: #FFF;
|
||||||
|
font-size: 18px;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: normal;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
> span:first-of-type {
|
||||||
|
min-height: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.number {
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.auxStats {
|
||||||
|
display: flex;
|
||||||
|
gap: 7px;
|
||||||
|
align-items: flex-start;
|
||||||
|
margin-top: auto;
|
||||||
|
|
||||||
|
span {
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 400;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.badge {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 5px 10px;
|
||||||
|
background-color: var(--card-full-background-color-4);
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-right: 7px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:nth-of-type(1) {
|
||||||
|
border: 1px solid var(--yellow-500);
|
||||||
|
background: var(--card-full-background-color-2);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:nth-of-type(2) {
|
||||||
|
border: 1px solid var(--yellow-500);
|
||||||
|
background: var(--card-full-background-color-3);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:nth-of-type(3) {
|
||||||
|
border: 1px solid var(--yellow-500);
|
||||||
|
background: var(--card-full-background-color-5);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:nth-of-type(4) {
|
||||||
|
border: 1px solid var(--yellow-500);
|
||||||
|
background: var(--card-full-background-color-7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.statsBigBadges__grid {
|
.statsBigBadges__grid {
|
||||||
.statsBigBadges__gridItem {
|
.statsBigBadges__gridItem {
|
||||||
&:nth-of-type(1) {
|
&:nth-of-type(1) {
|
||||||
@@ -109,11 +178,27 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.doubleStatsItems {
|
||||||
|
grid-template-columns: repeat(4, minmax(220px, 1fr));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1290px) {
|
||||||
|
.statsBigBadges__grid {
|
||||||
|
&.doubleStatsItems {
|
||||||
|
grid-template-columns: repeat(2, minmax(220px, 1fr));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 820px) {
|
@media (max-width: 820px) {
|
||||||
.statsBigBadges__grid {
|
.statsBigBadges__grid {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
|
|
||||||
|
&.doubleStatsItems {
|
||||||
|
grid-template-columns: minmax(220px, 1fr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -698,6 +698,7 @@ const BandoApplication = () => {
|
|||||||
</div>
|
</div>
|
||||||
: <FormField
|
: <FormField
|
||||||
key={o.id}
|
key={o.id}
|
||||||
|
disabled={isExpired}
|
||||||
readOnly={formula && !isEmpty(formula.value)}
|
readOnly={formula && !isEmpty(formula.value)}
|
||||||
type={o.name}
|
type={o.name}
|
||||||
fieldName={o.id}
|
fieldName={o.id}
|
||||||
|
|||||||
@@ -27,12 +27,21 @@ const DashboardInstructorManager = () => {
|
|||||||
|
|
||||||
const errGetStats = () => {}
|
const errGetStats = () => {}
|
||||||
|
|
||||||
|
const getDoubleStats = (data) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
console.log(data.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const errGetDoubleStats = () => {}
|
||||||
|
|
||||||
const getStatValue = (key, fallback = '') => {
|
const getStatValue = (key, fallback = '') => {
|
||||||
return pathOr(fallback, [key], mainStats);
|
return pathOr(fallback, [key], mainStats);
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
DashboardService.getEvaluationsStats(getStats, errGetStats);
|
DashboardService.getEvaluationsStats(getStats, errGetStats);
|
||||||
|
DashboardService.getInstructorAmendmentsStats(getDoubleStats, errGetDoubleStats);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return(
|
return(
|
||||||
|
|||||||
@@ -31,12 +31,12 @@ const DashboardPreInstructor = () => {
|
|||||||
|
|
||||||
const errGetStats = () => {}
|
const errGetStats = () => {}
|
||||||
|
|
||||||
const getStatValue = (key, fallback = '') => {
|
const getStatValue = (keys = [], fallback = '') => {
|
||||||
return pathOr(fallback, [key], mainStats);
|
return pathOr(fallback, keys, mainStats);
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
DashboardService.getEvaluationsStats(getStats, errGetStats);
|
DashboardService.getInstructorAmendmentsStats(getStats, errGetStats);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return(
|
return(
|
||||||
@@ -49,49 +49,57 @@ const DashboardPreInstructor = () => {
|
|||||||
|
|
||||||
<div className="appPageSection statsBigBadges">
|
<div className="appPageSection statsBigBadges">
|
||||||
<h2>{__('Riepilogo', 'gepafin')}</h2>
|
<h2>{__('Riepilogo', 'gepafin')}</h2>
|
||||||
<div className="statsBigBadges__grid applStats">
|
<div className="statsBigBadges__grid doubleStatsItems">
|
||||||
<div className="statsBigBadges__gridItem">
|
<div className="statsBigBadges__gridItemDoubleStats">
|
||||||
<span>{__('Totale domande', 'gepafin')}</span>
|
<span>{__('Domande da valutare', 'gepafin')}</span>
|
||||||
<span><NumberFlow
|
<span className="number"><NumberFlow
|
||||||
value={getStatValue('numberOfAssignedApplication', 0)}
|
value={getStatValue(['assignedApplication', 'totalAssignedApplication'], 0)}
|
||||||
format={{ notation: 'compact' }}
|
format={{ notation: 'compact' }}
|
||||||
locales="it-IT"/></span>
|
locales="it-IT"/></span>
|
||||||
|
{/*<div className="auxStats">
|
||||||
|
<span>
|
||||||
|
<span
|
||||||
|
className="badge">{getStatValue(['assignedApplication', 'additionalApplicationPercentage'], 0)}%</span>
|
||||||
|
{__('da ieri', 'gepafin')}</span>
|
||||||
|
</div>*/}
|
||||||
</div>
|
</div>
|
||||||
<div className="statsBigBadges__gridItem">
|
<div className="statsBigBadges__gridItemDoubleStats">
|
||||||
<span>{__('In soccorso', 'gepafin')}</span>
|
<span>{__('Domande valutate', 'gepafin')}</span>
|
||||||
<span><NumberFlow
|
<span className="number"><NumberFlow
|
||||||
value={getStatValue('numberOfApplicationInAmendmentState', 0)}
|
value={getStatValue(['evaluatedApplication', 'evaluatedApplication'], 0)}
|
||||||
format={{ notation: 'compact' }}
|
format={{ notation: 'compact' }}
|
||||||
locales="it-IT"/></span>
|
locales="it-IT"/></span>
|
||||||
|
{/*<div className="auxStats">
|
||||||
|
<span>
|
||||||
|
<span
|
||||||
|
className="badge">{getStatValue(['evaluatedApplication', 'dailyAverage'], 0)}</span>
|
||||||
|
{__('media giornaliera', 'gepafin')}</span>
|
||||||
|
</div>*/}
|
||||||
</div>
|
</div>
|
||||||
<div className="statsBigBadges__gridItem">
|
<div className="statsBigBadges__gridItemDoubleStats">
|
||||||
<span>{__('In valutazione', 'gepafin')}</span>
|
<span>{__('Tempo medio valutazione', 'gepafin')}</span>
|
||||||
<span><NumberFlow
|
<span className="number"><NumberFlow
|
||||||
value={getStatValue('numberOfApplicationInOpenState', 0)}
|
value={getStatValue(['averageEvaluationDays', 'averageEvlauationDaysRating'], 0)}
|
||||||
format={{ notation: 'compact' }}
|
|
||||||
locales="it-IT"/></span>
|
|
||||||
</div>
|
|
||||||
<div className="statsBigBadges__gridItem">
|
|
||||||
<span>{__('Completate', 'gepafin')}</span>
|
|
||||||
<span><NumberFlow
|
|
||||||
value={getStatValue('numberOfApplicationInCloseState', 0)}
|
|
||||||
format={{ notation: 'compact' }}
|
|
||||||
locales="it-IT"/></span>
|
|
||||||
</div>
|
|
||||||
<div className="statsBigBadges__gridItem">
|
|
||||||
<span>{__('Tempo medio di valutazione', 'gepafin')}</span>
|
|
||||||
<span><NumberFlow
|
|
||||||
value={getStatValue('averageEvaluationDays', 0)}
|
|
||||||
format={{ notation: 'compact' }}
|
format={{ notation: 'compact' }}
|
||||||
suffix={` ${__('giorni', 'gepafin')}`}
|
suffix={` ${__('giorni', 'gepafin')}`}
|
||||||
locales="it-IT"/></span>
|
locales="it-IT"/></span>
|
||||||
|
{/*<div className="auxStats">
|
||||||
|
<span>
|
||||||
|
<span className="badge">{getStatValue(['averageEvaluationDays', 'timeDifferenceFromAverage'], 0)}</span>
|
||||||
|
{__('rispetto alla media', 'gepafin')}</span>
|
||||||
|
</div>*/}
|
||||||
</div>
|
</div>
|
||||||
<div className="statsBigBadges__gridItem">
|
<div className="statsBigBadges__gridItemDoubleStats">
|
||||||
<span>{__('Domande in scadenza (48h)', 'gepafin')}</span>
|
<span>{__('Soccorsi istruttori in corso', 'gepafin')}</span>
|
||||||
<span><NumberFlow
|
<span className="number"><NumberFlow
|
||||||
value={getStatValue('numberOfApplicationExpiringIn48Hours', 0)}
|
value={getStatValue(['amendmentInProgress', 'totalAmendmentInProgress'], 0)}
|
||||||
format={{ notation: 'compact' }}
|
format={{ notation: 'compact' }}
|
||||||
locales="en-US"/></span>
|
locales="it-IT"/></span>
|
||||||
|
{/*<div className="auxStats">
|
||||||
|
<span>
|
||||||
|
<span className="badge">{getStatValue(['amendmentInProgress', 'expiringToday'], 0)}</span>
|
||||||
|
{__('in scadenza oggi', 'gepafin')}</span>
|
||||||
|
</div>*/}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ import DownloadSignedApplication from '../DomandaEditPreInstructor/components/Do
|
|||||||
import ListOfFiles from '../DomandaEditPreInstructor/components/ListOfFiles';
|
import ListOfFiles from '../DomandaEditPreInstructor/components/ListOfFiles';
|
||||||
import RepeaterFields from '../DomandaEditPreInstructor/components/RepeaterFields';
|
import RepeaterFields from '../DomandaEditPreInstructor/components/RepeaterFields';
|
||||||
import getDateTimeFromISOstring from '../../helpers/getDateTimeFromISOstring';
|
import getDateTimeFromISOstring from '../../helpers/getDateTimeFromISOstring';
|
||||||
|
import ApplicationInfo from '../DomandaEditPreInstructor/components/ApplicationInfo';
|
||||||
|
import ApplicationDownloadFiles from '../DomandaEditPreInstructor/components/ApplicationDownloadFiles';
|
||||||
|
|
||||||
const APP_EVALUATION_FLOW_ID = process.env.REACT_APP_EVALUATION_FLOW_ID;
|
const APP_EVALUATION_FLOW_ID = process.env.REACT_APP_EVALUATION_FLOW_ID;
|
||||||
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
||||||
@@ -553,67 +555,9 @@ const DomandaEditInstructorManager = () => {
|
|||||||
|
|
||||||
{!isAsyncRequest && !isEmpty(data)
|
{!isAsyncRequest && !isEmpty(data)
|
||||||
? <div className="appPage__content">
|
? <div className="appPage__content">
|
||||||
<div className="appPageSection__withBorder columns">
|
<ApplicationInfo data={data}/>
|
||||||
<p className="appPageSection__pMeta">
|
|
||||||
<span>{__('ID domanda', 'gepafin')}</span>
|
|
||||||
<span>{data.applicationId}</span>
|
|
||||||
</p>
|
|
||||||
<p className="appPageSection__pMeta">
|
|
||||||
<span>{__('Protocollo', 'gepafin')}</span>
|
|
||||||
<span>{data.protocolNumber}</span>
|
|
||||||
</p>
|
|
||||||
{APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
|
|
||||||
? <p className="appPageSection__pMeta">
|
|
||||||
<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}
|
|
||||||
<p className="appPageSection__pMeta">
|
|
||||||
<span>{__('Bando', 'gepafin')}</span>
|
|
||||||
<span>{data.callName}</span>
|
|
||||||
</p>
|
|
||||||
<p className="appPageSection__pMeta">
|
|
||||||
<span>{__('Referente Aziendale', 'gepafin')}</span>
|
|
||||||
<span>{data.beneficiary}</span>
|
|
||||||
</p>
|
|
||||||
<p className="appPageSection__pMeta">
|
|
||||||
<span>{__('Azienda Beneficiaria', 'gepafin')}</span>
|
|
||||||
<span>{data.companyName}</span>
|
|
||||||
</p>
|
|
||||||
<p className="appPageSection__pMeta">
|
|
||||||
<span>{__('Data ricezione', 'gepafin')}</span>
|
|
||||||
<span>{getDateTimeFromISOstring(data.submissionDate)}</span>
|
|
||||||
</p>
|
|
||||||
<p className="appPageSection__pMeta">
|
|
||||||
<span>{__('Data assegnazione', 'gepafin')}</span>
|
|
||||||
<span>{getDateTimeFromISOstring(data.assignedAt)}</span>
|
|
||||||
</p>
|
|
||||||
<p className="appPageSection__pMeta">
|
|
||||||
<span>{__('Aassegnato a', 'gepafin')}</span>
|
|
||||||
<span>{data.assignedUserName}</span>
|
|
||||||
</p>
|
|
||||||
<p className="appPageSection__pMeta">
|
|
||||||
<span>{__('Scadenza Valutazione', 'gepafin')}</span>
|
|
||||||
<span>{getDateFromISOstring(data.evaluationEndDate)}</span>
|
|
||||||
</p>
|
|
||||||
<p className="appPageSection__pMeta">
|
|
||||||
<span>{__('Stato', 'gepafin')}</span>
|
|
||||||
<span>{getBandoLabel(data.applicationStatus)}</span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="appPageSection">
|
<ApplicationDownloadFiles id={id}/>
|
||||||
<h2>{__('Scarica documenti della domanda', 'gepafin')}</h2>
|
|
||||||
<div className="appPageSection__row autoFlow">
|
|
||||||
<DownloadApplicationArchive applicationId={id}/>
|
|
||||||
<DownloadSignedApplication applicationId={id}/>
|
|
||||||
<DownloadCompanyDelegation applicationId={id}/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="appPageSection">
|
<div className="appPageSection">
|
||||||
<h2>{__('Documenti aggiuntivi', 'gepafin')}</h2>
|
<h2>{__('Documenti aggiuntivi', 'gepafin')}</h2>
|
||||||
@@ -628,7 +572,23 @@ const DomandaEditInstructorManager = () => {
|
|||||||
sourceName="evaluation"/>
|
sourceName="evaluation"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="appPageSection">
|
{data.evaluationVersion === 'V2'
|
||||||
|
? <div className="appPageSection">
|
||||||
|
<h2>{__('Documenti allegati', 'gepafin')}</h2>
|
||||||
|
{!isEmpty(data.files)
|
||||||
|
? <ListOfFiles
|
||||||
|
files={data.files}
|
||||||
|
updateFn={updateEvaluationValue}
|
||||||
|
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationShouldBeBlocked(data)}
|
||||||
|
name="files"
|
||||||
|
ndg={data.ndg}
|
||||||
|
applicationId={id}/>
|
||||||
|
: <p>{__('Nessun documento allegato', 'gepafin')}</p>}
|
||||||
|
</div>
|
||||||
|
: null}
|
||||||
|
|
||||||
|
{data.evaluationVersion === 'V1'
|
||||||
|
? <div className="appPageSection">
|
||||||
<h2>{__('Checklist Valutazione', 'gepafin')}</h2>
|
<h2>{__('Checklist Valutazione', 'gepafin')}</h2>
|
||||||
<div className="appPageSection columns">
|
<div className="appPageSection columns">
|
||||||
<div>
|
<div>
|
||||||
@@ -678,6 +638,7 @@ const DomandaEditInstructorManager = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
: null}
|
||||||
|
|
||||||
{!isEmpty(data.amendmentDetails)
|
{!isEmpty(data.amendmentDetails)
|
||||||
? <div className="appPageSection">
|
? <div className="appPageSection">
|
||||||
@@ -691,7 +652,8 @@ const DomandaEditInstructorManager = () => {
|
|||||||
applicationId={id}/>
|
applicationId={id}/>
|
||||||
</div> : null}
|
</div> : null}
|
||||||
|
|
||||||
<div className="appPageSection">
|
{data.evaluationVersion === 'V1'
|
||||||
|
? <div className="appPageSection">
|
||||||
<h2>{__('Punteggi di valutazione', 'gepafin')}</h2>
|
<h2>{__('Punteggi di valutazione', 'gepafin')}</h2>
|
||||||
{data.criteria
|
{data.criteria
|
||||||
? <table className="myTable">
|
? <table className="myTable">
|
||||||
@@ -769,6 +731,7 @@ const DomandaEditInstructorManager = () => {
|
|||||||
</tfoot>
|
</tfoot>
|
||||||
</table> : null}
|
</table> : null}
|
||||||
</div>
|
</div>
|
||||||
|
: null}
|
||||||
|
|
||||||
<div className="appPage__spacer"></div>
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
@@ -832,7 +795,8 @@ const DomandaEditInstructorManager = () => {
|
|||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
disabled={true}
|
disabled={true}
|
||||||
onClick={() => {}}
|
onClick={() => {
|
||||||
|
}}
|
||||||
label={__('Valutazione tecnico-finanziaria positiva', 'gepafin')}
|
label={__('Valutazione tecnico-finanziaria positiva', 'gepafin')}
|
||||||
/>
|
/>
|
||||||
{data.id
|
{data.id
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
import { isNil } from 'ramda';
|
||||||
|
|
||||||
|
// components
|
||||||
|
import DownloadApplicationArchive from '../DownloadApplicationArchive';
|
||||||
|
import DownloadSignedApplication from '../DownloadSignedApplication';
|
||||||
|
import DownloadCompanyDelegation from '../DownloadCompanyDelegation';
|
||||||
|
|
||||||
|
const ApplicationDownloadFiles = ({ id }) => {
|
||||||
|
return (
|
||||||
|
!isNil(id)
|
||||||
|
? <div className="appPageSection">
|
||||||
|
<h2>{__('Scarica documenti della domanda', 'gepafin')}</h2>
|
||||||
|
<div className="appPageSection__row autoFlow">
|
||||||
|
<DownloadApplicationArchive applicationId={id}/>
|
||||||
|
<DownloadSignedApplication applicationId={id}/>
|
||||||
|
<DownloadCompanyDelegation applicationId={id}/>
|
||||||
|
</div>
|
||||||
|
</div> : null
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ApplicationDownloadFiles;
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
import { isNil } from 'ramda';
|
||||||
|
|
||||||
|
// tools
|
||||||
|
import getDateTimeFromISOstring from '../../../../helpers/getDateTimeFromISOstring';
|
||||||
|
import getDateFromISOstring from '../../../../helpers/getDateFromISOstring';
|
||||||
|
import getBandoLabel from '../../../../helpers/getBandoLabel';
|
||||||
|
|
||||||
|
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
||||||
|
|
||||||
|
const ApplicationInfo = ({ data }) => {
|
||||||
|
return (
|
||||||
|
!isNil(data)
|
||||||
|
? <div className="appPageSection__withBorder columns">
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('ID domanda', 'gepafin')}</span>
|
||||||
|
<span>{data.applicationId}</span>
|
||||||
|
</p>
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('Protocollo', 'gepafin')}</span>
|
||||||
|
<span>{data.protocolNumber}</span>
|
||||||
|
</p>
|
||||||
|
{APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
|
||||||
|
? <p className="appPageSection__pMeta">
|
||||||
|
<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}
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('Bando', 'gepafin')}</span>
|
||||||
|
<span>{data.callName}</span>
|
||||||
|
</p>
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('Referente Aziendale', 'gepafin')}</span>
|
||||||
|
<span>{data.beneficiary}</span>
|
||||||
|
</p>
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('Azienda Beneficiaria', 'gepafin')}</span>
|
||||||
|
<span>{data.companyName}</span>
|
||||||
|
</p>
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('Data ricezione', 'gepafin')}</span>
|
||||||
|
<span>{getDateTimeFromISOstring(data.submissionDate)}</span>
|
||||||
|
</p>
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('Data assegnazione', 'gepafin')}</span>
|
||||||
|
<span>{getDateTimeFromISOstring(data.assignedAt)}</span>
|
||||||
|
</p>
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('Aassegnato a', 'gepafin')}</span>
|
||||||
|
<span>{data.assignedUserName}</span>
|
||||||
|
</p>
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('Scadenza Valutazione', 'gepafin')}</span>
|
||||||
|
<span>{getDateFromISOstring(data.evaluationEndDate)}</span>
|
||||||
|
</p>
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('Stato', 'gepafin')}</span>
|
||||||
|
<span>{getBandoLabel(data.applicationStatus)}</span>
|
||||||
|
</p>
|
||||||
|
</div> : null
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ApplicationInfo;
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
import React, { useState, useEffect, useRef, useCallback, useMemo } from 'react';
|
||||||
import { __, sprintf } from '@wordpress/i18n';
|
import { __, sprintf } from '@wordpress/i18n';
|
||||||
import { useNavigate, useParams } from 'react-router-dom';
|
import { useNavigate, useParams } from 'react-router-dom';
|
||||||
import { is, isEmpty, isNil, sum, pathOr, head } from 'ramda';
|
import { is, isEmpty, isNil, sum, pathOr, head, pluck } from 'ramda';
|
||||||
import { klona } from 'klona';
|
import { klona } from 'klona';
|
||||||
import { wrap } from 'object-path-immutable';
|
import { wrap } from 'object-path-immutable';
|
||||||
|
import { useForm } from 'react-hook-form';
|
||||||
|
import { evaluate } from 'mathjs';
|
||||||
|
import equal from 'fast-deep-equal';
|
||||||
|
|
||||||
// store
|
// store
|
||||||
import { storeGet, storeSet, useStore } from '../../store';
|
import { storeGet, storeSet, useStore } from '../../store';
|
||||||
@@ -15,8 +18,21 @@ import AppointmentService from '../../service/appointment-service';
|
|||||||
|
|
||||||
// tools
|
// tools
|
||||||
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
||||||
import getBandoLabel from '../../helpers/getBandoLabel';
|
import {
|
||||||
import getDateFromISOstring from '../../helpers/getDateFromISOstring';
|
isCAP,
|
||||||
|
isCodiceFiscale,
|
||||||
|
isEmail,
|
||||||
|
isEmailPEC,
|
||||||
|
isIBAN,
|
||||||
|
isMarcaDaBollo,
|
||||||
|
isPIVA,
|
||||||
|
isUrl, maxChecks, minChecks, nonEmptyTables
|
||||||
|
} from '../../helpers/validators';
|
||||||
|
import getTokens from '../../helpers/getTokens';
|
||||||
|
import parseCommaDecimal from '../../helpers/parseCommaDecimal';
|
||||||
|
import renderWithDataVars from '../../helpers/renderWithDataVars';
|
||||||
|
import renderHtmlContent from '../../helpers/renderHtmlContent';
|
||||||
|
import formatDateString from '../../helpers/formatDateString';
|
||||||
|
|
||||||
// components
|
// components
|
||||||
import { Skeleton } from 'primereact/skeleton';
|
import { Skeleton } from 'primereact/skeleton';
|
||||||
@@ -32,12 +48,11 @@ import BlockingOverlay from '../../components/BlockingOverlay';
|
|||||||
import { classNames } from 'primereact/utils';
|
import { classNames } from 'primereact/utils';
|
||||||
import { InputTextarea } from 'primereact/inputtextarea';
|
import { InputTextarea } from 'primereact/inputtextarea';
|
||||||
import { InputText } from 'primereact/inputtext';
|
import { InputText } from 'primereact/inputtext';
|
||||||
import DownloadApplicationArchive from './components/DownloadApplicationArchive';
|
|
||||||
import DownloadCompanyDelegation from './components/DownloadCompanyDelegation';
|
|
||||||
import DownloadSignedApplication from './components/DownloadSignedApplication';
|
|
||||||
import ListOfFiles from './components/ListOfFiles';
|
import ListOfFiles from './components/ListOfFiles';
|
||||||
import RepeaterFields from './components/RepeaterFields';
|
import RepeaterFields from './components/RepeaterFields';
|
||||||
import getDateTimeFromISOstring from '../../helpers/getDateTimeFromISOstring';
|
import ApplicationInfo from './components/ApplicationInfo';
|
||||||
|
import ApplicationDownloadFiles from './components/ApplicationDownloadFiles';
|
||||||
|
import FormField from '../../components/FormField';
|
||||||
|
|
||||||
const APP_EVALUATION_FLOW_ID = process.env.REACT_APP_EVALUATION_FLOW_ID;
|
const APP_EVALUATION_FLOW_ID = process.env.REACT_APP_EVALUATION_FLOW_ID;
|
||||||
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
||||||
@@ -67,6 +82,40 @@ const DomandaEditPreInstructor = () => {
|
|||||||
duration: 0,
|
duration: 0,
|
||||||
amount: 0
|
amount: 0
|
||||||
});
|
});
|
||||||
|
const [formData, setFormData] = useState([]);
|
||||||
|
const [formId, setFormId] = useState(0);
|
||||||
|
const [formInitialData, setFormInitialData] = useState(null);
|
||||||
|
const {
|
||||||
|
control,
|
||||||
|
handleSubmit,
|
||||||
|
formState: { errors },
|
||||||
|
setValue,
|
||||||
|
trigger,
|
||||||
|
register,
|
||||||
|
getValues,
|
||||||
|
watch,
|
||||||
|
reset
|
||||||
|
} = useForm({
|
||||||
|
defaultValues: useMemo(() => {
|
||||||
|
return formInitialData ? formInitialData : {}
|
||||||
|
}, [formInitialData]),
|
||||||
|
mode: 'onChange'
|
||||||
|
});
|
||||||
|
const validationFns = {
|
||||||
|
isPIVA,
|
||||||
|
isCodiceFiscale,
|
||||||
|
isCAP,
|
||||||
|
isIBAN,
|
||||||
|
isEmail,
|
||||||
|
isEmailPEC,
|
||||||
|
isUrl,
|
||||||
|
isMarcaDaBollo,
|
||||||
|
minChecks,
|
||||||
|
maxChecks,
|
||||||
|
nonEmptyTables
|
||||||
|
}
|
||||||
|
const values = getValues();
|
||||||
|
const formValues = watch();
|
||||||
|
|
||||||
const goToEvaluationsPage = () => {
|
const goToEvaluationsPage = () => {
|
||||||
navigate('/domande');
|
navigate('/domande');
|
||||||
@@ -108,24 +157,72 @@ const DomandaEditPreInstructor = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getCallback = (data) => {
|
const getVersion = (resp) => {
|
||||||
if (data.status === 'SUCCESS') {
|
if (resp.status === 'SUCCESS') {
|
||||||
setData(getFormattedData(data.data));
|
if (resp.data.evaluationVersion === 'V1') {
|
||||||
setMotivation(data.data.motivation);
|
storeSet.main.setAsyncRequest();
|
||||||
updateFlagsForSoccorso(data.data);
|
ApplicationEvaluationService.getEvaluationByApplId(getCallback, errGetCallback, [
|
||||||
|
['applicationId', resp.data.applicationId]
|
||||||
|
]);
|
||||||
|
} else if (resp.data.evaluationVersion === 'V2') {
|
||||||
|
storeSet.main.setAsyncRequest();
|
||||||
|
ApplicationEvaluationService.getEvaluationV2ByApplId(getCallback, errGetCallback, [
|
||||||
|
['applicationId', resp.data.applicationId]
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
storeSet.main.unsetAsyncRequest();
|
storeSet.main.unsetAsyncRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
const errGetCallback = (data) => {
|
const errGetVersion = (resp) => {
|
||||||
if (toast.current && data.message) {
|
if (toast.current && data.message) {
|
||||||
toast.current.show({
|
toast.current.show({
|
||||||
severity: 'error',
|
severity: 'error',
|
||||||
summary: '',
|
summary: '',
|
||||||
detail: data.message
|
detail: resp.message
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
set404FromErrorResponse(data);
|
set404FromErrorResponse(resp);
|
||||||
|
storeSet.main.unsetAsyncRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
const getCallback = (resp) => {
|
||||||
|
if (resp.status === 'SUCCESS') {
|
||||||
|
setData(getFormattedData(resp.data));
|
||||||
|
setMotivation(resp.data.motivation);
|
||||||
|
updateFlagsForSoccorso(resp.data);
|
||||||
|
setFormData(resp.data.applicationEvaluationFormResponse.content);
|
||||||
|
setFormId(resp.data.applicationEvaluationFormResponse.id);
|
||||||
|
let formDataInitial = {};
|
||||||
|
|
||||||
|
if (resp.data.applicationEvaluationFormResponse.formFields) {
|
||||||
|
const submitData = resp.data.applicationEvaluationFormResponse.formFields.map((o) => ({
|
||||||
|
fieldId: o.fieldId,
|
||||||
|
fieldValue: o.fieldValue
|
||||||
|
}));
|
||||||
|
formDataInitial = submitData.reduce((acc, cur) => {
|
||||||
|
if (cur.fieldValue) {
|
||||||
|
acc[cur.fieldId] = cur.fieldValue;
|
||||||
|
}
|
||||||
|
return acc;
|
||||||
|
}, formDataInitial);
|
||||||
|
}
|
||||||
|
|
||||||
|
reset();
|
||||||
|
setFormInitialData(formDataInitial);
|
||||||
|
}
|
||||||
|
storeSet.main.unsetAsyncRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
const errGetCallback = (resp) => {
|
||||||
|
if (toast.current && resp.message) {
|
||||||
|
toast.current.show({
|
||||||
|
severity: 'error',
|
||||||
|
summary: '',
|
||||||
|
detail: resp.message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
set404FromErrorResponse(resp);
|
||||||
storeSet.main.unsetAsyncRequest();
|
storeSet.main.unsetAsyncRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,7 +265,8 @@ const DomandaEditPreInstructor = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const doSaveDraft = useCallback((doRedirect = '') => {
|
const doSaveDraft = useCallback((doRedirect = '') => {
|
||||||
const formData = {
|
if (data.evaluationVersion === 'V1') {
|
||||||
|
const submitData = {
|
||||||
criteria: klona(data.criteria),
|
criteria: klona(data.criteria),
|
||||||
checklist: klona(data.checklist),
|
checklist: klona(data.checklist),
|
||||||
files: klona(data.files),
|
files: klona(data.files),
|
||||||
@@ -179,14 +277,57 @@ const DomandaEditPreInstructor = () => {
|
|||||||
)),
|
)),
|
||||||
amendmentDetails: klona(data.amendmentDetails),
|
amendmentDetails: klona(data.amendmentDetails),
|
||||||
note: data.note
|
note: data.note
|
||||||
}
|
};
|
||||||
|
|
||||||
ApplicationEvaluationService.updateEvaluation(
|
ApplicationEvaluationService.updateEvaluation(
|
||||||
data.assignedApplicationId,
|
data.assignedApplicationId,
|
||||||
formData,
|
submitData,
|
||||||
(data) => updateCallback(data, doRedirect),
|
(data) => updateCallback(data, doRedirect),
|
||||||
errUpdateCallback
|
errUpdateCallback
|
||||||
);
|
);
|
||||||
|
} else if (data.evaluationVersion === 'V2') {
|
||||||
|
const formValues = getValues();
|
||||||
|
const usedFieldsIds = pluck('id', formData);
|
||||||
|
const newFormValues = Object.keys(formValues)
|
||||||
|
.filter(v => usedFieldsIds.includes(v))
|
||||||
|
.reduce((acc, cur) => {
|
||||||
|
const formField = head(formData.filter(o => o.id === cur));
|
||||||
|
let fieldVal = formValues[cur];
|
||||||
|
|
||||||
|
if (formValues[cur] && formValues[cur].toISOString) {
|
||||||
|
fieldVal = formatDateString(formValues[cur]);
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldVal = isEmpty(fieldVal) ? null : fieldVal;
|
||||||
|
if (formField && formField.name === 'fileupload') {
|
||||||
|
fieldVal = is(Array, fieldVal) ? fieldVal.map(o => o.id).join(',') : null;
|
||||||
|
}
|
||||||
|
acc.push({
|
||||||
|
'fieldId': cur,
|
||||||
|
'fieldValue': fieldVal
|
||||||
|
});
|
||||||
|
return acc;
|
||||||
|
}, []);
|
||||||
|
const submitData = {
|
||||||
|
formFields: newFormValues,
|
||||||
|
files: klona(data.files),
|
||||||
|
evaluationDocument: klona(data.evaluationDocument.map(o => ({
|
||||||
|
...o,
|
||||||
|
fileValue: o.fileValue[0] ? o.fileValue[0].id : ''
|
||||||
|
})
|
||||||
|
)),
|
||||||
|
amendmentDetails: klona(data.amendmentDetails),
|
||||||
|
note: data.note
|
||||||
|
}
|
||||||
|
|
||||||
|
ApplicationEvaluationService.updateEvaluationV2(
|
||||||
|
data.assignedApplicationId,
|
||||||
|
formId,
|
||||||
|
submitData,
|
||||||
|
(data) => updateCallback(data, doRedirect),
|
||||||
|
errUpdateCallback
|
||||||
|
);
|
||||||
|
}
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
const updateCallback = (data, doRedirect = '') => {
|
const updateCallback = (data, doRedirect = '') => {
|
||||||
@@ -432,7 +573,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
setIsVisibleAppointmentDialog(true);
|
setIsVisibleAppointmentDialog(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
const setValue = (name, value) => {
|
const setFieldValue = (name, value) => {
|
||||||
const newData = wrap(appointmentData).set(name, value).value();
|
const newData = wrap(appointmentData).set(name, value).value();
|
||||||
setAppointmentData(newData);
|
setAppointmentData(newData);
|
||||||
}
|
}
|
||||||
@@ -511,6 +652,52 @@ const DomandaEditPreInstructor = () => {
|
|||||||
return isAsyncRequest || userData.id !== data.assignedUserId;
|
return isAsyncRequest || userData.id !== data.assignedUserId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let updatedFormValues = klona(formValues);
|
||||||
|
let context = {};
|
||||||
|
|
||||||
|
// eslint-disable-next-line array-callback-return
|
||||||
|
formData.map((o) => {
|
||||||
|
const variable = head(o.settings.filter(o => o.name === 'variable'));
|
||||||
|
const formula = head(o.settings.filter(o => o.name === 'formula'));
|
||||||
|
|
||||||
|
if (formula && !isEmpty(formula.value)) {
|
||||||
|
context = getTokens(formula.value)
|
||||||
|
.filter(v => !['false', 'null', 'true'].includes(v))
|
||||||
|
.reduce((acc, cur) => {
|
||||||
|
acc[cur] = isNil(context[cur]) ? 0 : parseCommaDecimal(context[cur]);
|
||||||
|
return acc;
|
||||||
|
}, context);
|
||||||
|
|
||||||
|
const mathFormula = renderWithDataVars(formula.value, context);
|
||||||
|
try {
|
||||||
|
updatedFormValues[o.id] = evaluate(mathFormula);
|
||||||
|
} catch (e) {
|
||||||
|
console.log('Error in math formula: "', mathFormula, '"', e.message);
|
||||||
|
updatedFormValues[o.id] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (variable && !isEmpty(variable.value)) {
|
||||||
|
context[variable.value[0]] = 'criteria_table' === o.name
|
||||||
|
? pathOr(0, [o.id, 'total'], updatedFormValues)
|
||||||
|
: pathOr(0, [o.id], updatedFormValues);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!isEmpty(updatedFormValues) && !equal(updatedFormValues, formValues)) {
|
||||||
|
reset(updatedFormValues);
|
||||||
|
}
|
||||||
|
}, [formValues]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (formInitialData) {
|
||||||
|
//reset();
|
||||||
|
Object.keys(formInitialData).map(k => setValue(k, formInitialData[k]));
|
||||||
|
trigger();
|
||||||
|
}
|
||||||
|
}, [formInitialData]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const maxScore = pathOr(0, ['minScore'], data);
|
const maxScore = pathOr(0, ['minScore'], data);
|
||||||
const criteria = pathOr([], ['criteria'], data);
|
const criteria = pathOr([], ['criteria'], data);
|
||||||
@@ -524,9 +711,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
const entityId = !isNaN(parsed) ? parsed : 0;
|
const entityId = !isNaN(parsed) ? parsed : 0;
|
||||||
|
|
||||||
storeSet.main.setAsyncRequest();
|
storeSet.main.setAsyncRequest();
|
||||||
ApplicationEvaluationService.getEvaluationByApplId(getCallback, errGetCallback, [
|
ApplicationEvaluationService.getEvaluationVersionByApplId(entityId, getVersion, errGetVersion);
|
||||||
['applicationId', entityId]
|
|
||||||
]);
|
|
||||||
AmendmentsService.getSoccorsoByApplId(entityId, getAmendmentsCallback, errGetAmendmentsCallback, [
|
AmendmentsService.getSoccorsoByApplId(entityId, getAmendmentsCallback, errGetAmendmentsCallback, [
|
||||||
['statuses', 'AWAITING']
|
['statuses', 'AWAITING']
|
||||||
]);
|
]);
|
||||||
@@ -555,67 +740,9 @@ const DomandaEditPreInstructor = () => {
|
|||||||
|
|
||||||
{!isAsyncRequest && !isEmpty(data)
|
{!isAsyncRequest && !isEmpty(data)
|
||||||
? <div className="appPage__content">
|
? <div className="appPage__content">
|
||||||
<div className="appPageSection__withBorder columns">
|
<ApplicationInfo data={data}/>
|
||||||
<p className="appPageSection__pMeta">
|
|
||||||
<span>{__('ID domanda', 'gepafin')}</span>
|
|
||||||
<span>{data.applicationId}</span>
|
|
||||||
</p>
|
|
||||||
<p className="appPageSection__pMeta">
|
|
||||||
<span>{__('Protocollo', 'gepafin')}</span>
|
|
||||||
<span>{data.protocolNumber}</span>
|
|
||||||
</p>
|
|
||||||
{APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
|
|
||||||
? <p className="appPageSection__pMeta">
|
|
||||||
<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}
|
|
||||||
<p className="appPageSection__pMeta">
|
|
||||||
<span>{__('Bando', 'gepafin')}</span>
|
|
||||||
<span>{data.callName}</span>
|
|
||||||
</p>
|
|
||||||
<p className="appPageSection__pMeta">
|
|
||||||
<span>{__('Referente Aziendale', 'gepafin')}</span>
|
|
||||||
<span>{data.beneficiary}</span>
|
|
||||||
</p>
|
|
||||||
<p className="appPageSection__pMeta">
|
|
||||||
<span>{__('Azienda Beneficiaria', 'gepafin')}</span>
|
|
||||||
<span>{data.companyName}</span>
|
|
||||||
</p>
|
|
||||||
<p className="appPageSection__pMeta">
|
|
||||||
<span>{__('Data ricezione', 'gepafin')}</span>
|
|
||||||
<span>{getDateTimeFromISOstring(data.submissionDate)}</span>
|
|
||||||
</p>
|
|
||||||
<p className="appPageSection__pMeta">
|
|
||||||
<span>{__('Data assegnazione', 'gepafin')}</span>
|
|
||||||
<span>{getDateTimeFromISOstring(data.assignedAt)}</span>
|
|
||||||
</p>
|
|
||||||
<p className="appPageSection__pMeta">
|
|
||||||
<span>{__('Aassegnato a', 'gepafin')}</span>
|
|
||||||
<span>{data.assignedUserName}</span>
|
|
||||||
</p>
|
|
||||||
<p className="appPageSection__pMeta">
|
|
||||||
<span>{__('Scadenza Valutazione', 'gepafin')}</span>
|
|
||||||
<span>{getDateFromISOstring(data.evaluationEndDate)}</span>
|
|
||||||
</p>
|
|
||||||
<p className="appPageSection__pMeta">
|
|
||||||
<span>{__('Stato', 'gepafin')}</span>
|
|
||||||
<span>{getBandoLabel(data.applicationStatus)}</span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="appPageSection">
|
<ApplicationDownloadFiles id={id}/>
|
||||||
<h2>{__('Scarica documenti della domanda', 'gepafin')}</h2>
|
|
||||||
<div className="appPageSection__row autoFlow">
|
|
||||||
<DownloadApplicationArchive applicationId={id}/>
|
|
||||||
<DownloadSignedApplication applicationId={id}/>
|
|
||||||
<DownloadCompanyDelegation applicationId={id}/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="appPageSection">
|
<div className="appPageSection">
|
||||||
<h2>{__('Documenti aggiuntivi', 'gepafin')}</h2>
|
<h2>{__('Documenti aggiuntivi', 'gepafin')}</h2>
|
||||||
@@ -630,7 +757,98 @@ const DomandaEditPreInstructor = () => {
|
|||||||
sourceName="evaluation"/>
|
sourceName="evaluation"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="appPageSection">
|
{data.evaluationVersion === 'V2'
|
||||||
|
? <div className="appPageSection">
|
||||||
|
<h2>{__('Documenti allegati', 'gepafin')}</h2>
|
||||||
|
{!isEmpty(data.files)
|
||||||
|
? <ListOfFiles
|
||||||
|
files={data.files}
|
||||||
|
updateFn={updateEvaluationValue}
|
||||||
|
shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationShouldBeBlocked(data)}
|
||||||
|
name="files"
|
||||||
|
ndg={data.ndg}
|
||||||
|
applicationId={id}/>
|
||||||
|
: <p>{__('Nessun documento allegato', 'gepafin')}</p>}
|
||||||
|
</div>
|
||||||
|
: null}
|
||||||
|
|
||||||
|
{data.evaluationVersion === 'V2'
|
||||||
|
? <form className="appForm" onSubmit={handleSubmit(() => {})}>
|
||||||
|
{formData.map(o => {
|
||||||
|
const label = head(o.settings.filter(o => o.name === 'label'));
|
||||||
|
const text = head(o.settings.filter(o => o.name === 'text'));
|
||||||
|
const placeholder = head(o.settings.filter(o => o.name === 'placeholder'));
|
||||||
|
const options = head(o.settings.filter(o => o.name === 'options'));
|
||||||
|
let tableColumns = head(o.settings.filter(o => o.name === 'table_columns'));
|
||||||
|
if (!tableColumns) {
|
||||||
|
tableColumns = head(o.settings.filter(o => o.name === 'criteria_table_columns'));
|
||||||
|
}
|
||||||
|
const step = head(o.settings.filter(o => o.name === 'step'));
|
||||||
|
const mime = head(o.settings.filter(o => o.name === 'mime'));
|
||||||
|
const formula = head(o.settings.filter(o => o.name === 'formula'));
|
||||||
|
let mimeValue = '';
|
||||||
|
|
||||||
|
if (mime) {
|
||||||
|
mimeValue = mime.value.map(o => o.code ? o.code : o.ext);
|
||||||
|
}
|
||||||
|
|
||||||
|
const validations = Object.keys(o.validators).reduce((acc, cur) => {
|
||||||
|
if (o.validators[cur]) {
|
||||||
|
if (['min', 'max', 'minLength', 'maxLength', 'maxSize'].includes(cur)) {
|
||||||
|
acc[cur] = parseInt(o.validators[cur]);
|
||||||
|
} else if ('pattern' === cur) {
|
||||||
|
acc[cur] = new RegExp(o.validators[cur]);
|
||||||
|
} else if ('isRequired' === cur) {
|
||||||
|
//acc[cur] = o.validators[cur];
|
||||||
|
acc['required'] = true;
|
||||||
|
} else if ('custom' === cur && validationFns[o.validators[cur]]) {
|
||||||
|
if (!acc.validate) {
|
||||||
|
acc.validate = {};
|
||||||
|
}
|
||||||
|
acc.validate[o.validators[cur]] = validationFns[o.validators[cur]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
/*if (o.name === 'table') {
|
||||||
|
console.log('value:', values[o.id] ? values[o.id] : '')
|
||||||
|
}*/
|
||||||
|
|
||||||
|
return ['paragraph'].includes(o.name) && text
|
||||||
|
? <div key={o.id}>
|
||||||
|
<div className="ql-editor">
|
||||||
|
{renderHtmlContent(text.value)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
: <FormField
|
||||||
|
key={o.id}
|
||||||
|
readOnly={formula && !isEmpty(formula.value)}
|
||||||
|
type={o.name}
|
||||||
|
fieldName={o.id}
|
||||||
|
label={label ? label.value : ''}
|
||||||
|
placeholder={placeholder ? placeholder.value : ''}
|
||||||
|
control={control}
|
||||||
|
register={register}
|
||||||
|
errors={errors}
|
||||||
|
defaultValue={values[o.id] ? values[o.id] : ''}
|
||||||
|
maxFractionDigits={step ? step.value : 0}
|
||||||
|
accept={mimeValue}
|
||||||
|
config={validations}
|
||||||
|
options={options ? options.value : []}
|
||||||
|
setDataFn={setValue}
|
||||||
|
saveFormCallback={doSaveDraft}
|
||||||
|
sourceId={id}
|
||||||
|
useGrouping={false}
|
||||||
|
tableColumns={tableColumns ? tableColumns.value : {}}
|
||||||
|
/>
|
||||||
|
})}
|
||||||
|
</form>
|
||||||
|
: null}
|
||||||
|
|
||||||
|
{data.evaluationVersion === 'V1'
|
||||||
|
? <div className="appPageSection">
|
||||||
<h2>{__('Checklist Valutazione', 'gepafin')}</h2>
|
<h2>{__('Checklist Valutazione', 'gepafin')}</h2>
|
||||||
<div className="appPageSection columns">
|
<div className="appPageSection columns">
|
||||||
<div>
|
<div>
|
||||||
@@ -680,6 +898,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
: null}
|
||||||
|
|
||||||
{!isEmpty(data.amendmentDetails)
|
{!isEmpty(data.amendmentDetails)
|
||||||
? <div className="appPageSection">
|
? <div className="appPageSection">
|
||||||
@@ -693,7 +912,8 @@ const DomandaEditPreInstructor = () => {
|
|||||||
applicationId={id}/>
|
applicationId={id}/>
|
||||||
</div> : null}
|
</div> : null}
|
||||||
|
|
||||||
<div className="appPageSection">
|
{data.evaluationVersion === 'V1'
|
||||||
|
? <div className="appPageSection">
|
||||||
<h2>{__('Punteggi di valutazione', 'gepafin')}</h2>
|
<h2>{__('Punteggi di valutazione', 'gepafin')}</h2>
|
||||||
{data.criteria
|
{data.criteria
|
||||||
? <table className="myTable">
|
? <table className="myTable">
|
||||||
@@ -771,6 +991,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
</tfoot>
|
</tfoot>
|
||||||
</table> : null}
|
</table> : null}
|
||||||
</div>
|
</div>
|
||||||
|
: null}
|
||||||
|
|
||||||
<div className="appPage__spacer"></div>
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
@@ -834,7 +1055,8 @@ const DomandaEditPreInstructor = () => {
|
|||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
disabled={true}
|
disabled={true}
|
||||||
onClick={() => {}}
|
onClick={() => {
|
||||||
|
}}
|
||||||
label={__('Valutazione tecnico-finanziaria positiva', 'gepafin')}
|
label={__('Valutazione tecnico-finanziaria positiva', 'gepafin')}
|
||||||
/>
|
/>
|
||||||
{data.id
|
{data.id
|
||||||
@@ -904,7 +1126,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
value={appointmentData.amount}
|
value={appointmentData.amount}
|
||||||
keyfilter="int"
|
keyfilter="int"
|
||||||
invalid={isEmpty(appointmentData.amount) || appointmentData.amount === 0}
|
invalid={isEmpty(appointmentData.amount) || appointmentData.amount === 0}
|
||||||
onChange={(e) => setValue('amount', e.value)}/>
|
onChange={(e) => setFieldValue('amount', e.value)}/>
|
||||||
</div>
|
</div>
|
||||||
<div className="appForm__field">
|
<div className="appForm__field">
|
||||||
<label
|
<label
|
||||||
@@ -915,7 +1137,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
value={appointmentData.duration}
|
value={appointmentData.duration}
|
||||||
keyfilter="int"
|
keyfilter="int"
|
||||||
invalid={isEmpty(appointmentData.duration) || appointmentData.duration === 0}
|
invalid={isEmpty(appointmentData.duration) || appointmentData.duration === 0}
|
||||||
onChange={(e) => setValue('duration', e.value)}/>
|
onChange={(e) => setFieldValue('duration', e.value)}/>
|
||||||
</div>
|
</div>
|
||||||
<div className="appForm__field">
|
<div className="appForm__field">
|
||||||
<label className={classNames({ 'p-error': isEmpty(appointmentData.title) })}>
|
<label className={classNames({ 'p-error': isEmpty(appointmentData.title) })}>
|
||||||
@@ -924,7 +1146,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
<InputText
|
<InputText
|
||||||
value={appointmentData.title}
|
value={appointmentData.title}
|
||||||
invalid={isEmpty(appointmentData.title)}
|
invalid={isEmpty(appointmentData.title)}
|
||||||
onChange={(e) => setValue('title', e.target.value)}/>
|
onChange={(e) => setFieldValue('title', e.target.value)}/>
|
||||||
</div>
|
</div>
|
||||||
<div className="appForm__field">
|
<div className="appForm__field">
|
||||||
<label className={classNames({ 'p-error': isEmpty(appointmentData.text) })}>
|
<label className={classNames({ 'p-error': isEmpty(appointmentData.text) })}>
|
||||||
@@ -933,7 +1155,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
<InputTextarea
|
<InputTextarea
|
||||||
value={appointmentData.text}
|
value={appointmentData.text}
|
||||||
invalid={isEmpty(appointmentData.text)}
|
invalid={isEmpty(appointmentData.text)}
|
||||||
onChange={(e) => setValue('text', e.target.value)}
|
onChange={(e) => setFieldValue('text', e.target.value)}
|
||||||
rows={3}
|
rows={3}
|
||||||
cols={30}/>
|
cols={30}/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState, useCallback } from 'react';
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
import { pathOr } from 'ramda';
|
import { pathOr } from 'ramda';
|
||||||
import NumberFlow from '@number-flow/react';
|
import NumberFlow from '@number-flow/react';
|
||||||
@@ -22,9 +22,9 @@ const SoccorsoIstruttorioPreInstructor = () => {
|
|||||||
|
|
||||||
const errGetStats = () => {}
|
const errGetStats = () => {}
|
||||||
|
|
||||||
const getStatValue = (key, fallback = '') => {
|
const getStatValue = useCallback((key, fallback = '') => {
|
||||||
return pathOr(fallback, [key], mainStats);
|
return pathOr(fallback, [key], mainStats);
|
||||||
}
|
}, [mainStats]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
DashboardService.getAmendmentsStats(getStats, errGetStats);
|
DashboardService.getAmendmentsStats(getStats, errGetStats);
|
||||||
|
|||||||
@@ -8,7 +8,21 @@ export default class ApplicationEvaluationService {
|
|||||||
NetworkService.get(`${API_BASE_URL}/applicationEvaluation/application`, callback, errCallback, queryParams);
|
NetworkService.get(`${API_BASE_URL}/applicationEvaluation/application`, callback, errCallback, queryParams);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static getEvaluationV2ByApplId = (callback, errCallback, queryParams) => {
|
||||||
|
NetworkService.get(`${API_BASE_URL}/applicationEvaluation/v2`, callback, errCallback, queryParams);
|
||||||
|
};
|
||||||
|
|
||||||
|
static getEvaluationVersionByApplId = (id, callback, errCallback, queryParams) => {
|
||||||
|
NetworkService.get(`${API_BASE_URL}/applicationEvaluation/application/${id}/version`, callback, errCallback, queryParams);
|
||||||
|
};
|
||||||
|
|
||||||
static updateEvaluation = (assignedApplicationId, body, callback, errCallback, queryParams) => {
|
static updateEvaluation = (assignedApplicationId, body, callback, errCallback, queryParams) => {
|
||||||
NetworkService.put(`${API_BASE_URL}/applicationEvaluation/${assignedApplicationId}`, body, callback, errCallback, queryParams);
|
NetworkService.put(`${API_BASE_URL}/applicationEvaluation/${assignedApplicationId}`, body, callback, errCallback, queryParams);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static updateEvaluationV2 = (assignedApplicationId, formId, body, callback, errCallback, queryParams = []) => {
|
||||||
|
NetworkService.put(`${API_BASE_URL}/applicationEvaluation/v2/assignedApplication/${assignedApplicationId}`, body, callback, errCallback, [
|
||||||
|
['evaluationFormId', formId]
|
||||||
|
]);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,4 +23,8 @@ export default class DashboardService {
|
|||||||
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);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static getInstructorAmendmentsStats = (callback, errCallback) => {
|
||||||
|
NetworkService.get(`${API_BASE_URL}/dashboard/instructor/amendment`, callback, errCallback);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user