-
-
{__('Lista', 'gepafin')}
-
-
- {data.checklist.map((o, i) =>
- updateEvaluationValue(
- e.checked,
- ['checklist', i, 'valid']
- )}
- checked={o.valid}>
-
-
)}
+ {data.evaluationVersion === 'V2'
+ ?
+
{__('Documenti allegati', 'gepafin')}
+ {!isEmpty(data.files)
+ ?
shouldDisableField(name) || evaluationBlockedForUser(data)}
+ name="files"
+ ndg={data.ndg}
+ applicationId={id}/>
+ : {__('Nessun documento allegato', 'gepafin')}
}
+
+ : null}
+
+ {data.evaluationVersion === 'V2'
+ ?
+ : null}
+
+ {data.evaluationVersion === 'V1'
+ ?
+
{__('Checklist Valutazione', 'gepafin')}
+
+
+
{__('Lista', 'gepafin')}
+
+
+ {data.checklist.map((o, i) =>
+ updateEvaluationValue(
+ e.checked,
+ ['checklist', i, 'valid']
+ )}
+ checked={o.valid}>
+
+
)}
+
+
+
+
{__('Note', 'gepafin')}
+
+ updateEvaluationValue(
+ e.htmlValue,
+ ['note']
+ )}
+ style={{ height: 80 * 3, width: '100%' }}
+ />
-
-
{__('Note', 'gepafin')}
-
updateEvaluationValue(
- e.htmlValue,
- ['note']
- )}
- style={{ height: 80 * 3, width: '100%' }}
- />
+ {__('Documenti allegati', 'gepafin')}
+ {!isEmpty(data.files)
+ ? shouldDisableField(name) || evaluationBlockedForUser(data)}
+ name="files"
+ ndg={data.ndg}
+ applicationId={id}/>
+ : {__('Nessun documento allegato', 'gepafin')}
}
-
-
{__('Documenti allegati', 'gepafin')}
- {!isEmpty(data.files)
- ?
shouldDisableField(name) || evaluationShouldBeBlocked(data)}
- name="files"
- ndg={data.ndg}
- applicationId={id}/>
- : {__('Nessun documento allegato', 'gepafin')}
}
-
-
+ : null}
{!isEmpty(data.amendmentDetails)
?
@@ -685,90 +1092,92 @@ const DomandaEditInstructorManager = () => {
shouldDisableField(name) || evaluationShouldBeBlocked(data)}
+ shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationBlockedForUser(data)}
name="amendmentDetails"
ndg={data.ndg}
applicationId={id}/>
: null}
-
-
{__('Punteggi di valutazione', 'gepafin')}
- {data.criteria
- ?
-
-
- | {__('Parametro', 'gepafin')} |
- {__('Punteggio', 'gepafin')} |
- {__('Stato', 'gepafin')} |
-
-
-
- {data.criteria.map((o, i) =>
- | {o.label} |
-
-
- updateEvaluationValue(
- e.value,
- ['criteria', i, 'score'],
- o.criteria
- )}/>
-
+ {data.evaluationVersion === 'V1'
+ ?
+ {__('Punteggi di valutazione', 'gepafin')}
+ {data.criteria
+ ?
+
+
+ | {__('Parametro', 'gepafin')} |
+ {__('Punteggio', 'gepafin')} |
+ {__('Stato', 'gepafin')} |
+
+
+
+ {data.criteria.map((o, i) =>
+ | {o.label} |
+
+
+ updateEvaluationValue(
+ e.value,
+ ['criteria', i, 'score'],
+ o.criteria
+ )}/>
+
/ {o.maxScore}
-
- |
-
-
- {!isEmpty(o.criteriaMappedFields)
- ?
- |
- )}
-
- | {__('Punteggio:', 'gepafin')} |
- {sum(data.criteria.map(o => o.score))} |
-
- {isAdmissible
- ? : null}
- {!isAdmissible
- ? : null}
- |
-
-
-
-
- | {sprintf(__('Punteggio minimo per l\'ammissione: %d'), data.minScore)} |
-
-
- : null}
-
+
+ |
+
+
+ {!isEmpty(o.criteriaMappedFields)
+ ? displayCriterionData(o.id)}
+ aria-label={__('Mostra', 'gepafin')}/> : null}
+ updateEvaluationValue(
+ true,
+ ['criteria', i, 'valid']
+ )}
+ aria-label={__('Su', 'gepafin')}/>
+ updateEvaluationValue(
+ false,
+ ['criteria', i, 'valid']
+ )}
+ aria-label={__('Giu', 'gepafin')}/>
+
+ |
+
)}
+
+ | {__('Punteggio:', 'gepafin')} |
+ {sum(data.criteria.map(o => o.score))} |
+
+ {isAdmissible
+ ? : null}
+ {!isAdmissible
+ ? : null}
+ |
+
+
+
+
+ | {sprintf(__('Punteggio minimo per l\'ammissione: %d'), data.minScore)} |
+
+
+
: null}
+
+ : null}
@@ -777,85 +1186,7 @@ const DomandaEditInstructorManager = () => {
-
- {['EVALUATION', 'SOCCORSO', 'CLOSE'].includes(data.applicationStatus)
- ?
- {data.applicationStatus === 'EVALUATION'
- ? __('Richiedi soccorso istruttorio', 'gepafin')
- : __('Apri soccorso istruttorio', 'gepafin')}
-
-
-
- >}
- /> : null}
- {data.id
- ? doSaveDraft()}
- outlined
- label={__('Salva bozza valutazione', 'gepafin')}
- icon="pi pi-save" iconPos="right"/>
- : doSaveDraft()}
- label={__('Crea valutazione', 'gepafin')}
- icon="pi pi-save" iconPos="right"/>}
- {APP_EVALUATION_FLOW_ID === '1' && ['EVALUATION'].includes(data.applicationStatus)
- && APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
- ? : null}
- {APP_EVALUATION_FLOW_ID === '1' && APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
- ? : null}
-
- {}}
- label={__('Valutazione tecnico-finanziaria positiva', 'gepafin')}
- />
- {data.id
- ? : null}
- {data.id
- ? : null}
-
+ {actionBtns()}
diff --git a/src/pages/DomandaEditPreInstructor/components/ApplicationDownloadFiles/index.js b/src/pages/DomandaEditPreInstructor/components/ApplicationDownloadFiles/index.js
new file mode 100644
index 0000000..64be84e
--- /dev/null
+++ b/src/pages/DomandaEditPreInstructor/components/ApplicationDownloadFiles/index.js
@@ -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)
+ ?
+
{__('Scarica documenti della domanda', 'gepafin')}
+
+
+
+
+
+
: null
+ )
+}
+
+export default ApplicationDownloadFiles;
\ No newline at end of file
diff --git a/src/pages/DomandaEditPreInstructor/components/ApplicationInfo/index.js b/src/pages/DomandaEditPreInstructor/components/ApplicationInfo/index.js
new file mode 100644
index 0000000..d3d0a4f
--- /dev/null
+++ b/src/pages/DomandaEditPreInstructor/components/ApplicationInfo/index.js
@@ -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)
+ ?
+
+ {__('ID domanda', 'gepafin')}
+ {data.applicationId}
+
+
+ {__('Protocollo', 'gepafin')}
+ {data.protocolNumber}
+
+ {APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
+ ?
+ {__('NDG', 'gepafin')}
+ {data.ndg}
+
: null}
+ {APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
+ ?
+ {__('Appuntamento', 'gepafin')}
+ {data.appointmentId}
+
: null}
+
+ {__('Bando', 'gepafin')}
+ {data.callName}
+
+
+ {__('Referente Aziendale', 'gepafin')}
+ {data.beneficiary}
+
+
+ {__('Azienda Beneficiaria', 'gepafin')}
+ {data.companyName}
+
+
+ {__('Data ricezione', 'gepafin')}
+ {getDateTimeFromISOstring(data.submissionDate)}
+
+
+ {__('Data assegnazione', 'gepafin')}
+ {getDateTimeFromISOstring(data.assignedAt)}
+
+
+ {__('Aassegnato a', 'gepafin')}
+ {data.assignedUserName}
+
+
+ {__('Scadenza Valutazione', 'gepafin')}
+ {getDateFromISOstring(data.evaluationEndDate)}
+
+
+ {__('Stato', 'gepafin')}
+ {getBandoLabel(data.applicationStatus)}
+
+
: null
+ )
+}
+
+export default ApplicationInfo;
\ No newline at end of file
diff --git a/src/pages/DomandaEditPreInstructor/index.js b/src/pages/DomandaEditPreInstructor/index.js
index 684adf2..64b4546 100644
--- a/src/pages/DomandaEditPreInstructor/index.js
+++ b/src/pages/DomandaEditPreInstructor/index.js
@@ -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 { 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 { wrap } from 'object-path-immutable';
+import { useForm } from 'react-hook-form';
+import { evaluate } from 'mathjs';
+import equal from 'fast-deep-equal';
// store
import { storeGet, storeSet, useStore } from '../../store';
@@ -15,8 +18,21 @@ import AppointmentService from '../../service/appointment-service';
// tools
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
-import getBandoLabel from '../../helpers/getBandoLabel';
-import getDateFromISOstring from '../../helpers/getDateFromISOstring';
+import {
+ 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
import { Skeleton } from 'primereact/skeleton';
@@ -32,12 +48,11 @@ import BlockingOverlay from '../../components/BlockingOverlay';
import { classNames } from 'primereact/utils';
import { InputTextarea } from 'primereact/inputtextarea';
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 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_HUB_ID = process.env.REACT_APP_HUB_ID;
@@ -67,12 +82,46 @@ const DomandaEditPreInstructor = () => {
duration: 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 = () => {
navigate('/domande');
}
- const updateFlagsForSoccorso = (data) => {
+ const updateFlagsForSoccorso = useCallback((data) => {
let nonRatedFilesLength = 0;
if (data.files) {
@@ -91,14 +140,28 @@ const DomandaEditPreInstructor = () => {
setAllFilesRated(nonRatedFilesLength === 0);
- if (data.checklist) {
- const checkedChecklistItems = data.checklist
- .map(el => el.valid)
- .filter(v => v);
- setAtLeastOneChecked(checkedChecklistItems.length > 0);
- setAllChecksChecked(checkedChecklistItems.length === data.checklist.length)
+ if (data.evaluationVersion === 'V1') {
+ if (data.checklist) {
+ const checkedChecklistItems = data.checklist
+ .map(el => el.valid)
+ .filter(v => v);
+ setAtLeastOneChecked(checkedChecklistItems.length > 0);
+ setAllChecksChecked(checkedChecklistItems.length === data.checklist.length)
+ }
+ } else if (data.evaluationVersion === 'V2') {
+ const minChecks = data.numberOfCheck;
+ const formFieldsChecklist = formData
+ .filter(o => head(o.settings.filter(s => s.name === 'isChecklistItem' && s.value)))
+ .map(o => o.id);
+
+ if (formFieldsChecklist.length >= minChecks) {
+ const valuesTotal = formFieldsChecklist.map(v => formValues[v]);
+ const valuesFirst = valuesTotal.toSpliced(minChecks);
+ setAtLeastOneChecked(valuesTotal.filter(v => v === true).length === valuesTotal.length);
+ setAllChecksChecked(valuesFirst.filter(v => v === true).length === valuesFirst.length)
+ }
}
- }
+ }, [formValues]);
const doNewSoccorso = () => {
if (connectedSoccorsoId !== 0) {
@@ -108,24 +171,75 @@ const DomandaEditPreInstructor = () => {
}
}
- const getCallback = (data) => {
- if (data.status === 'SUCCESS') {
- setData(getFormattedData(data.data));
- setMotivation(data.data.motivation);
- updateFlagsForSoccorso(data.data);
+ const getVersion = (resp) => {
+ if (resp.status === 'SUCCESS') {
+ if (resp.data.evaluationVersion === 'V1') {
+ storeSet.main.setAsyncRequest();
+ 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();
}
- const errGetCallback = (data) => {
+ const errGetVersion = (resp) => {
if (toast.current && data.message) {
toast.current.show({
severity: 'error',
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);
+
+ if (resp.data.evaluationVersion === 'V2') {
+ 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();
}
@@ -167,26 +281,74 @@ const DomandaEditPreInstructor = () => {
updateFlagsForSoccorso(newData);
}
- const doSaveDraft = useCallback((doRedirect = '') => {
- const formData = {
- criteria: klona(data.criteria),
- checklist: klona(data.checklist),
- 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
- }
+ const getTransformedSubmitData = () => {
+ const formValues = getValues();
+ const usedFieldsIds = pluck('id', formData);
+ return Object.keys(formValues)
+ .filter(v => usedFieldsIds.includes(v))
+ .reduce((acc, cur) => {
+ const formField = head(formData.filter(o => o.id === cur));
+ let fieldVal = formValues[cur];
- ApplicationEvaluationService.updateEvaluation(
- data.assignedApplicationId,
- formData,
- (data) => updateCallback(data, doRedirect),
- errUpdateCallback
- );
+ 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 doSaveDraft = useCallback((doRedirect = '') => {
+ if (data.evaluationVersion === 'V1') {
+ const submitData = {
+ criteria: klona(data.criteria),
+ checklist: klona(data.checklist),
+ 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.updateEvaluation(
+ data.assignedApplicationId,
+ submitData,
+ (data) => updateCallback(data, doRedirect),
+ errUpdateCallback
+ );
+ } else if (data.evaluationVersion === 'V2') {
+ const newFormValues = getTransformedSubmitData();
+ 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]);
const updateCallback = (data, doRedirect = '') => {
@@ -219,33 +381,95 @@ const DomandaEditPreInstructor = () => {
}
const doApprove = () => {
- const formData = {
- applicationStatus: 'APPROVED',
- criteria: klona(data.criteria),
- checklist: klona(data.checklist),
- files: klona(data.files),
- note: data.note,
- motivation
- }
+ if (data.evaluationVersion === 'V1') {
+ const submitData = {
+ applicationStatus: 'APPROVED',
+ criteria: klona(data.criteria),
+ checklist: klona(data.checklist),
+ files: klona(data.files),
+ note: data.note,
+ motivation
+ }
- setLoading(true);
- setIsVisibleCompleteDialog(false);
- ApplicationEvaluationService.updateEvaluation(data.assignedApplicationId, formData, updateStatusCallback, errUpdateStatusCallback);
+ setLoading(true);
+ setIsVisibleCompleteDialog(false);
+ ApplicationEvaluationService.updateEvaluation(
+ data.assignedApplicationId,
+ submitData,
+ updateStatusCallback,
+ errUpdateStatusCallback
+ );
+ } else if (data.evaluationVersion === 'V2') {
+ const newFormValues = getTransformedSubmitData();
+ 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,
+ motivation
+ }
+
+ setLoading(true);
+ setIsVisibleCompleteDialog(false);
+ ApplicationEvaluationService.updateEvaluationV2(
+ data.assignedApplicationId,
+ formId,
+ submitData,
+ updateStatusCallback,
+ errUpdateStatusCallback
+ );
+ }
}
const doReject = () => {
- const formData = {
- applicationStatus: 'REJECTED',
- criteria: klona(data.criteria),
- checklist: klona(data.checklist),
- files: klona(data.files),
- note: data.note,
- motivation
- }
+ if (data.evaluationVersion === 'V1') {
+ const submitData = {
+ applicationStatus: 'REJECTED',
+ criteria: klona(data.criteria),
+ checklist: klona(data.checklist),
+ files: klona(data.files),
+ note: data.note,
+ motivation
+ }
- setLoading(true);
- setIsVisibleCompleteDialog(false);
- ApplicationEvaluationService.updateEvaluation(data.assignedApplicationId, formData, updateStatusCallback, errUpdateStatusCallback);
+ setLoading(true);
+ setIsVisibleCompleteDialog(false);
+ ApplicationEvaluationService.updateEvaluation(
+ data.assignedApplicationId,
+ submitData,
+ updateStatusCallback,
+ errUpdateStatusCallback
+ );
+ } else if (data.evaluationVersion === 'V2') {
+ const newFormValues = getTransformedSubmitData();
+ 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,
+ motivation
+ }
+
+ setLoading(true);
+ setIsVisibleCompleteDialog(false);
+ ApplicationEvaluationService.updateEvaluationV2(
+ data.assignedApplicationId,
+ formId,
+ submitData,
+ updateStatusCallback,
+ errUpdateStatusCallback
+ );
+ }
}
const updateStatusCallback = (data) => {
@@ -432,7 +656,7 @@ const DomandaEditPreInstructor = () => {
setIsVisibleAppointmentDialog(true);
}
- const setValue = (name, value) => {
+ const setFieldValue = (name, value) => {
const newData = wrap(appointmentData).set(name, value).value();
setAppointmentData(newData);
}
@@ -506,10 +730,152 @@ const DomandaEditPreInstructor = () => {
// TODO
}
- const evaluationShouldBeBlocked = (data = {}) => {
+ const evaluationBlockedForUser = (data = {}) => {
const userData = storeGet.main.userData()
return isAsyncRequest || userData.id !== data.assignedUserId;
}
+
+ const shouldDisableNewSoccorso = () => {
+ if (data.evaluationVersion === 'V1') {
+ return !allFilesRated || !atLeastOneChecked;
+ } else if (data.evaluationVersion === 'V2') {
+ return !allFilesRated || !atLeastOneChecked;
+ } else {
+ return true;
+ }
+ }
+
+ const actionBtns = () => {
+ return
+ {['EVALUATION', 'SOCCORSO', 'CLOSE'].includes(data.applicationStatus)
+ ?
+ {data.applicationStatus === 'EVALUATION'
+ ? __('Richiedi soccorso istruttorio', 'gepafin')
+ : __('Apri soccorso istruttorio', 'gepafin')}
+
+
+
+ >}
+ /> : null}
+ {data.id
+ ? doSaveDraft()}
+ outlined
+ label={__('Salva bozza valutazione', 'gepafin')}
+ icon="pi pi-save" iconPos="right"/>
+ : doSaveDraft()}
+ label={__('Crea valutazione', 'gepafin')}
+ icon="pi pi-save" iconPos="right"/>}
+ {APP_EVALUATION_FLOW_ID === '1' && ['EVALUATION'].includes(data.applicationStatus)
+ && APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
+ ? : null}
+ {APP_EVALUATION_FLOW_ID === '1' && APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
+ ? : null}
+
+ {
+ }}
+ label={__('Valutazione tecnico-finanziaria positiva', 'gepafin')}
+ />
+ {data.id
+ ? : null}
+ {data.id
+ ? : null}
+
+ }
+
+ 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);
+ }
+
+ updateFlagsForSoccorso(data);
+ }, [formValues]);
+
+ useEffect(() => {
+ if (formInitialData) {
+ //reset();
+ Object.keys(formInitialData).map(k => setValue(k, formInitialData[k]));
+ trigger();
+ }
+ }, [formInitialData]);
useEffect(() => {
const maxScore = pathOr(0, ['minScore'], data);
@@ -524,9 +890,7 @@ const DomandaEditPreInstructor = () => {
const entityId = !isNaN(parsed) ? parsed : 0;
storeSet.main.setAsyncRequest();
- ApplicationEvaluationService.getEvaluationByApplId(getCallback, errGetCallback, [
- ['applicationId', entityId]
- ]);
+ ApplicationEvaluationService.getEvaluationVersionByApplId(entityId, getVersion, errGetVersion);
AmendmentsService.getSoccorsoByApplId(entityId, getAmendmentsCallback, errGetAmendmentsCallback, [
['statuses', 'AWAITING']
]);
@@ -555,68 +919,18 @@ const DomandaEditPreInstructor = () => {
{!isAsyncRequest && !isEmpty(data)
?
-
-
- {__('ID domanda', 'gepafin')}
- {data.applicationId}
-
-
- {__('Protocollo', 'gepafin')}
- {data.protocolNumber}
-
- {APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
- ?
- {__('NDG', 'gepafin')}
- {data.ndg}
-
: null}
- {APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
- ?
- {__('Appuntamento', 'gepafin')}
- {data.appointmentId}
-
: null}
-
- {__('Bando', 'gepafin')}
- {data.callName}
-
-
- {__('Referente Aziendale', 'gepafin')}
- {data.beneficiary}
-
-
- {__('Azienda Beneficiaria', 'gepafin')}
- {data.companyName}
-
-
- {__('Data ricezione', 'gepafin')}
- {getDateTimeFromISOstring(data.submissionDate)}
-
-
- {__('Data assegnazione', 'gepafin')}
- {getDateTimeFromISOstring(data.assignedAt)}
-
-
- {__('Aassegnato a', 'gepafin')}
- {data.assignedUserName}
-
-
- {__('Scadenza Valutazione', 'gepafin')}
- {getDateFromISOstring(data.evaluationEndDate)}
-
-
- {__('Stato', 'gepafin')}
- {getBandoLabel(data.applicationStatus)}
-
+
+
+
+ {__('Azioni rapide', 'gepafin')}
-
{__('Scarica documenti della domanda', 'gepafin')}
-
-
-
-
-
+ {actionBtns()}
+
+
{__('Documenti aggiuntivi', 'gepafin')}
{
data,
['evaluationDocument']
)}
- shouldDisable={['APPROVED', 'REJECTED'].includes(data.applicationStatus) || evaluationShouldBeBlocked(data)}
+ shouldDisable={['APPROVED', 'REJECTED'].includes(data.applicationStatus) || evaluationBlockedForUser(data)}
sourceId={data.assignedApplicationId}
sourceName="evaluation"/>
-
-
{__('Checklist Valutazione', 'gepafin')}
-
-
-
{__('Lista', 'gepafin')}
-
-
- {data.checklist.map((o, i) =>
- updateEvaluationValue(
- e.checked,
- ['checklist', i, 'valid']
- )}
- checked={o.valid}>
-
-
)}
+ {data.evaluationVersion === 'V2'
+ ?
+
{__('Documenti allegati', 'gepafin')}
+ {!isEmpty(data.files)
+ ?
shouldDisableField(name) || evaluationBlockedForUser(data)}
+ name="files"
+ ndg={data.ndg}
+ applicationId={id}/>
+ : {__('Nessun documento allegato', 'gepafin')}
}
+
+ : null}
+
+ {data.evaluationVersion === 'V2'
+ ?
+ : null}
+
+ {data.evaluationVersion === 'V1'
+ ?
+
{__('Checklist Valutazione', 'gepafin')}
+
+
+
{__('Lista', 'gepafin')}
+
+
+ {data.checklist.map((o, i) =>
+ updateEvaluationValue(
+ e.checked,
+ ['checklist', i, 'valid']
+ )}
+ checked={o.valid}>
+
+
)}
+
+
+
+
{__('Note', 'gepafin')}
+
+ updateEvaluationValue(
+ e.htmlValue,
+ ['note']
+ )}
+ style={{ height: 80 * 3, width: '100%' }}
+ />
-
-
{__('Note', 'gepafin')}
-
updateEvaluationValue(
- e.htmlValue,
- ['note']
- )}
- style={{ height: 80 * 3, width: '100%' }}
- />
+ {__('Documenti allegati', 'gepafin')}
+ {!isEmpty(data.files)
+ ? shouldDisableField(name) || evaluationBlockedForUser(data)}
+ name="files"
+ ndg={data.ndg}
+ applicationId={id}/>
+ : {__('Nessun documento allegato', 'gepafin')}
}
-
-
{__('Documenti allegati', 'gepafin')}
- {!isEmpty(data.files)
- ?
shouldDisableField(name) || evaluationShouldBeBlocked(data)}
- name="files"
- ndg={data.ndg}
- applicationId={id}/>
- : {__('Nessun documento allegato', 'gepafin')}
}
-
-
+ : null}
{!isEmpty(data.amendmentDetails)
?
@@ -687,90 +1094,92 @@ const DomandaEditPreInstructor = () => {
shouldDisableField(name) || evaluationShouldBeBlocked(data)}
+ shouldDisableFieldFn={(name) => shouldDisableField(name) || evaluationBlockedForUser(data)}
name="amendmentDetails"
ndg={data.ndg}
applicationId={id}/>
: null}
-
-
{__('Punteggi di valutazione', 'gepafin')}
- {data.criteria
- ?
-
-
- | {__('Parametro', 'gepafin')} |
- {__('Punteggio', 'gepafin')} |
- {__('Stato', 'gepafin')} |
-
-
-
- {data.criteria.map((o, i) =>
- | {o.label} |
-
-
- updateEvaluationValue(
- e.value,
- ['criteria', i, 'score'],
- o.criteria
- )}/>
-
+ {data.evaluationVersion === 'V1'
+ ?
+ {__('Punteggi di valutazione', 'gepafin')}
+ {data.criteria
+ ?
+
+
+ | {__('Parametro', 'gepafin')} |
+ {__('Punteggio', 'gepafin')} |
+ {__('Stato', 'gepafin')} |
+
+
+
+ {data.criteria.map((o, i) =>
+ | {o.label} |
+
+
+ updateEvaluationValue(
+ e.value,
+ ['criteria', i, 'score'],
+ o.criteria
+ )}/>
+
/ {o.maxScore}
-
- |
-
-
- {!isEmpty(o.criteriaMappedFields)
- ? displayCriterionData(o.id)}
- aria-label={__('Mostra', 'gepafin')}/> : null}
- updateEvaluationValue(
- true,
- ['criteria', i, 'valid']
- )}
- aria-label={__('Su', 'gepafin')}/>
- updateEvaluationValue(
- false,
- ['criteria', i, 'valid']
- )}
- aria-label={__('Giu', 'gepafin')}/>
-
- |
- )}
-
- | {__('Punteggio:', 'gepafin')} |
- {sum(data.criteria.map(o => o.score))} |
-
- {isAdmissible
- ? : null}
- {!isAdmissible
- ? : null}
- |
-
-
-
-
- | {sprintf(__('Punteggio minimo per l\'ammissione: %d'), data.minScore)} |
-
-
- : null}
-
+
+ |
+
+
+ {!isEmpty(o.criteriaMappedFields)
+ ? displayCriterionData(o.id)}
+ aria-label={__('Mostra', 'gepafin')}/> : null}
+ updateEvaluationValue(
+ true,
+ ['criteria', i, 'valid']
+ )}
+ aria-label={__('Su', 'gepafin')}/>
+ updateEvaluationValue(
+ false,
+ ['criteria', i, 'valid']
+ )}
+ aria-label={__('Giu', 'gepafin')}/>
+
+ |
+
)}
+
+ | {__('Punteggio:', 'gepafin')} |
+ {sum(data.criteria.map(o => o.score))} |
+
+ {isAdmissible
+ ? : null}
+ {!isAdmissible
+ ? : null}
+ |
+
+
+
+
+ | {sprintf(__('Punteggio minimo per l\'ammissione: %d'), data.minScore)} |
+
+
+
: null}
+
+ : null}
@@ -779,85 +1188,7 @@ const DomandaEditPreInstructor = () => {
-
- {['EVALUATION', 'SOCCORSO', 'CLOSE'].includes(data.applicationStatus)
- ?
- {data.applicationStatus === 'EVALUATION'
- ? __('Richiedi soccorso istruttorio', 'gepafin')
- : __('Apri soccorso istruttorio', 'gepafin')}
-
-
-
- >}
- /> : null}
- {data.id
- ? doSaveDraft()}
- outlined
- label={__('Salva bozza valutazione', 'gepafin')}
- icon="pi pi-save" iconPos="right"/>
- : doSaveDraft()}
- label={__('Crea valutazione', 'gepafin')}
- icon="pi pi-save" iconPos="right"/>}
- {APP_EVALUATION_FLOW_ID === '1' && ['EVALUATION'].includes(data.applicationStatus)
- && APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
- ? : null}
- {APP_EVALUATION_FLOW_ID === '1' && APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
- ? : null}
-
- {}}
- label={__('Valutazione tecnico-finanziaria positiva', 'gepafin')}
- />
- {data.id
- ? : null}
- {data.id
- ? : null}
-
+ {actionBtns()}
diff --git a/src/pages/DomandeInstructorManager/index.js b/src/pages/DomandeInstructorManager/index.js
index 35957b5..31ee817 100644
--- a/src/pages/DomandeInstructorManager/index.js
+++ b/src/pages/DomandeInstructorManager/index.js
@@ -1,6 +1,6 @@
import React, { useEffect, useRef, useState } from 'react';
import { __ } from '@wordpress/i18n';
-import { isEmpty, pathOr } from 'ramda';
+import { isEmpty } from 'ramda';
// store
import { storeSet } from '../../store';
diff --git a/src/pages/Profile/index.js b/src/pages/Profile/index.js
index d7b3474..3b2d5b7 100644
--- a/src/pages/Profile/index.js
+++ b/src/pages/Profile/index.js
@@ -36,7 +36,7 @@ const Profile = () => {
const onSubmit = (formData) => {
storeSet.main.setAsyncRequest();
- UserService.updateUser(userData.id, formData, updateCallback, updateError);
+ UserService.updateUserSelf(userData.id, formData, updateCallback, updateError);
};
const updateCallback = (data) => {
@@ -109,6 +109,7 @@ const Profile = () => {
{
const onSubmit = (formData) => {
storeSet.main.setAsyncRequest();
- UserService.updateUser(userData.id, formData, updateCallback, updateError);
+ UserService.updateUserSelf(userData.id, formData, updateCallback, updateError);
};
const updateCallback = (data) => {
diff --git a/src/pages/SoccorsoIstruttorioPreInstructor/index.js b/src/pages/SoccorsoIstruttorioPreInstructor/index.js
index fd1cc4d..b0959b7 100644
--- a/src/pages/SoccorsoIstruttorioPreInstructor/index.js
+++ b/src/pages/SoccorsoIstruttorioPreInstructor/index.js
@@ -1,4 +1,4 @@
-import React, { useEffect, useState } from 'react';
+import React, { useEffect, useState, useCallback } from 'react';
import { __ } from '@wordpress/i18n';
import { pathOr } from 'ramda';
import NumberFlow from '@number-flow/react';
@@ -22,9 +22,9 @@ const SoccorsoIstruttorioPreInstructor = () => {
const errGetStats = () => {}
- const getStatValue = (key, fallback = '') => {
+ const getStatValue = useCallback((key, fallback = '') => {
return pathOr(fallback, [key], mainStats);
- }
+ }, [mainStats]);
useEffect(() => {
DashboardService.getAmendmentsStats(getStats, errGetStats);
diff --git a/src/pages/StatsBeneficiary/components/BeneficiarioUltimeDomandeTable/index.js b/src/pages/StatsBeneficiary/components/BeneficiarioUltimeDomandeTable/index.js
new file mode 100644
index 0000000..31c7ec9
--- /dev/null
+++ b/src/pages/StatsBeneficiary/components/BeneficiarioUltimeDomandeTable/index.js
@@ -0,0 +1,146 @@
+import React, { useState, useEffect } from 'react';
+import { __ } from '@wordpress/i18n';
+import { is, isEmpty, uniq } from 'ramda';
+
+// store
+import { useStore } from '../../../../store';
+
+// api
+import ApplicationService from '../../../../service/application-service';
+
+// tools
+import getNumberWithCurrency from '../../../../helpers/getNumberWithCurrency';
+
+// components
+import { FilterMatchMode, FilterOperator } from 'primereact/api';
+import { DataTable } from 'primereact/datatable';
+import { Column } from 'primereact/column';
+import ProperBandoLabel from '../../../../components/ProperBandoLabel';
+import translationStrings from '../../../../translationStringsForComponents';
+
+
+const BeneficiarioUltimeDomandeTable = () => {
+ const chosenCompanyId = useStore().main.chosenCompanyId();
+ const [items, setItems] = useState(null);
+ // eslint-disable-next-line
+ const [filters, setFilters] = useState(null);
+ const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
+ // eslint-disable-next-line
+ const [statuses, setStatuses] = useState([]);
+ const perPage = 5;
+
+ const getPaginationQuery = (status = 'DRAFT', curPage = 1) => {
+ return {
+ "globalFilters": {
+ //"year": 0,
+ "page": curPage,
+ //"search": "",
+ "limit": perPage,
+ },
+ //"daysRange": 0,
+ "status": status
+ }
+ }
+
+ useEffect(() => {
+ if (!isEmpty(chosenCompanyId) && chosenCompanyId !== 0 && !localAsyncRequest) {
+ const bodyParams = getPaginationQuery(
+ ['SOCCORSO', 'APPROVED', 'REJECTED', 'EVALUATION', 'SUBMIT'],
+ 1
+ );
+
+ setLocalAsyncRequest(true);
+ ApplicationService.getApplicationsPaginated(bodyParams, getApplCallback, errGetApplCallback, [
+ ['companyId', chosenCompanyId],
+ ['statuses', ['SOCCORSO', 'APPROVED', 'REJECTED', 'EVALUATION', 'SUBMIT']] // 'NDG', 'ADMISSIBLE', 'APPOINTMENT'
+ ]);
+ }
+ }, [chosenCompanyId]);
+
+ const getApplCallback = (resp) => {
+ if (resp.status === 'SUCCESS') {
+ if (resp.data && is(Array, resp.data.body)) {
+ setItems(getFormattedBandiData(resp.data.body));
+ setStatuses(uniq(items.map(o => o.status)))
+ initFilters();
+ }
+ }
+ setLocalAsyncRequest(false);
+ }
+
+ const errGetApplCallback = () => {
+ setLocalAsyncRequest(false);
+ }
+
+ const getFormattedBandiData = (data) => {
+ return [...(data || [])].map((d) => {
+ d.callEndDate = new Date(d.callEndDate);
+ d.modifiedDate = new Date(d.modifiedDate);
+ d.submissionDate = new Date(d.submissionDate);
+
+ return d;
+ });
+ };
+
+ const formatDate = (value) => {
+ return value.toLocaleDateString('it-IT', {
+ year: 'numeric'
+ });
+ };
+
+ const initFilters = () => {
+ setFilters({
+ global: { value: null, matchMode: FilterMatchMode.CONTAINS },
+ callTitle: {
+ operator: FilterOperator.AND,
+ constraints: [{ value: null, matchMode: FilterMatchMode.STARTS_WITH }]
+ },
+ companyName: {
+ operator: FilterOperator.AND,
+ constraints: [{ value: null, matchMode: FilterMatchMode.STARTS_WITH }]
+ },
+ modifiedDate: {
+ operator: FilterOperator.AND,
+ constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }]
+ },
+ callEndDate: {
+ operator: FilterOperator.AND,
+ constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }]
+ }
+ });
+ };
+
+ const dateSubmissionBodyTemplate = (rowData) => {
+ return formatDate(rowData.submissionDate);
+ };
+
+ const importoBodyTemplate = (rowData) => {
+ return getNumberWithCurrency(rowData.amountRequested);
+ };
+
+ const statusBodyTemplate = (rowData) => {
+ return ;
+ };
+
+ return (
+
+
+
+
+
+
+
+
+ )
+}
+
+export default BeneficiarioUltimeDomandeTable;
diff --git a/src/pages/StatsBeneficiary/index.js b/src/pages/StatsBeneficiary/index.js
new file mode 100644
index 0000000..503393d
--- /dev/null
+++ b/src/pages/StatsBeneficiary/index.js
@@ -0,0 +1,112 @@
+import React, { useEffect, useState, useCallback } from 'react';
+import { __ } from '@wordpress/i18n';
+import { isEmpty, pathOr } from 'ramda';
+import NumberFlow from '@number-flow/react';
+
+// store
+import { useStore } from '../../store';
+
+// components
+import DashboardService from '../../service/dashboard-service';
+import ChartDomandePerStato from '../../components/ChartDomandePerStato';
+import ChartRichiesteVsApprovate from '../../components/ChartRichiesteVsApprovate';
+import BeneficiarioUltimeDomandeTable from './components/BeneficiarioUltimeDomandeTable';
+
+const StatsBeneficiary = () => {
+ const [mainStats, setMainStats] = useState({});
+ const [chartStats, setChartStats] = useState({});
+ const chosenCompanyId = useStore().main.chosenCompanyId();
+
+ const getStats = (resp) => {
+ if (resp.status === 'SUCCESS') {
+ setMainStats(resp.data.applicationWidget);
+ setChartStats(resp.data.applicationWidgetBars);
+ }
+ }
+
+ const errGetStats = () => {}
+
+ const getStatValue = useCallback((key, fallback = '') => {
+ return pathOr(fallback, [key], mainStats);
+ }, [mainStats]);
+
+ useEffect(() => {
+ DashboardService.getBeneficiaryStatsPage(chosenCompanyId, getStats, errGetStats);
+ }, [chosenCompanyId]);
+
+ return(
+
+
+
{__('Statistiche', 'gepafin')}
+
+
+
+
+
+
{__('Riepilogo', 'gepafin')}
+
+
+ {__('Domande presentate', 'gepafin')}
+
+
+
+ {__('Tasso di successo', 'gepafin')}
+
+
+
+ {__('Domande approvate', 'gepafin')}
+
+
+
+ {__('Importo totale finanziato', 'gepafin')}
+
+
+
+
+
+
+
+ {chartStats && !isEmpty(chartStats)
+ ?
+
{__('Statistiche di sistema', 'gepafin')}
+
+
+
+
+
: null}
+
+
+
+
+
{__('Ultime richieste di finanziamento', 'gepafin')}
+
+
+
+ )
+}
+
+export default StatsBeneficiary;
\ No newline at end of file
diff --git a/src/routes.js b/src/routes.js
index df80af3..f5555e3 100644
--- a/src/routes.js
+++ b/src/routes.js
@@ -50,6 +50,7 @@ import SoccorsoAddInstructorManager from './pages/SoccorsoAddInstructorManager';
import SoccorsoEditInstructorManager from './pages/SoccorsoEditInstructorManager';
import SoccorsoIstruttorioInstructorManager from './pages/SoccorsoIstruttorioInstructorManager';
import SoccorsoIstruttorioMioInstructorManager from './pages/SoccorsoIstruttorioMioInstructorManager';
+import StatsBeneficiary from './pages/StatsBeneficiary';
const routes = ({ role, chosenCompanyId }) => {
@@ -236,6 +237,12 @@ const routes = ({ role, chosenCompanyId }) => {
{'ROLE_PRE_INSTRUCTOR' === role ? : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
}/>
+
+ {'ROLE_SUPER_ADMIN' === role ? : null}
+ {'ROLE_BENEFICIARY' === role ? : null}
+ {'ROLE_PRE_INSTRUCTOR' === role ? : null}
+ {'ROLE_INSTRUCTOR_MANAGER' === role ? : null}
+ }/>
}/>
}/>
diff --git a/src/service/application-evaluation-service.js b/src/service/application-evaluation-service.js
index 048cb46..cc20ea6 100644
--- a/src/service/application-evaluation-service.js
+++ b/src/service/application-evaluation-service.js
@@ -8,7 +8,21 @@ export default class ApplicationEvaluationService {
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) => {
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]
+ ]);
+ };
}
diff --git a/src/service/application-service.js b/src/service/application-service.js
index ae59a84..961ee34 100644
--- a/src/service/application-service.js
+++ b/src/service/application-service.js
@@ -8,6 +8,10 @@ export default class ApplicationService {
NetworkService.get(`${API_BASE_URL}/application`, callback, errCallback, queryParams);
};
+ static getApplicationsPaginated = (body, callback, errCallback, queryParams) => {
+ NetworkService.post(`${API_BASE_URL}/application/pagination`, body, callback, errCallback, queryParams);
+ };
+
static getApplication = (id, callback, errCallback) => {
NetworkService.get(`${API_BASE_URL}/application/${id}`, callback, errCallback);
};
diff --git a/src/service/bando-service.js b/src/service/bando-service.js
index 5f616fb..3a38a80 100644
--- a/src/service/bando-service.js
+++ b/src/service/bando-service.js
@@ -32,6 +32,10 @@ export default class BandoService {
NetworkService.put(`${API_BASE_URL}/call/step2/${id}`, body, callback, errCallback);
};
+ static updateBandoStep2V2 = (id, body, callback, errCallback) => {
+ NetworkService.put(`${API_BASE_URL}/call/step2-v2/${id}`, body, callback, errCallback);
+ };
+
static updateBandoStatus = (id, callback, errCallback, queryParams) => {
NetworkService.put(`${API_BASE_URL}/call/${id}/status`, {}, callback, errCallback, queryParams);
};
diff --git a/src/service/dashboard-service.js b/src/service/dashboard-service.js
index 093db59..6453d4f 100644
--- a/src/service/dashboard-service.js
+++ b/src/service/dashboard-service.js
@@ -23,4 +23,11 @@ export default class DashboardService {
static getBeneficiaryStatsForCompany = (id, callback, errCallback) => {
NetworkService.get(`${API_BASE_URL}/dashboard/beneficiary/company/${id}`, callback, errCallback);
};
+ static getBeneficiaryStatsPage = (id, callback, errCallback) => {
+ NetworkService.get(`${API_BASE_URL}/dashboard/beneficiary/statistic/company/${id}`, callback, errCallback);
+ };
+
+ static getInstructorAmendmentsStats = (callback, errCallback, queryParams) => {
+ NetworkService.get(`${API_BASE_URL}/dashboard/instructor/amendment`, callback, errCallback, queryParams);
+ };
}
diff --git a/src/service/evaluation-forms-service.js b/src/service/evaluation-forms-service.js
new file mode 100644
index 0000000..dc5d048
--- /dev/null
+++ b/src/service/evaluation-forms-service.js
@@ -0,0 +1,26 @@
+import { NetworkService } from './network-service';
+
+const API_BASE_URL = process.env.REACT_APP_API_EXECUTION_ADDRESS;
+
+export default class EvaluationFormsService {
+
+ static getFormForCall = (id, callback, errCallback) => {
+ NetworkService.get(`${API_BASE_URL}/evaluationForm/call/${id}`, callback, errCallback);
+ };
+
+ static createFormForCall = (id, body, callback, errCallback) => {
+ NetworkService.post(`${API_BASE_URL}/evaluationForm/call/${id}`, body, callback, errCallback);
+ };
+
+ static updateForm = (id, body, callback, errCallback, queryParams) => {
+ NetworkService.put(`${API_BASE_URL}/evaluationForm/${id}`, body, callback, errCallback, queryParams);
+ };
+
+ static getFormById = (id, callback, errCallback) => {
+ NetworkService.get(`${API_BASE_URL}/evaluationForm/${id}`, callback, errCallback);
+ };
+
+ static deleteForm = (id, callback, errCallback) => {
+ NetworkService.delete(`${API_BASE_URL}/evaluationForm/${id}`, {}, callback, errCallback);
+ };
+}
diff --git a/src/service/user-service.js b/src/service/user-service.js
index e98fd89..1906903 100644
--- a/src/service/user-service.js
+++ b/src/service/user-service.js
@@ -16,6 +16,10 @@ export default class UserService {
NetworkService.put(`${API_BASE_URL}/user/${id}`, body, callback, errCallback);
};
+ static updateUserSelf = (id, body, callback, errCallback) => {
+ NetworkService.put(`${API_BASE_URL}/user/${id}/update-details`, body, callback, errCallback);
+ };
+
static createUser = (body, callback, errCallback) => {
NetworkService.post(`${API_BASE_URL}/user`, body, callback, errCallback);
};
diff --git a/src/store/initial.js b/src/store/initial.js
index 14223f5..ea1fda5 100644
--- a/src/store/initial.js
+++ b/src/store/initial.js
@@ -17,6 +17,7 @@ const initialStore = {
formElements: [],
elementItems: [],
activeElement: '',
+ selectedElement: '',
draggingElementId: 0,
bandoCriteria: [],
// flow
diff --git a/src/tempData.js b/src/tempData.js
index bc8df5f..431f555 100644
--- a/src/tempData.js
+++ b/src/tempData.js
@@ -185,6 +185,10 @@ export const elementItems = [
{
name: "label",
value: "Casella di Spunta"
+ },
+ {
+ name: "isChecklistItem",
+ value: false
}
],
validators: {
@@ -459,5 +463,25 @@ export const elementItems = [
validators: {
custom: 'nonEmptyTables'
}
+ },
+ {
+ id: 22,
+ sortOrder: 22,
+ name: 'switch',
+ label: 'Casella di spunta "Checklist"',
+ description: 'Per selezioni binarie, accettazioni, conferme',
+ settings: [
+ {
+ name: "label",
+ value: "Casella di Spunta"
+ },
+ {
+ name: "isChecklistItem",
+ value: true
+ }
+ ],
+ validators: {
+ isRequired: false
+ }
}
]