From 6178cfd3abd352bb16990919a7c6d633c9b5abe0 Mon Sep 17 00:00:00 2001 From: Vitalii Kiiko Date: Fri, 26 Sep 2025 09:19:34 +0200 Subject: [PATCH] - new flow; --- src/assets/scss/components/evaluation.scss | 54 +++++ .../components/LastRowCell/index.js | 2 +- .../components/LastRowCell/index.js | 4 +- src/helpers/getBandoLabel.js | 3 + src/helpers/getBandoSeverity.js | 3 + src/pages/DomandaEditPreInstructor/index.js | 209 +++++++++++++++--- 6 files changed, 246 insertions(+), 29 deletions(-) diff --git a/src/assets/scss/components/evaluation.scss b/src/assets/scss/components/evaluation.scss index 1498d2f..97b6888 100644 --- a/src/assets/scss/components/evaluation.scss +++ b/src/assets/scss/components/evaluation.scss @@ -38,4 +38,58 @@ th, td { padding: 3px; } +} + +.file-upload-container { + display: flex; + flex-direction: column; + gap: 0.5rem; +} + +.file-upload-item { + display: flex; + align-items: center; + justify-content: space-between; + padding: 0.5rem; + border: 1px solid #dee2e6; + border-radius: 4px; + background-color: #f8f9fa; + + .file-name { + font-size: 0.875rem; + color: #495057; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + flex: 1; + margin-right: 0.5rem; + + .pi-file { + margin-right: 0.5rem; + } + } + + .p-button { + min-width: auto; + padding: 0.25rem; + } +} + +.file-upload-button { + cursor: pointer; + display: inline-flex; + align-items: center; + gap: 0.5rem; + padding: 0.5rem 1rem; + border-radius: 4px; + border: 1px dashed #007ad9; + background-color: transparent; + color: #007ad9; + font-size: 0.875rem; + text-decoration: none; + transition: background-color 0.2s; + + &:hover { + background-color: rgba(0, 122, 217, 0.04); + } } \ No newline at end of file diff --git a/src/components/FormField/components/CriteriaTable/RenderTable/components/LastRowCell/index.js b/src/components/FormField/components/CriteriaTable/RenderTable/components/LastRowCell/index.js index 1c2dcc2..1123085 100644 --- a/src/components/FormField/components/CriteriaTable/RenderTable/components/LastRowCell/index.js +++ b/src/components/FormField/components/CriteriaTable/RenderTable/components/LastRowCell/index.js @@ -2,7 +2,7 @@ import { head, is, isNil, pathOr } from 'ramda'; import getNumberFormatted from '../../../../../../../helpers/getNumberFormatted'; const LastRowCell = ({columnId, lastRowCfg, columnMeta = {}, tableValue = []}) => { - const cellData = head(lastRowCfg.filter(o => !isNil(o[columnId]))); + const cellData = pathOr({}, [], head(lastRowCfg.filter(o => !isNil(o[columnId])))); let cellValue = cellData[columnId]; if (columnMeta.enableFormula) { diff --git a/src/components/FormField/components/Table/RenderTable/components/LastRowCell/index.js b/src/components/FormField/components/Table/RenderTable/components/LastRowCell/index.js index e9c400d..a0d15c2 100644 --- a/src/components/FormField/components/Table/RenderTable/components/LastRowCell/index.js +++ b/src/components/FormField/components/Table/RenderTable/components/LastRowCell/index.js @@ -1,9 +1,9 @@ -import { head, isNil, sum } from 'ramda'; +import { head, isNil, pathOr, sum } from 'ramda'; import getNumberFormatted from '../../../../../../../helpers/getNumberFormatted'; import parseLocaleNumber from '../../../../../../../helpers/parseLocaleNumber'; const LastRowCell = ({columnId, lastRowCfg, columnMeta = {}, getColumnDataFn}) => { - const cellData = head(lastRowCfg.filter(o => !isNil(o[columnId]))); + const cellData = pathOr({}, [], head(lastRowCfg.filter(o => !isNil(o[columnId])))); let cellValue = cellData[columnId]; if (columnMeta.enableFormula) { diff --git a/src/helpers/getBandoLabel.js b/src/helpers/getBandoLabel.js index 286c9d2..6c27fdf 100644 --- a/src/helpers/getBandoLabel.js +++ b/src/helpers/getBandoLabel.js @@ -35,6 +35,9 @@ const getBandoLabel = (status) => { case 'TECHNICAL_EVALUATION': return __('Valutazione technico-finanziaria', 'gepafin'); + case 'AWAITING_TECHNICAL_EVALUATION': + return __('Pre valutazione technico-finanziaria', 'gepafin'); + case 'DUE': return __('In scadenza', 'gepafin'); diff --git a/src/helpers/getBandoSeverity.js b/src/helpers/getBandoSeverity.js index 115ab3b..5c54514 100644 --- a/src/helpers/getBandoSeverity.js +++ b/src/helpers/getBandoSeverity.js @@ -33,6 +33,9 @@ const getBandoSeverity = (status) => { case 'TECHNICAL_EVALUATION': return 'info'; + case 'AWAITING_TECHNICAL_EVALUATION': + return 'warning'; + case 'DUE': return 'warning'; diff --git a/src/pages/DomandaEditPreInstructor/index.js b/src/pages/DomandaEditPreInstructor/index.js index 7433472..8218e6b 100644 --- a/src/pages/DomandaEditPreInstructor/index.js +++ b/src/pages/DomandaEditPreInstructor/index.js @@ -55,6 +55,7 @@ import ApplicationDownloadFiles from './components/ApplicationDownloadFiles'; import FormField from '../../components/FormField'; import SoccorsoResendEmails from '../SoccorsoEditPreInstructor/components/SoccorsoResendEmails'; import EvaluationReAdmit from './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; @@ -70,12 +71,19 @@ const DomandaEditPreInstructor = () => { 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); @@ -157,7 +165,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); @@ -276,6 +284,40 @@ const DomandaEditPreInstructor = () => { }; 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; @@ -578,6 +620,8 @@ const DomandaEditPreInstructor = () => { if (data.status === 'SUCCESS') { if (data.data.length) { setConnectedSoccorsoId(data.data[0].id); + } else { + setConnectedSoccorsoId(0); } } } @@ -644,7 +688,7 @@ const DomandaEditPreInstructor = () => { setIsVisibleCompleteDialog(true); } - const initiateTFRejecting = () => { + const initiateTFRejecting = () => { setOperationType('tf_reject'); setIsVisibleCompleteDialog(true); } @@ -699,7 +743,7 @@ const DomandaEditPreInstructor = () => { setIsVisibleAppointmentDialog(true); } - const setFieldValue = (name, value) => { + const setAppointmentFieldValue = (name, value) => { const newData = wrap(appointmentData).set(name, value).value(); setAppointmentData(newData); } @@ -723,6 +767,30 @@ const DomandaEditPreInstructor = () => { } + 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,11 +864,11 @@ const DomandaEditPreInstructor = () => { const shouldDisableNewSoccorso = () => { if (data.evaluationVersion === 'V1') { - return !allFilesRated || !atLeastOneChecked; + return !data.ndg || !data.appointmentId || !allFilesRated || !atLeastOneChecked; } else if (data.evaluationVersion === 'V2') { - return !allFilesRated || !atLeastOneChecked; + return !data.ndg || !data.appointmentId || !allFilesRated || !atLeastOneChecked; } else { - return true; + return false; } } @@ -811,7 +879,7 @@ const DomandaEditPreInstructor = () => { const actionBtns = () => { return
- {['EVALUATION', 'SOCCORSO', 'CLOSE'].includes(data.applicationStatus) + {['SOCCORSO', 'CLOSE', 'EVALUATION', 'NDG', 'APPOINTMENT', 'ADMISSIBLE', 'AWAITING_TECHNICAL_EVALUATION', 'TECHNICAL_EVALUATION'].includes(data.applicationStatus) ?
} @@ -1286,7 +1366,7 @@ const DomandaEditPreInstructor = () => { )} {__('Punteggio:', 'gepafin')} - {new Intl.NumberFormat("it-IT").format( + {new Intl.NumberFormat('it-IT').format( sum(data.criteria.map(o => o.score)) )} @@ -1378,7 +1458,7 @@ const DomandaEditPreInstructor = () => { locale="it-IT" minFractionDigits={2} invalid={isEmpty(appointmentData.amount) || appointmentData.amount === 0} - onChange={(e) => setFieldValue('amount', e.value)}/> + onChange={(e) => setAppointmentFieldValue('amount', e.value)}/>
+ +
+ + setPreTecEvalFieldValue('amount', e.value)}/> +
+ {/*
+ + setPreTecEvalFieldValue('pec', e.target.value)}/> +
*/} + {/*
+ +
+ {(preTecEvalData.files || []).map((file, index) => ( +
+ + + {file.name} + + +
+ ))} +
+ { + const newFiles = Array.from(e.target.files); + const existingFiles = preTecEvalData.files || []; + setPreTecEvalFieldValue('files', [...existingFiles, ...newFiles]); + e.target.value = ''; + }} + /> + +
+
+
*/} +
+ : <>