- merged develop;

This commit is contained in:
Vitalii Kiiko
2024-12-11 11:37:36 +01:00
34 changed files with 917 additions and 456 deletions

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react';
import React, { useEffect, useRef, useState } from 'react';
import { __ } from '@wordpress/i18n';
import { isEmpty } from 'ramda';
import { wrap } from 'object-path-immutable';
@@ -9,24 +9,37 @@ import { Dialog } from 'primereact/dialog';
import { InputTextarea } from 'primereact/inputtextarea';
import { Dropdown } from 'primereact/dropdown';
import { classNames } from 'primereact/utils';
import { InputSwitch } from 'primereact/inputswitch';
import { InputText } from 'primereact/inputtext';
const ArchiveDocument = ({ ndg = '', fileId = 0 }) => {
import { classificationType, protocolType } from '../../../../configData';
import AppointmentService from '../../../../service/appointment-service';
import set404FromErrorResponse from '../../../../helpers/set404FromErrorResponse';
import { storeSet } from '../../../../store';
import { Toast } from 'primereact/toast';
const ArchiveDocument = ({ applicationId, ndg = '', fileId = 0 }) => {
const [loading, setLoading] = useState(false);
const [isVisibleDialog, setIsVisibleDialog] = useState(false);
const [modalData, setModalData] = useState({});
const [types, setTypes] = useState([]);
const [categories, setCategories] = useState([]);
const toast = useRef(null);
const openArchivationModal = () => {
setIsVisibleDialog(true);
setModalData({
description: '',
categoryId: 0,
descrizione: '',
idTipoProtocollo: 0,
idClassificazione: 0,
flagDaFirmare: false,
email: '',
fileId
});
}
const headerDialog = () => {
return <span>{__('Archive document', 'gepafin')}</span>;
return <span>{__('Archiviazione del documento', 'gepafin')}</span>;
}
const hideDialog = () => {
@@ -50,57 +63,141 @@ const ArchiveDocument = ({ ndg = '', fileId = 0 }) => {
}
const submitData = () => {
console.log('submitData', modalData);
//setLoading(true);
if (
modalData.idTipoProtocollo !== 0 && modalData.idClassificazione !== 0
&& !isEmpty(modalData.descrizione) && !isEmpty(modalData.email)
) {
setLoading(true);
const submitData = {
'input': {
'idTipoProtocollo': modalData.idTipoProtocollo,
'idClassificazione': modalData.idClassificazione,
'flagDaFirmare': modalData.flagDaFirmare,
'descrizione': modalData.descrizione,
'attributes': {
'ndg': ndg,
'email': modalData.email
}
}
}
AppointmentService.archiveDocument(applicationId, fileId, submitData, submitCallback, errSubmitCallback)
}
}
const submitCallback = (data) => {
if (data.status === 'SUCCESS') {
console.log(data.data);
}
setLoading(false);
}
const errSubmitCallback = (data) => {
if (toast.current && data.message) {
toast.current.show({
severity: 'error',
summary: '',
detail: data.message
});
}
set404FromErrorResponse(data);
setLoading(false);
}
useEffect(() => {
setCategories([
{value: 1, label: 'Type 1'},
{value: 2, label: 'Type 2'},
])
const newModalData = {
...modalData,
idClassificazione: 0
};
setModalData(newModalData);
setCategories(classificationType
.filter(o => o.idTipoprotocollo === modalData.idTipoProtocollo)
.map(o => ({ value: o.idClassificazione, label: o.name })));
}, [modalData.idTipoProtocollo])
useEffect(() => {
setTypes(protocolType.map(o => ({ value: o.id, label: o.name })));
}, []);
return (
<>
{!isEmpty(ndg)
? <Button icon="pi pi-file-export"
rounded
onClick={openArchivationModal}
outlined
severity="info"
aria-label={__('Mostra', 'gepafin')}/>
: null}
<Dialog
visible={isVisibleDialog}
modal
header={headerDialog}
footer={footerDialog}
style={{ maxWidth: '600px', width: '100%' }}
onHide={hideDialog}>
<div className="appForm__field">
<label className={classNames({ 'p-error': !modalData.categoryId || modalData.categoryId === 0 })}>
{__('Classificazione', 'gepafin')}*
</label>
<Dropdown
value={modalData.categoryId}
invalid={!modalData.categoryId || modalData.categoryId === 0}
onChange={(e) => setValue('categoryId', e.value)}
options={categories}/>
</div>
<div className="appForm__field">
<label className={classNames({ 'p-error': isEmpty(modalData.description) })}>
{__('Descrizione', 'gepafin')}
</label>
<InputTextarea
value={modalData.description}
invalid={isEmpty(modalData.description)}
onChange={(e) => setValue('description', e.target.value)}
rows={3}
cols={30}/>
</div>
</Dialog>
</>
return (!isEmpty(ndg)
? <>
<Toast ref={toast}/>
<Button icon="pi pi-file-export"
rounded
onClick={openArchivationModal}
outlined
severity="info"
aria-label={__('Mostra', 'gepafin')}/>
<Dialog
visible={isVisibleDialog}
modal
header={headerDialog}
footer={footerDialog}
style={{ maxWidth: '600px', width: '100%' }}
onHide={hideDialog}>
<div className="appForm__field">
<label
className={classNames({ 'p-error': !modalData.idTipoProtocollo || modalData.idTipoProtocollo === 0 })}>
{__('Tipo di protocollo', 'gepafin')}*
</label>
<Dropdown
value={modalData.idTipoProtocollo}
invalid={!modalData.idTipoProtocollo || modalData.idTipoProtocollo === 0}
onChange={(e) => setValue('idTipoProtocollo', e.value)}
options={types}/>
</div>
<div className="appForm__field">
<label
className={classNames({ 'p-error': !modalData.idClassificazione || modalData.idClassificazione === 0 })}>
{__('Classificazione', 'gepafin')}*
</label>
<Dropdown
value={modalData.idClassificazione}
invalid={!modalData.idClassificazione || modalData.idClassificazione === 0}
onChange={(e) => setValue('idClassificazione', e.value)}
options={categories}/>
</div>
<div className="appForm__field">
<label>
{__('Da firmare?', 'gepafin')}
</label>
<InputSwitch
checked={modalData.flagDaFirmare}
onChange={(e) => setValue('flagDaFirmare', e.value)}/>
</div>
<div className="appForm__field">
<label className={classNames({ 'p-error': isEmpty(modalData.descrizione) })}>
{__('Descrizione', 'gepafin')}*
</label>
<InputTextarea
value={modalData.descrizione}
invalid={isEmpty(modalData.descrizione)}
onChange={(e) => setValue('descrizione', e.target.value)}
rows={3}
cols={30}/>
</div>
<div className="appForm__field">
<label>
{__('NDG', 'gepafin')}*
</label>
<InputText
value={ndg}
disabled
onChange={() => {
}}/>
</div>
<div className="appForm__field">
<label className={classNames({ 'p-error': isEmpty(modalData.email) })}>
{__('Email', 'gepafin')}*
</label>
<InputText
value={modalData.email}
keyfilter="email"
invalid={isEmpty(modalData.email)}
onChange={(e) => setValue('email', e.target.value)}/>
</div>
</Dialog>
</> : null
)
}

View File

@@ -0,0 +1,49 @@
import React, { useState } from 'react';
import { __ } from '@wordpress/i18n';
// tools
import set404FromErrorResponse from '../../../../helpers/set404FromErrorResponse';
// api
import ApplicationService from '../../../../service/application-service';
// components
import { Button } from 'primereact/button';
const DownloadApplicationArchive = ({ applicationId = 0 }) => {
const [loading, setLoading] = useState(false);
const onClickDownload = () => {
setLoading(true);
ApplicationService.downloadCompleteZip(applicationId, getCompleteZipCallback, errCompleteZipCallback);
}
const getCompleteZipCallback = (data) => {
const file = new Blob([data], { type: 'application/zip' });
const url = window.URL.createObjectURL(file);
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', `application-${applicationId}.zip`);
document.body.appendChild(link);
link.click();
link.remove();
setLoading(false);
}
const errCompleteZipCallback = (data) => {
set404FromErrorResponse(data);
setLoading(false);
}
return (applicationId && applicationId !== 0
? <Button
type="button"
disabled={loading}
onClick={onClickDownload}
label={__('Scarica ZIP', 'gepafin')}
icon="pi pi-download"
iconPos="right"/> : null
)
}
export default DownloadApplicationArchive;

View File

@@ -0,0 +1,51 @@
import React, { useState, useEffect } from 'react';
import { __ } from '@wordpress/i18n';
import { isEmpty } from 'ramda';
// api
import CompanyService from '../../../../service/company-service';
// components
import { Button } from 'primereact/button';
const DownloadCompanyDelegation = ({ applicationId = 0 }) => {
const [loading, setLoading] = useState(false);
const [delega, setDelega] = useState({});
const onClickDownload = () => {
if (delega.filePath) {
window.open(encodeURI(delega.filePath), '_blank').focus()
}
}
const getDellegaCallback = (data) => {
if (data.data) {
setDelega(data.data);
}
setLoading(false);
}
const errDellegaCallback = () => {
setDelega([]);
setLoading(false);
}
useEffect(() => {
setLoading(true);
CompanyService.getCompanyDelega(getDellegaCallback, errDellegaCallback, [
['applicationId', applicationId]
]);
}, [])
return (applicationId && applicationId !== 0
? <Button
type="button"
disabled={loading || isEmpty(delega)}
onClick={onClickDownload}
label={__('Scarica la delega', 'gepafin')}
icon="pi pi-download"
iconPos="right"/> : null
)
}
export default DownloadCompanyDelegation;

View File

@@ -0,0 +1,45 @@
import React, { useState } from 'react';
import { __ } from '@wordpress/i18n';
// api
import ApplicationService from '../../../../service/application-service';
// components
import { Button } from 'primereact/button';
const DownloadSignedApplication = ({ applicationId = 0 }) => {
const [loading, setLoading] = useState(false);
const [, setDocument] = useState({});
const onClickDownload = () => {
setLoading(true);
ApplicationService.getApplicationSignedPdf(applicationId, getSignedPdfCallback, errSignedPdfCallbacks);
}
const getSignedPdfCallback = (data) => {
if (data.data) {
setDocument([data.data]);
if (data.data.filePath) {
window.open(encodeURI(data.data.filePath), '_blank').focus()
}
}
setLoading(false);
}
const errSignedPdfCallbacks = () => {
setDocument([]);
setLoading(false);
}
return (applicationId && applicationId !== 0
? <Button
type="button"
disabled={loading}
onClick={onClickDownload}
label={__('Scarica PDF firmato', 'gepafin')}
icon="pi pi-download"
iconPos="right"/> : null
)
}
export default DownloadSignedApplication;

View File

@@ -0,0 +1,72 @@
import React from 'react';
import { Button } from 'primereact/button';
import { __ } from '@wordpress/i18n';
import { isNil } from 'ramda';
import ArchiveDocument from '../ArchiveDocument';
const ListOfFiles = ({ files, updateFn, shouldDisableFieldFn, name, ndg, applicationId }) => {
return (
<ol className="appPageSection__list">
{files.map((o, i) => <li key={o.id} className="appPageSection__listItem">
<div className="appPageSection__listItemRow">
<span>{o.label}</span>
<div className="appPageSection__iconActions">
{o.fileDetail && o.fileDetail.length === 1
? <Button icon="pi pi-eye" rounded
onClick={() => {
window.open(o.fileDetail[0].filePath, '_blank').focus()
}}
outlined severity="info"
aria-label={__('Mostra', 'gepafin')}/> : null}
<Button icon="pi pi-thumbs-up" rounded outlined
disabled={shouldDisableFieldFn(name)}
severity={!isNil(o.valid) && o.valid ? 'success' : 'secondary'}
onClick={() => updateFn(
true,
[name, i, 'valid']
)}
aria-label={__('Su', 'gepafin')}/>
<Button icon="pi pi-thumbs-down" rounded outlined
disabled={shouldDisableFieldFn(name)}
severity={!isNil(o.valid) && !o.valid ? 'danger' : 'secondary'}
onClick={() => updateFn(
false,
[name, i, 'valid']
)}
aria-label={__('Giu', 'gepafin')}/>
</div>
</div>
{o.fileDetail && o.fileDetail.length > 1
? <ul style={{
width: '100%',
paddingLeft: '15px',
display: 'flex',
flexDirection: 'column',
gap: '10px'
}}>
{o.fileDetail.map((k) => <li key={k.id} style={{
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between'
}}>
<span>{k.name}</span>
<div className="appPageSection__iconActions">
<ArchiveDocument ndg={ndg} applicationId={applicationId} fileId={k.id}/>
<Button icon="pi pi-eye" rounded
onClick={() => {
window.open(k.filePath, '_blank').focus()
}}
outlined severity="info"
aria-label={__('Mostra', 'gepafin')}/>
</div>
</li>)}
</ul>
: null}
</li>)}
</ol>
)
}
export default ListOfFiles;

View File

@@ -32,6 +32,11 @@ import ArchiveDocument from './components/ArchiveDocument';
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 AppointmentService from '../../service/appointment-service';
import ListOfFiles from './components/ListOfFiles';
const APP_EVALUATION_FLOW_ID = process.env.REACT_APP_EVALUATION_FLOW_ID;
@@ -51,6 +56,9 @@ const DomandaEditPreInstructor = () => {
const [operationType, setOperationType] = useState('');
const [motivation, setMotivation] = useState('');
const [isVisibleAppointmentDialog, setIsVisibleAppointmentDialog] = useState(false);
const [allFilesRated, setAllFilesRated] = useState(false);
const [atLeastOneChecked, setAtLeastOneChecked] = useState(false);
const [allChecksChecked, setAllChecksChecked] = useState(false);
const [appointmentData, setAppointmentData] = useState({
title: '',
text: '',
@@ -62,6 +70,22 @@ const DomandaEditPreInstructor = () => {
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 = () => {
if (connectedSoccorsoId !== 0) {
doSaveDraft(`/domande/${id}/soccorso/${connectedSoccorsoId}`)
@@ -74,6 +98,7 @@ const DomandaEditPreInstructor = () => {
if (data.status === 'SUCCESS') {
setData(getFormattedData(data.data));
setMotivation(data.data.motivation);
updateFlagsForSoccorso(data.data);
}
storeSet.main.unsetAsyncRequest();
}
@@ -116,15 +141,16 @@ const DomandaEditPreInstructor = () => {
const header = renderHeader();
const updateEvaluationValue = (value, path, maxValue) => {
const updateEvaluationValue = (value, path, maxValue = null) => {
let finalValue = value;
if (maxValue || maxValue === 0) {
finalValue = value > maxValue ? maxValue : value;
}
const newData = wrap(data).set(path.split('.'), finalValue).value();
const newData = wrap(data).set(path, finalValue).value();
setData(newData);
updateFlagsForSoccorso(newData);
}
const doSaveDraft = (doRedirect = '') => {
@@ -134,6 +160,7 @@ const DomandaEditPreInstructor = () => {
files: klona(data.files),
note: data.note
}
ApplicationEvaluationService.updateEvaluation(
data.assignedApplicationId,
formData,
@@ -241,9 +268,11 @@ const DomandaEditPreInstructor = () => {
switch (item.fieldName) {
case 'fileupload' :
content = <ul>
{item.fieldValue.map(o => <li key={o.id}>
{o.filePath ? <a href={o.filePath}>{o.name}</a> : null}
</li>)}
{item.fieldValue
? item.fieldValue.map(o => <li key={o.id}>
{o.filePath ? <a href={o.filePath}>{o.name}</a> : null}
</li>)
: null}
</ul>;
break;
case 'table' :
@@ -255,9 +284,11 @@ const DomandaEditPreInstructor = () => {
</tr>
</thead>
<tbody>
{item.fieldValue.map((o, i) => <tr key={i}>
{Object.values(o).map(v => <td key={v}>{v}</td>)}
</tr>)}
{item.fieldValue
? item.fieldValue.map((o, i) => <tr key={i}>
{Object.values(o).map(v => <td key={v}>{v}</td>)}
</tr>)
: null}
</tbody>
</table>;
break;
@@ -336,7 +367,30 @@ const DomandaEditPreInstructor = () => {
}
const doCheckNDG = () => {
// TODO
storeSet.main.setAsyncRequest();
doSaveDraft();
setTimeout(() => {
AppointmentService.getNdg(id, getNdgCallback, errGetNdgCallback);
}, 100);
}
const getNdgCallback = (data) => {
if (data.status === 'SUCCESS') {
console.log('data', data.data);
}
storeSet.main.unsetAsyncRequest();
}
const errGetNdgCallback = (data) => {
if (toast.current && data.message) {
toast.current.show({
severity: 'error',
summary: '',
detail: data.message
});
}
set404FromErrorResponse(data);
storeSet.main.unsetAsyncRequest();
}
const doCreateAppointment = () => {
@@ -376,7 +430,7 @@ const DomandaEditPreInstructor = () => {
const doCreateAppointmentRequest = () => {
if (
!isEmpty(appointmentData.title) && !isEmpty(appointmentData.text) && !isEmpty(appointmentData.amount)
&& !isEmpty(appointmentData.duration) && appointmentData.duration !== 0 && appointmentData.amount !== 0
&& !isEmpty(appointmentData.duration) && appointmentData.duration !== 0 && appointmentData.amount !== 0
) {
console.log(appointmentData);
//setLoading(true);
@@ -436,6 +490,18 @@ const DomandaEditPreInstructor = () => {
<span>{__('ID domanda', 'gepafin')}</span>
<span>{data.applicationId}</span>
</p>
<p className="appPageSection__pMeta">
<span>{__('Protocollo', 'gepafin')}</span>
<span>{data.protocolNumber}</span>
</p>
<p className="appPageSection__pMeta">
<span>{__('NDG', 'gepafin')}</span>
<span>{data.ndg}</span>
</p>
<p className="appPageSection__pMeta">
<span>{__('Appuntamento', 'gepafin')}</span>
<span>{data.appointmentId}</span>
</p>
<p className="appPageSection__pMeta">
<span>{__('Bando', 'gepafin')}</span>
<span>{data.callName}</span>
@@ -444,13 +510,21 @@ const DomandaEditPreInstructor = () => {
<span>{__('Beneficiario', 'gepafin')}</span>
<span>{data.beneficiary}</span>
</p>
<p className="appPageSection__pMeta">
<span>{__('Azienda', 'gepafin')}</span>
<span>{data.companyName}</span>
</p>
<p className="appPageSection__pMeta">
<span>{__('Data ricezione', 'gepafin')}</span>
<span>{getDateFromISOstring(data.submissionDate)}</span>
</p>
<p className="appPageSection__pMeta">
<span>{__('Data assegnazione', 'gepafin')}</span>
<span>{getDateFromISOstring(data.assignedAt)}</span>
</p>
<p className="appPageSection__pMeta">
<span>{__('Scadenza Valutazione', 'gepafin')}</span>
<span>{getDateFromISOstring(data.callEndDate)}</span>
<span>{getDateFromISOstring(data.evaluationEndDate)}</span>
</p>
<p className="appPageSection__pMeta">
<span>{__('Stato', 'gepafin')}</span>
@@ -458,7 +532,64 @@ const DomandaEditPreInstructor = () => {
</p>
</div>
<div className="appPageSection"></div>
<div className="appPageSection">
<h2>{__('Scarica documenti della domanda', 'gepafin')}</h2>
<div className="appPageSection__row autoFlow">
<DownloadApplicationArchive applicationId={id}/>
<DownloadSignedApplication applicationId={id}/>
<DownloadCompanyDelegation applicationId={id}/>
</div>
</div>
<div className="appPageSection">
<h2>{__('Checklist Valutazione', 'gepafin')}</h2>
<div className="appPageSection columns">
<div>
<h3>{__('Lista', 'gepafin')}</h3>
<div className="appPageSection__withBorder grey" style={{ marginBottom: '20px' }}>
<div className="appPageSection__checklist">
{data.checklist.map((o, i) => <div key={o.id}>
<Checkbox
disabled={shouldDisableField('checklist')}
inputId={`checklist_${o.id}`}
onChange={(e) => updateEvaluationValue(
e.checked,
['checklist', i, 'valid']
)}
checked={o.valid}></Checkbox>
<label htmlFor={`checklist_${o.id}`}>{o.label}</label>
</div>)}
</div>
</div>
<h3>{__('Note', 'gepafin')}</h3>
<div>
<Editor
value={data.note}
readOnly={shouldDisableField('note')}
placeholder={__('Digita qui il messagio', 'gepafin')}
headerTemplate={header}
onTextChange={(e) => updateEvaluationValue(
e.htmlValue,
['note']
)}
style={{ height: 80 * 3, width: '100%' }}
/>
</div>
</div>
<div>
<h3>{__('Documenti allegati', 'gepafin')}</h3>
<ListOfFiles
files={data.files}
updateFn={updateEvaluationValue}
shouldDisableFieldFn={shouldDisableField}
name="files"
ndg={data.ndg}
applicationId={id}/>
</div>
</div>
</div>
<div className="appPageSection">
<h2>{__('Punteggi di valutazione', 'gepafin')}</h2>
@@ -484,8 +615,8 @@ const DomandaEditPreInstructor = () => {
max={o.maxScore}
onChange={(e) => updateEvaluationValue(
e.value,
`criteria.${i}.score`,
o.maxScore
['criteria', i, 'score'],
o.criteria
)}/>
<span className="p-inputgroup-addon">
/ {o.maxScore}
@@ -504,7 +635,7 @@ const DomandaEditPreInstructor = () => {
severity={!isNil(o.valid) && o.valid ? 'success' : 'secondary'}
onClick={() => updateEvaluationValue(
true,
`criteria.${i}.valid`
['criteria', i, 'valid']
)}
aria-label={__('Su', 'gepafin')}/>
<Button icon="pi pi-thumbs-down" rounded outlined
@@ -512,7 +643,7 @@ const DomandaEditPreInstructor = () => {
severity={!isNil(o.valid) && !o.valid ? 'danger' : 'secondary'}
onClick={() => updateEvaluationValue(
false,
`criteria.${i}.valid`
['criteria', i, 'valid']
)}
aria-label={__('Giu', 'gepafin')}/>
</div>
@@ -539,104 +670,6 @@ const DomandaEditPreInstructor = () => {
</table> : null}
</div>
<div className="appPageSection">
<h2>{__('Checklist Valutazione', 'gepafin')}</h2>
<div className="appPageSection columns">
<div>
<h3>{__('Lista', 'gepafin')}</h3>
<div className="appPageSection__withBorder grey" style={{ marginBottom: '20px' }}>
<div className="appPageSection__checklist">
{data.checklist.map((o, i) => <div key={o.id}>
<Checkbox
disabled={shouldDisableField('checklist')}
inputId={`checklist_${o.id}`}
onChange={(e) => updateEvaluationValue(
e.checked,
`checklist.${i}.valid`
)}
checked={o.valid}></Checkbox>
<label htmlFor={`checklist_${o.id}`}>{o.label}</label>
</div>)}
</div>
</div>
<h3>{__('Note', 'gepafin')}</h3>
<div>
<Editor
value={data.note}
readOnly={shouldDisableField('note')}
placeholder={__('Digita qui il messagio', 'gepafin')}
headerTemplate={header}
onTextChange={(e) => updateEvaluationValue(
e.htmlValue,
'note'
)}
style={{ height: 80 * 3, width: '100%' }}
/>
</div>
</div>
<div>
<h3>{__('Documenti allegati', 'gepafin')}</h3>
<ol className="appPageSection__list">
{data.files.map((o, i) => <li key={o.id} className="appPageSection__listItem">
<div className="appPageSection__listItemRow">
<span>{o.label}</span>
<div className="appPageSection__iconActions">
{o.fileDetail && o.fileDetail.length === 1
? <Button icon="pi pi-eye" rounded
onClick={() => window.open(o.fileDetail[0].filePath, '_blank').focus()}
outlined severity="info"
aria-label={__('Mostra', 'gepafin')}/> : null}
<Button icon="pi pi-thumbs-up" rounded outlined
disabled={shouldDisableField('files')}
severity={!isNil(o.valid) && o.valid ? 'success' : 'secondary'}
onClick={() => updateEvaluationValue(
true,
`files.${i}.valid`
)}
aria-label={__('Su', 'gepafin')}/>
<Button icon="pi pi-thumbs-down" rounded outlined
disabled={shouldDisableField('files')}
severity={!isNil(o.valid) && !o.valid ? 'danger' : 'secondary'}
onClick={() => updateEvaluationValue(
false,
`files.${i}.valid`
)}
aria-label={__('Giu', 'gepafin')}/>
</div>
</div>
{o.fileDetail && o.fileDetail.length > 1
? <ul style={{
width: '100%',
paddingLeft: '15px',
display: 'flex',
flexDirection: 'column',
gap: '10px'
}}>
{o.fileDetail.map((k, i) => <li key={k.id} style={{
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between'
}}>
<span>{k.name}</span>
<div className="appPageSection__iconActions">
<ArchiveDocument ndg={data.ndg} fileId={k.id}/>
<Button icon="pi pi-eye" rounded
onClick={() => window.open(k.filePath, '_blank').focus()}
outlined severity="info"
aria-label={__('Mostra', 'gepafin')}/>
</div>
</li>)}
</ul>
: null}
</li>)}
</ol>
</div>
</div>
</div>
<div className="appPage__spacer"></div>
<div className="appPageSection__hr">
@@ -647,36 +680,36 @@ const DomandaEditPreInstructor = () => {
<div className="appPageSection__actions">
{['EVALUATION', 'SOCCORSO', 'CLOSE'].includes(data.applicationStatus)
? <Button
type="button"
disabled={!data.id || data.status === 'CLOSE'}
onClick={doNewSoccorso}
outlined
label={<>
{data.applicationStatus === 'EVALUATION'
? __('Richiedi Soccorso Istruttorio', 'gepafin')
: __('Apri Soccorso Istruttorio', 'gepafin')}
<i style={{ marginLeft: 7 }}>
<HelpIcon/>
</i>
</>}
/> : null}
type="button"
disabled={!data.id || data.status === 'CLOSE' || !allFilesRated || !atLeastOneChecked}
onClick={doNewSoccorso}
outlined
label={<>
{data.applicationStatus === 'EVALUATION'
? __('Richiedi Soccorso Istruttorio', 'gepafin')
: __('Apri Soccorso Istruttorio', 'gepafin')}
<i style={{ marginLeft: 7 }}>
<HelpIcon/>
</i>
</>}
/> : null}
{data.id
? <Button
type="button"
disabled={data.status === 'CLOSE'}
onClick={doSaveDraft}
onClick={() => doSaveDraft()}
outlined
label={__('Salva bozza valutazione', 'gepafin')}
icon="pi pi-save" iconPos="right"/>
: <Button
type="button"
onClick={doSaveDraft}
onClick={() => doSaveDraft()}
label={__('Crea valutazione', 'gepafin')}
icon="pi pi-save" iconPos="right"/>}
{APP_EVALUATION_FLOW_ID === '1' && ['EVALUATION'].includes(data.applicationStatus)
? <Button
type="button"
disabled={!data.id}
disabled={!data.id || !allFilesRated || !allChecksChecked}
onClick={doCheckNDG}
label={__('Controlla NDG', 'gepafin')}
/> : null}
@@ -748,7 +781,8 @@ const DomandaEditPreInstructor = () => {
style={{ maxWidth: '600px', width: '100%' }}
onHide={hideAppointmentDialog}>
<div className="appForm__field">
<label className={classNames({ 'p-error': isEmpty(appointmentData.amount) || appointmentData.amount === 0})}>
<label
className={classNames({ 'p-error': isEmpty(appointmentData.amount) || appointmentData.amount === 0 })}>
{__('Importo', 'gepafin')}
</label>
<InputNumber
@@ -758,13 +792,14 @@ const DomandaEditPreInstructor = () => {
onChange={(e) => setValue('amount', e.value)}/>
</div>
<div className="appForm__field">
<label className={classNames({ 'p-error': isEmpty(appointmentData.duration) || appointmentData.duration === 0 })}>
<label
className={classNames({ 'p-error': isEmpty(appointmentData.duration) || appointmentData.duration === 0 })}>
{__('Durata', 'gepafin')}
</label>
<InputNumber
value={appointmentData.duration}
keyfilter="int"
invalid={isEmpty(appointmentData.duration) || appointmentData.duration === 0}
invalid={isEmpty(appointmentData.duration) || appointmentData.duration === 0}
onChange={(e) => setValue('duration', e.value)}/>
</div>
<div className="appForm__field">