- new flow;

This commit is contained in:
Vitalii Kiiko
2025-09-26 09:19:34 +02:00
parent fd6f861024
commit 6178cfd3ab
6 changed files with 246 additions and 29 deletions

View File

@@ -39,3 +39,57 @@
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);
}
}

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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');

View File

@@ -33,6 +33,9 @@ const getBandoSeverity = (status) => {
case 'TECHNICAL_EVALUATION':
return 'info';
case 'AWAITING_TECHNICAL_EVALUATION':
return 'warning';
case 'DUE':
return 'warning';

View File

@@ -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);
@@ -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);
}
}
}
@@ -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 = () => {
</div>
}
const setPreTecEvalFieldValue = (name, value) => {
const newData = wrap(preTecEvalData).set(name, value).value();
setPreTecEvalData(newData);
}
const headerPreTecEvalDialog = () => {
return <span>{__('Valutazione Tecnico-Finanziaria', 'gepafin')}</span>;
}
const hidePreTecEvalDialog = () => {
setIsVisiblePreTecEvalDialog(false);
setPreTecEvalData({});
}
const footerPreTecEvalDialog = () => {
return <div>
<Button type="button" label={__('Annulla', 'gepafin')} onClick={hidePreTecEvalDialog} outlined/>
<Button
type="button"
disabled={loading}
label={__('Invia', 'gepafin')} onClick={hidePreTecEvalDialog}/>
</div>
}
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 <div className="appPageSection__actions">
{['EVALUATION', 'SOCCORSO', 'CLOSE'].includes(data.applicationStatus)
{['SOCCORSO', 'CLOSE', 'EVALUATION', 'NDG', 'APPOINTMENT', 'ADMISSIBLE', 'AWAITING_TECHNICAL_EVALUATION', 'TECHNICAL_EVALUATION'].includes(data.applicationStatus)
? <Button
type="button"
disabled={!data.id || data.status === 'CLOSE'
@@ -820,7 +888,7 @@ const DomandaEditPreInstructor = () => {
onClick={doNewSoccorso}
outlined
label={<>
{data.applicationStatus === 'EVALUATION'
{connectedSoccorsoId === 0
? __('Richiedi soccorso istruttorio', 'gepafin')
: __('Apri soccorso istruttorio', 'gepafin')}
<i style={{ marginLeft: 7 }}>
@@ -845,7 +913,7 @@ const DomandaEditPreInstructor = () => {
&& APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
? <Button
type="button"
disabled={!data.id || !allFilesRated || !allChecksChecked
disabled={!data.id
|| !['EVALUATION'].includes(data.applicationStatus) || evaluationBlockedForUser(data)}
onClick={doCheckNDG}
label={__('Controlla NDG', 'gepafin')}
@@ -859,13 +927,15 @@ const DomandaEditPreInstructor = () => {
/> : null}
<Button
type="button"
disabled={!data.id || !['APPOINTMENT'].includes(data.applicationStatus) || evaluationBlockedForUser(data)}
disabled={!data.id || !allFilesRated || !allChecksChecked
|| !['APPOINTMENT'].includes(data.applicationStatus) || evaluationBlockedForUser(data) || connectedSoccorsoId !== 0}
onClick={doMakeAdmisible}
label={__('Ammissibile formalmente', 'gepafin')}
/>
<Button
{data.applicationStatus === 'AWAITING_TECHNICAL_EVALUATION'
? <Button
type="button"
disabled={!data.id || !['ADMISSIBLE'].includes(data.applicationStatus) || evaluationBlockedForUser(data)}
disabled={!data.id || !['ADMISSIBLE'].includes(data.applicationStatus) || evaluationBlockedForUser(data) || connectedSoccorsoId !== 0}
onClick={doPassTechnicalEvaluation}
icon="pi pi-info-circle" iconPos="right"
tooltip={isAdmissible
@@ -874,6 +944,14 @@ const DomandaEditPreInstructor = () => {
severity={isAdmissible ? 'success' : 'warning'}
label={__('Valutazione tecnico-finanziaria positiva', 'gepafin')}
/>
: <SplitButton
ref={tecFinBtnRef}
disabled={!data.id || !['ADMISSIBLE'].includes(data.applicationStatus) || evaluationBlockedForUser(data) || connectedSoccorsoId !== 0}
label={__('Valutazione tecnico-finanziaria', 'gepafin')}
onClick={(e) => {
tecFinBtnRef.current.show(e);
}}
model={technicalEvalItems}/>}
<Button
type="button"
disabled={!data.id || !['TECHNICAL_EVALUATION'].includes(data.applicationStatus) || evaluationBlockedForUser(data)}
@@ -889,9 +967,10 @@ const DomandaEditPreInstructor = () => {
|| ['APPROVED', 'REJECTED'].includes(data.applicationStatus)
|| evaluationBlockedForUser(data)
|| (APP_EVALUATION_FLOW_ID === '1' && !['TECHNICAL_EVALUATION'].includes(data.applicationStatus))
|| connectedSoccorsoId !== 0
}
onClick={initiateApproving}
label={__('Domanda deliberata', 'gepafin')}
label={__('Domanda in Graduatoria Definitiva', 'gepafin')}
icon="pi pi-check" iconPos="right"/> : null}
{data.id
? <Button
@@ -912,7 +991,8 @@ const DomandaEditPreInstructor = () => {
<SoccorsoResendEmails
emailsData={emailSendResponse}
setDataEmailsSoccorso={updateEmailSendResponses}/>
<EvaluationReAdmit id={data.applicationId} status={data.applicationStatus} statusUpdateFn={updateStatusOfAppl}/>
<EvaluationReAdmit id={data.applicationId} status={data.applicationStatus}
statusUpdateFn={updateStatusOfAppl}/>
</div>
}
@@ -1286,7 +1366,7 @@ const DomandaEditPreInstructor = () => {
</tr>)}
<tr>
<td>{__('Punteggio:', 'gepafin')}</td>
<td>{new Intl.NumberFormat("it-IT").format(
<td>{new Intl.NumberFormat('it-IT').format(
sum(data.criteria.map(o => o.score))
)}</td>
<td>
@@ -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)}/>
</div>
<div className="appForm__field">
<label
@@ -1389,7 +1469,7 @@ const DomandaEditPreInstructor = () => {
value={appointmentData.duration}
keyfilter="int"
invalid={isEmpty(appointmentData.duration) || appointmentData.duration === 0}
onChange={(e) => setFieldValue('duration', e.value)}/>
onChange={(e) => setAppointmentFieldValue('duration', e.value)}/>
</div>
<div className="appForm__field">
<label className={classNames({ 'p-error': isEmpty(appointmentData.title) })}>
@@ -1398,7 +1478,7 @@ const DomandaEditPreInstructor = () => {
<InputText
value={appointmentData.title}
invalid={isEmpty(appointmentData.title)}
onChange={(e) => setFieldValue('title', e.target.value)}/>
onChange={(e) => setAppointmentFieldValue('title', e.target.value)}/>
</div>
<div className="appForm__field">
<label className={classNames({ 'p-error': isEmpty(appointmentData.text) })}>
@@ -1407,12 +1487,89 @@ const DomandaEditPreInstructor = () => {
<InputTextarea
value={appointmentData.text}
invalid={isEmpty(appointmentData.text)}
onChange={(e) => setFieldValue('text', e.target.value)}
onChange={(e) => setAppointmentFieldValue('text', e.target.value)}
rows={3}
cols={30}/>
</div>
</Dialog>
<Dialog
visible={isVisiblePreTecEvalDialog}
modal
header={headerPreTecEvalDialog}
footer={footerPreTecEvalDialog}
style={{ maxWidth: '600px', width: '100%' }}
onHide={hidePreTecEvalDialog}>
<div className="appForm__field">
<label
className={classNames({ 'p-error': isEmpty(preTecEvalData.amount) || preTecEvalData.amount === 0 })}>
{__('Importo', 'gepafin')}
</label>
<InputNumber
value={preTecEvalData.amount}
locale="it-IT"
minFractionDigits={2}
invalid={isEmpty(preTecEvalData.amount) || preTecEvalData.amount === 0}
onChange={(e) => setPreTecEvalFieldValue('amount', e.value)}/>
</div>
{/*<div className="appForm__field">
<label className={classNames({ 'p-error': isEmpty(preTecEvalData.pec) })}>
{__('PEC', 'gepafin')}
</label>
<InputText
value={preTecEvalData.title}
invalid={isEmpty(preTecEvalData.title)}
onChange={(e) => setPreTecEvalFieldValue('pec', e.target.value)}/>
</div>*/}
{/*<div className="appForm__field">
<label>
{__('Files', 'gepafin')}
</label>
<div className="file-upload-container">
{(preTecEvalData.files || []).map((file, index) => (
<div key={index} className="file-upload-item">
<span className="file-name">
<i className="pi pi-file"></i>
{file.name}
</span>
<button
type="button"
className="p-button p-button-sm p-button-danger p-button-text"
onClick={() => {
const newFiles = [...(preTecEvalData.files || [])];
newFiles.splice(index, 1);
setPreTecEvalFieldValue('files', newFiles);
}}
>
<i className="pi pi-times"></i>
</button>
</div>
))}
<div>
<input
type="file"
id="file-upload"
style={{ display: 'none' }}
multiple
onChange={(e) => {
const newFiles = Array.from(e.target.files);
const existingFiles = preTecEvalData.files || [];
setPreTecEvalFieldValue('files', [...existingFiles, ...newFiles]);
e.target.value = '';
}}
/>
<label
htmlFor="file-upload"
className="file-upload-button"
>
<i className="pi pi-upload"></i>
{__('Add Files', 'gepafin')}
</label>
</div>
</div>
</div>*/}
</Dialog>
</div>
: <>
<Skeleton width="20%" height="1rem" className="mb-2"></Skeleton>