diff --git a/.env b/.env
index 871e4c5..16f67c8 100644
--- a/.env
+++ b/.env
@@ -4,6 +4,7 @@ REACT_APP_API_ADDRESS=https://api-dev-gepafin.memento.credit
REACT_APP_API_ADDRESS_WS=https://api-dev-gepafin.memento.credit/wss
REACT_APP_LOGO_FILENAME=gepafin-logo.svg
REACT_APP_FAVICON_FILENAME=gepafin-favicon.ico
+# t7jh5wfg9QXylNaTZkPoE - sviluppumbria | p4lk3bcx1RStqTaIVVbXs - gepafin
REACT_APP_HUB_ID=p4lk3bcx1RStqTaIVVbXs
REACT_APP_EVALUATION_FLOW_ID=1
REACT_APP_LOCAL_DEVELOPMENT=1
diff --git a/src/pages/DomandaEditInstructorManager/index.js b/src/pages/DomandaEditInstructorManager/index.js
index 39bf0b4..49161e6 100644
--- a/src/pages/DomandaEditInstructorManager/index.js
+++ b/src/pages/DomandaEditInstructorManager/index.js
@@ -4,9 +4,9 @@ import { useNavigate, useParams } from 'react-router-dom';
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';
-import { useForm } from 'react-hook-form';
// store
import { storeGet, storeSet, useStoreValue } from '../../store';
@@ -44,6 +44,7 @@ import { InputNumber } from 'primereact/inputnumber';
import { Toast } from 'primereact/toast';
import { Dialog } from 'primereact/dialog';
import HelpIcon from '../../icons/HelpIcon';
+import BlockingOverlay from '../../components/BlockingOverlay';
import { classNames } from 'primereact/utils';
import { InputTextarea } from 'primereact/inputtextarea';
import { InputText } from 'primereact/inputtext';
@@ -54,6 +55,7 @@ import ApplicationDownloadFiles from '../DomandaEditPreInstructor/components/App
import FormField from '../../components/FormField';
import SoccorsoResendEmails from '../SoccorsoEditPreInstructor/components/SoccorsoResendEmails';
import EvaluationReAdmit from '../DomandaEditPreInstructor/components/EvaluationReAdmit';
+import { SplitButton } from 'primereact/splitbutton';
const APP_EVALUATION_FLOW_ID = process.env.REACT_APP_EVALUATION_FLOW_ID;
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
@@ -69,12 +71,19 @@ const DomandaEditInstructorManager = () => {
const [isAdmissible, setIsAdmissible] = useState(false);
const [connectedSoccorsoId, setConnectedSoccorsoId] = useState(0);
const toast = useRef(null);
+ const tecFinBtnRef = useRef(null);
const [loading, setLoading] = useState(false);
const [isVisibleCompleteDialog, setIsVisibleCompleteDialog] = useState(false);
const [operationType, setOperationType] = useState('');
const [motivation, setMotivation] = useState('');
const [amountAccepted, setAmountAccepted] = useState(0);
const [isVisibleAppointmentDialog, setIsVisibleAppointmentDialog] = useState(false);
+ const [isVisiblePreTecEvalDialog, setIsVisiblePreTecEvalDialog] = useState(false);
+ const [preTecEvalData, setPreTecEvalData] = useState({
+ type: 0,
+ pec: '',
+ amount: 0
+ });
const [allFilesRated, setAllFilesRated] = useState(false);
const [atLeastOneChecked, setAtLeastOneChecked] = useState(false);
const [allChecksChecked, setAllChecksChecked] = useState(false);
@@ -276,6 +285,40 @@ const DomandaEditInstructorManager = () => {
};
const header = renderHeader();
+ const technicalEvalItems = [
+ {
+ label: __('Nessuna garanzia', 'gepafin'),
+ icon: 'pi pi-pen-to-square',
+ command: () => {
+ setPreTecEvalData(prev => ({ ...prev, type: 1 }));
+ setIsVisiblePreTecEvalDialog(true);
+ }
+ },
+ {
+ label: __('Garanzia MCC', 'gepafin'),
+ icon: 'pi pi-pen-to-square',
+ command: () => {
+ setPreTecEvalData(prev => ({ ...prev, type: 2 }));
+ setIsVisiblePreTecEvalDialog(true);
+ }
+ },
+ {
+ label: __('Garanzia MCC Start-Up', 'gepafin'),
+ icon: 'pi pi-pen-to-square',
+ command: () => {
+ setPreTecEvalData(prev => ({ ...prev, type: 3 }));
+ setIsVisiblePreTecEvalDialog(true);
+ }
+ },
+ {
+ label: __('Altre garanzie (fideiussioni)', 'gepafin'),
+ icon: 'pi pi-pen-to-square',
+ command: () => {
+ setPreTecEvalData(prev => ({ ...prev, type: 4 }));
+ setIsVisiblePreTecEvalDialog(true);
+ }
+ }
+ ]
const updateEvaluationValue = (value, path, maxValue = null) => {
let finalValue = value;
@@ -579,6 +622,8 @@ const DomandaEditInstructorManager = () => {
if (data.status === 'SUCCESS') {
if (data.data.length) {
setConnectedSoccorsoId(data.data[0].id);
+ } else {
+ setConnectedSoccorsoId(0);
}
}
}
@@ -700,7 +745,7 @@ const DomandaEditInstructorManager = () => {
setIsVisibleAppointmentDialog(true);
}
- const setFieldValue = (name, value) => {
+ const setAppointmentFieldValue = (name, value) => {
const newData = wrap(appointmentData).set(name, value).value();
setAppointmentData(newData);
}
@@ -724,6 +769,30 @@ const DomandaEditInstructorManager = () => {
}
+ const setPreTecEvalFieldValue = (name, value) => {
+ const newData = wrap(preTecEvalData).set(name, value).value();
+ setPreTecEvalData(newData);
+ }
+
+ const headerPreTecEvalDialog = () => {
+ return {__('Valutazione Tecnico-Finanziaria', 'gepafin')};
+ }
+
+ const hidePreTecEvalDialog = () => {
+ setIsVisiblePreTecEvalDialog(false);
+ setPreTecEvalData({});
+ }
+
+ const footerPreTecEvalDialog = () => {
+ return
+
+
+ }
+
const doCreateAppointmentRequest = () => {
if (
!isEmpty(appointmentData.title) && !isEmpty(appointmentData.text) && !isEmpty(appointmentData.amount)
@@ -796,9 +865,9 @@ const DomandaEditInstructorManager = () => {
}
const shouldDisableNewSoccorso = () => {
- if (data.evaluationVersion === 'V1') {
- return !allFilesRated || !atLeastOneChecked;
- } else if (data.evaluationVersion === 'V2') {
+ if (APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE') {
+ return !data.ndg || !data.appointmentId || !allFilesRated || !atLeastOneChecked;
+ } else if (APP_HUB_ID === 't7jh5wfg9QXylNaTZkPoE') {
return !allFilesRated || !atLeastOneChecked;
} else {
return true;
@@ -812,7 +881,11 @@ const DomandaEditInstructorManager = () => {
const actionBtns = () => {
return
- {['EVALUATION', 'SOCCORSO', 'CLOSE'].includes(data.applicationStatus)
+ {(['SOCCORSO', 'CLOSE', 'EVALUATION', 'NDG', 'APPOINTMENT', 'ADMISSIBLE',
+ 'AWAITING_TECHNICAL_EVALUATION', 'TECHNICAL_EVALUATION'].includes(data.applicationStatus)
+ && APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE')
+ || (['SOCCORSO', 'CLOSE', 'EVALUATION', 'ADMISSIBLE', 'TECHNICAL_EVALUATION'].includes(data.applicationStatus)
+ && APP_HUB_ID === 't7jh5wfg9QXylNaTZkPoE')
?
: <>
diff --git a/src/pages/DomandaEditPreInstructor/index.js b/src/pages/DomandaEditPreInstructor/index.js
index cc3deed..77bb74f 100644
--- a/src/pages/DomandaEditPreInstructor/index.js
+++ b/src/pages/DomandaEditPreInstructor/index.js
@@ -28,11 +28,11 @@ import {
isPIVA,
isUrl, maxChecks, minChecks, nonEmptyTables
} from '../../helpers/validators';
+import formatDateString from '../../helpers/formatDateString';
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';
@@ -135,6 +135,7 @@ const DomandaEditPreInstructor = () => {
const updateFlagsForSoccorso = useCallback((data) => {
let nonRatedFilesLength = 0;
+ let nonRatedAmmendFilesLength = 0;
if (data.files) {
const nonRatedFiles = data.files
@@ -147,10 +148,10 @@ const DomandaEditPreInstructor = () => {
const nonRatedFiles = data.amendmentDetails
.map(el => el.valid)
.filter(v => isNil(v));
- nonRatedFilesLength = nonRatedFiles.length;
+ nonRatedAmmendFilesLength = nonRatedFiles.length;
}
- setAllFilesRated(nonRatedFilesLength === 0);
+ setAllFilesRated(nonRatedFilesLength === 0 && nonRatedAmmendFilesLength === 0);
if (data.evaluationVersion === 'V1') {
if (data.checklist) {
@@ -165,7 +166,7 @@ const DomandaEditPreInstructor = () => {
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);
@@ -289,7 +290,7 @@ const DomandaEditPreInstructor = () => {
label: __('Nessuna garanzia', 'gepafin'),
icon: 'pi pi-pen-to-square',
command: () => {
- setPreTecEvalData(prev => ({...prev, type: 1}));
+ setPreTecEvalData(prev => ({ ...prev, type: 1 }));
setIsVisiblePreTecEvalDialog(true);
}
},
@@ -297,7 +298,7 @@ const DomandaEditPreInstructor = () => {
label: __('Garanzia MCC', 'gepafin'),
icon: 'pi pi-pen-to-square',
command: () => {
- setPreTecEvalData(prev => ({...prev, type: 2}));
+ setPreTecEvalData(prev => ({ ...prev, type: 2 }));
setIsVisiblePreTecEvalDialog(true);
}
},
@@ -305,7 +306,7 @@ const DomandaEditPreInstructor = () => {
label: __('Garanzia MCC Start-Up', 'gepafin'),
icon: 'pi pi-pen-to-square',
command: () => {
- setPreTecEvalData(prev => ({...prev, type: 3}));
+ setPreTecEvalData(prev => ({ ...prev, type: 3 }));
setIsVisiblePreTecEvalDialog(true);
}
},
@@ -313,7 +314,7 @@ const DomandaEditPreInstructor = () => {
label: __('Altre garanzie (fideiussioni)', 'gepafin'),
icon: 'pi pi-pen-to-square',
command: () => {
- setPreTecEvalData(prev => ({...prev, type: 4}));
+ setPreTecEvalData(prev => ({ ...prev, type: 4 }));
setIsVisiblePreTecEvalDialog(true);
}
}
@@ -460,6 +461,7 @@ const DomandaEditPreInstructor = () => {
} else if (data.evaluationVersion === 'V2') {
const newFormValues = getTransformedSubmitData();
const submitData = {
+ applicationStatus: 'APPROVED',
formFields: newFormValues,
files: klona(data.files),
evaluationDocument: klona(data.evaluationDocument.map(o => ({
@@ -858,17 +860,17 @@ const DomandaEditPreInstructor = () => {
}, [isAdmissible]);
const evaluationBlockedForUser = (data = {}) => {
- const userData = storeGet('userData')
+ const userData = storeGet('userData');
return isAsyncRequest || userData.id !== data.assignedUserId;
}
const shouldDisableNewSoccorso = () => {
- if (data.evaluationVersion === 'V1') {
- return !data.ndg || !data.appointmentId || !allFilesRated || !atLeastOneChecked;
- } else if (data.evaluationVersion === 'V2') {
+ if (APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE') {
return !data.ndg || !data.appointmentId || !allFilesRated || !atLeastOneChecked;
+ } else if (APP_HUB_ID === 't7jh5wfg9QXylNaTZkPoE') {
+ return !allFilesRated || !atLeastOneChecked;
} else {
- return false;
+ return true;
}
}
@@ -879,7 +881,11 @@ const DomandaEditPreInstructor = () => {
const actionBtns = () => {
return
- {['SOCCORSO', 'CLOSE', 'EVALUATION', 'NDG', 'APPOINTMENT', 'ADMISSIBLE', 'AWAITING_TECHNICAL_EVALUATION', 'TECHNICAL_EVALUATION'].includes(data.applicationStatus)
+ {(['SOCCORSO', 'CLOSE', 'EVALUATION', 'NDG', 'APPOINTMENT', 'ADMISSIBLE',
+ 'AWAITING_TECHNICAL_EVALUATION', 'TECHNICAL_EVALUATION'].includes(data.applicationStatus)
+ && APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE')
+ || (['SOCCORSO', 'CLOSE', 'EVALUATION', 'ADMISSIBLE', 'TECHNICAL_EVALUATION'].includes(data.applicationStatus)
+ && APP_HUB_ID === 't7jh5wfg9QXylNaTZkPoE')
? {
onClick={doCreateAppointment}
label={__('Crea l\'appuntamento', 'gepafin')}
/> : null}
-
- {data.applicationStatus === 'AWAITING_TECHNICAL_EVALUATION'
+ {APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
?
- : {
- tecFinBtnRef.current.show(e);
- }}
- model={technicalEvalItems}/>}
-
+ : }
+ {APP_HUB_ID === 't7jh5wfg9QXylNaTZkPoE'
+ ? : null}
+ {APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE' && data.applicationStatus === 'AWAITING_TECHNICAL_EVALUATION'
+ ?
+ : APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
+ ? {
+ tecFinBtnRef.current.show(e);
+ }}
+ model={technicalEvalItems}/> : null}
+
{data.id
?