- updated styles for disabled icons;

- added checks for disabled/enabled buttons;
- fixed displaying the date of assignment;
This commit is contained in:
Vitalii Kiiko
2024-12-06 11:32:24 +01:00
parent 1ad1cc19bc
commit 26a6c2a2b1
3 changed files with 37 additions and 8 deletions

View File

@@ -12,6 +12,10 @@
.p-button:not(.p-button-outlined, .p-button-secondary, .p-confirm-popup-reject, .p-button-link, .p-column-filter-add-button, .p-column-filter-remove-button) span { .p-button:not(.p-button-outlined, .p-button-secondary, .p-confirm-popup-reject, .p-button-link, .p-column-filter-add-button, .p-column-filter-remove-button) span {
color: var(--menuitem-active-color); color: var(--menuitem-active-color);
} }
.p-button.p-button-success.p-button-icon-only[disabled],
.p-button.p-button-danger.p-button-icon-only[disabled] {
filter: unset;
}
.p-column-filter-remove-button { .p-column-filter-remove-button {
span { span {
margin: 0 5px; margin: 0 5px;

View File

@@ -54,7 +54,7 @@ const PreInstructorDomandeTable = () => {
const getFormattedData = (data) => { const getFormattedData = (data) => {
return data.map((d) => { return data.map((d) => {
d.callEndDate = is(String, d.callEndDate) ? new Date(d.callEndDate) : (d.callEndDate ? d.callEndDate : ''); d.evaluationEndDate = is(String, d.evaluationEndDate) ? new Date(d.evaluationEndDate) : (d.evaluationEndDate ? d.evaluationEndDate : '');
d.submissionDate = is(String, d.submissionDate) ? new Date(d.submissionDate) : (d.submissionDate ? d.submissionDate : ''); d.submissionDate = is(String, d.submissionDate) ? new Date(d.submissionDate) : (d.submissionDate ? d.submissionDate : '');
return d; return d;
}); });
@@ -87,7 +87,7 @@ const PreInstructorDomandeTable = () => {
operator: FilterOperator.AND, operator: FilterOperator.AND,
constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }] constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }]
}, },
callEndDate : { evaluationEndDate: {
operator: FilterOperator.AND, operator: FilterOperator.AND,
constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }] constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }]
} }
@@ -107,7 +107,7 @@ const PreInstructorDomandeTable = () => {
}; };
const dateEndBodyTemplate = (rowData) => { const dateEndBodyTemplate = (rowData) => {
return formatDate(rowData.callEndDate); return formatDate(rowData.evaluationEndDate);
}; };
const dateFilterTemplate = (options) => { const dateFilterTemplate = (options) => {
@@ -164,7 +164,7 @@ const PreInstructorDomandeTable = () => {
<Column header={__('Data ricezione', 'gepafin')} filterField="submissionDate" dataType="date" <Column header={__('Data ricezione', 'gepafin')} filterField="submissionDate" dataType="date"
style={{ minWidth: '8rem' }} style={{ minWidth: '8rem' }}
body={dateAppliedBodyTemplate} filter filterElement={dateFilterTemplate}/> body={dateAppliedBodyTemplate} filter filterElement={dateFilterTemplate}/>
<Column header={__('Scadenza', 'gepafin')} filterField="callEndDate" dataType="date" <Column header={__('Scadenza', 'gepafin')} filterField="evaluationEndDate" dataType="date"
style={{ minWidth: '8rem' }} style={{ minWidth: '8rem' }}
body={dateEndBodyTemplate} filter filterElement={dateFilterTemplate}/> body={dateEndBodyTemplate} filter filterElement={dateFilterTemplate}/>
<Column field="status" header={__('Stato', 'gepafin')} <Column field="status" header={__('Stato', 'gepafin')}

View File

@@ -54,6 +54,9 @@ const DomandaEditPreInstructor = () => {
const [operationType, setOperationType] = useState(''); const [operationType, setOperationType] = useState('');
const [motivation, setMotivation] = useState(''); const [motivation, setMotivation] = useState('');
const [isVisibleAppointmentDialog, setIsVisibleAppointmentDialog] = useState(false); const [isVisibleAppointmentDialog, setIsVisibleAppointmentDialog] = useState(false);
const [allFilesRated, setAllFilesRated] = useState(false);
const [atLeastOneChecked, setAtLeastOneChecked] = useState(false);
const [allChecksChecked, setAllChecksChecked] = useState(false);
const [appointmentData, setAppointmentData] = useState({ const [appointmentData, setAppointmentData] = useState({
title: '', title: '',
text: '', text: '',
@@ -65,6 +68,22 @@ const DomandaEditPreInstructor = () => {
navigate('/domande'); navigate('/domande');
} }
const updateFlagsForSoccorso = (data) => {
if (data.files) {
const nonRatedFiles = data.files
.map(el => el.valid)
.filter(v => isNil(v));
setAllFilesRated(nonRatedFiles.length === 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)
}
}
const doNewSoccorso = () => { const doNewSoccorso = () => {
if (connectedSoccorsoId !== 0) { if (connectedSoccorsoId !== 0) {
doSaveDraft(`/domande/${id}/soccorso/${connectedSoccorsoId}`) doSaveDraft(`/domande/${id}/soccorso/${connectedSoccorsoId}`)
@@ -77,6 +96,7 @@ const DomandaEditPreInstructor = () => {
if (data.status === 'SUCCESS') { if (data.status === 'SUCCESS') {
setData(getFormattedData(data.data)); setData(getFormattedData(data.data));
setMotivation(data.data.motivation); setMotivation(data.data.motivation);
updateFlagsForSoccorso(data.data);
} }
storeSet.main.unsetAsyncRequest(); storeSet.main.unsetAsyncRequest();
} }
@@ -129,6 +149,7 @@ const DomandaEditPreInstructor = () => {
const newData = wrap(data).set(pathEls, finalValue).value(); const newData = wrap(data).set(pathEls, finalValue).value();
setData(newData); setData(newData);
updateFlagsForSoccorso(newData);
} }
const doSaveDraft = (doRedirect = '') => { const doSaveDraft = (doRedirect = '') => {
@@ -466,9 +487,13 @@ const DomandaEditPreInstructor = () => {
<span>{__('Data ricezione', 'gepafin')}</span> <span>{__('Data ricezione', 'gepafin')}</span>
<span>{getDateFromISOstring(data.submissionDate)}</span> <span>{getDateFromISOstring(data.submissionDate)}</span>
</p> </p>
<p className="appPageSection__pMeta">
<span>{__('Data assegnazione', 'gepafin')}</span>
<span>{getDateFromISOstring(data.assignedAt)}</span>
</p>
<p className="appPageSection__pMeta"> <p className="appPageSection__pMeta">
<span>{__('Scadenza Valutazione', 'gepafin')}</span> <span>{__('Scadenza Valutazione', 'gepafin')}</span>
<span>{getDateFromISOstring(data.callEndDate)}</span> <span>{getDateFromISOstring(data.evaluationEndDate)}</span>
</p> </p>
<p className="appPageSection__pMeta"> <p className="appPageSection__pMeta">
<span>{__('Stato', 'gepafin')}</span> <span>{__('Stato', 'gepafin')}</span>
@@ -479,7 +504,7 @@ const DomandaEditPreInstructor = () => {
<div className="appPageSection"> <div className="appPageSection">
<h2>{__('Scarica documenti della domanda', 'gepafin')}</h2> <h2>{__('Scarica documenti della domanda', 'gepafin')}</h2>
<div className="appPageSection__row autoFlow"> <div className="appPageSection__row autoFlow">
<DownloadApplicationArchive applicationId={id}/> <DownloadApplicationArchive applicationId={id}/>
<DownloadSignedApplication applicationId={id}/> <DownloadSignedApplication applicationId={id}/>
<DownloadCompanyDelegation applicationId={id}/> <DownloadCompanyDelegation applicationId={id}/>
</div> </div>
@@ -677,7 +702,7 @@ const DomandaEditPreInstructor = () => {
{['EVALUATION', 'SOCCORSO', 'CLOSE'].includes(data.applicationStatus) {['EVALUATION', 'SOCCORSO', 'CLOSE'].includes(data.applicationStatus)
? <Button ? <Button
type="button" type="button"
disabled={!data.id || data.status === 'CLOSE'} disabled={!data.id || data.status === 'CLOSE' || !allFilesRated || !atLeastOneChecked}
onClick={doNewSoccorso} onClick={doNewSoccorso}
outlined outlined
label={<> label={<>
@@ -705,7 +730,7 @@ const DomandaEditPreInstructor = () => {
{APP_EVALUATION_FLOW_ID === '1' && ['EVALUATION'].includes(data.applicationStatus) {APP_EVALUATION_FLOW_ID === '1' && ['EVALUATION'].includes(data.applicationStatus)
? <Button ? <Button
type="button" type="button"
disabled={!data.id} disabled={!data.id || !allFilesRated || !allChecksChecked}
onClick={doCheckNDG} onClick={doCheckNDG}
label={__('Controlla NDG', 'gepafin')} label={__('Controlla NDG', 'gepafin')}
/> : null} /> : null}