Merge pull request #6 from Kitzanos/feature/66-updated-logic-evaluation
QOL updates and fixes
This commit is contained in:
@@ -11,6 +11,9 @@ const getBandoLabel = (status) => {
|
||||
case 'PUBLISH':
|
||||
return __('Pubblicato', 'gepafin');
|
||||
|
||||
case 'APPROVED':
|
||||
return __('Approvato', 'gepafin');
|
||||
|
||||
case 'READY_TO_PUBLISH':
|
||||
return __('Pronto', 'gepafin');
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@ const getBandoSeverity = (status) => {
|
||||
case 'PUBLISH':
|
||||
return 'success';
|
||||
|
||||
case 'APPROVED':
|
||||
return 'success';
|
||||
|
||||
case 'READY_TO_PUBLISH':
|
||||
return 'info';
|
||||
|
||||
|
||||
@@ -26,12 +26,14 @@ import { classNames } from 'primereact/utils';
|
||||
import { Dialog } from 'primereact/dialog';
|
||||
import { InputText } from 'primereact/inputtext';
|
||||
import { InputTextarea } from 'primereact/inputtextarea';
|
||||
import ApplicationService from '../../service/application-service';
|
||||
|
||||
const DomandaBeneficiario = () => {
|
||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||
const { id } = useParams();
|
||||
const navigate = useNavigate();
|
||||
const [data, setData] = useState({});
|
||||
const [dataAppl, setDataAppl] = useState({});
|
||||
const [comms, setComms] = useState([]);
|
||||
const [isVisibleNewCommDialog, setIsVisibleNewCommDialog] = useState(false);
|
||||
const [newCommData, setNewCommData] = useState({});
|
||||
@@ -43,14 +45,25 @@ const DomandaBeneficiario = () => {
|
||||
navigate(`/domande`);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const parsedId = parseInt(id);
|
||||
const entityId = !isNaN(parsedId) ? parsedId : 0;
|
||||
|
||||
AmendmentsService.getSoccorsoByApplId(entityId, getCallback, errGetCallback, [
|
||||
['statuses', 'AWAITING']
|
||||
]);
|
||||
}, [id]);
|
||||
|
||||
const getCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
if (data.data.length) {
|
||||
setData(getFormattedData(data.data[0]));
|
||||
CommunicationService.getCommsByAmendmentId(data.data[0].id, getCommsCallback, errGetCommsCallback);
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
} else {
|
||||
ApplicationService.getApplication(id, getApplCallback, errGetCallback)
|
||||
}
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
const errGetCallback = (data) => {
|
||||
@@ -65,6 +78,13 @@ const DomandaBeneficiario = () => {
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
const getApplCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
setDataAppl(getFormattedData(data.data));
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
const getCommsCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
setComms(data.data.commentsList.map(o => getFormattedCommsData(o)));
|
||||
@@ -85,6 +105,7 @@ const DomandaBeneficiario = () => {
|
||||
}
|
||||
|
||||
const getFormattedData = (data) => {
|
||||
data.submissionDate = is(String, data.submissionDate) ? new Date(data.submissionDate) : (data.submissionDate ? data.submissionDate : '');
|
||||
data.startDate = is(String, data.startDate) ? new Date(data.startDate) : (data.startDate ? data.startDate : '');
|
||||
data.expirationDate = is(String, data.expirationDate) ? new Date(data.expirationDate) : (data.expirationDate ? data.expirationDate : '');
|
||||
return data;
|
||||
@@ -165,19 +186,17 @@ const DomandaBeneficiario = () => {
|
||||
setIsLoadingCommunication(false);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const parsedId = parseInt(id);
|
||||
const entityId = !isNaN(parsedId) ? parsedId : 0;
|
||||
|
||||
AmendmentsService.getSoccorsoByApplId(entityId, getCallback, errGetCallback, [
|
||||
['statuses', 'AWAITING']
|
||||
]);
|
||||
}, [id]);
|
||||
|
||||
return (
|
||||
<div className="appPage">
|
||||
<div className="appPage__pageHeader">
|
||||
<h1>{sprintf(__('Soccorso Istruttorio: richiesta integrazione documenti per domanda #%s', 'gepafin'), id)}</h1>
|
||||
{data.id
|
||||
? <h1>
|
||||
{sprintf(__('Soccorso Istruttorio: richiesta integrazione documenti per domanda #%s', 'gepafin'), id)}
|
||||
</h1> : null}
|
||||
{dataAppl.id
|
||||
? <h1>
|
||||
{sprintf(__('Dettagli: domanda #%s', 'gepafin'), dataAppl.id)}
|
||||
</h1> : null}
|
||||
</div>
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
@@ -196,7 +215,8 @@ const DomandaBeneficiario = () => {
|
||||
<div className="appPage__spacer"></div>
|
||||
|
||||
<div className="appPage__content">
|
||||
<div className="appPageSection__withBorder columns">
|
||||
{data.id
|
||||
? <div className="appPageSection__withBorder columns">
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('ID domanda', 'gepafin')}</span>
|
||||
<span>{data.applicationId}</span>
|
||||
@@ -221,9 +241,37 @@ const DomandaBeneficiario = () => {
|
||||
<span>{__('Stato', 'gepafin')}</span>
|
||||
<span>{getBandoLabel(data.status)}</span>
|
||||
</p>
|
||||
</div>
|
||||
</div> : null}
|
||||
{dataAppl.id
|
||||
? <div className="appPageSection__withBorder columns">
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('ID domanda', 'gepafin')}</span>
|
||||
<span>{dataAppl.id}</span>
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Bando', 'gepafin')}</span>
|
||||
<span>{dataAppl.callTitle}</span>
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Azienda', 'gepafin')}</span>
|
||||
<span>{dataAppl.companyName}</span>
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Inviato', 'gepafin')}</span>
|
||||
<span>{getDateFromISOstring(dataAppl.submissionDate)}</span>
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Protocolo', 'gepafin')}</span>
|
||||
<span>{dataAppl.protocolNumber}</span>
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Stato', 'gepafin')}</span>
|
||||
<span>{getBandoLabel(dataAppl.status)}</span>
|
||||
</p>
|
||||
</div> : null}
|
||||
|
||||
<div className="appPageSection">
|
||||
{data.id
|
||||
? <div className="appPageSection">
|
||||
<h2>{__('Dettagli Richiesta', 'gepafin')}</h2>
|
||||
<h3>{__('Documenti Richiesti', 'gepafin')}</h3>
|
||||
<ol className="appPageSection__list">
|
||||
@@ -233,17 +281,19 @@ const DomandaBeneficiario = () => {
|
||||
<span>{o.label}</span>
|
||||
</li>) : null}
|
||||
</ol>
|
||||
</div>
|
||||
</div> : null}
|
||||
|
||||
<div className="appPageSection">
|
||||
{data.id
|
||||
? <div className="appPageSection">
|
||||
<h3>{__('Note e spiegazioni', 'gepafin')}</h3>
|
||||
<div className="appPageSection__withBorder grey ql-editor"
|
||||
style={{ minHeight: '200px' }}>
|
||||
{renderHtmlContent(data.note)}
|
||||
</div>
|
||||
</div>
|
||||
</div> : null}
|
||||
|
||||
<div className="appPageSection">
|
||||
{data.id
|
||||
? <div className="appPageSection">
|
||||
<h2>{__('Comunicazioni', 'gepafin')}</h2>
|
||||
<table className="myTable">
|
||||
<thead className="myThead">
|
||||
@@ -277,22 +327,24 @@ const DomandaBeneficiario = () => {
|
||||
type="button"
|
||||
label={__('Aggiungi Comunicazione', 'gepafin')}
|
||||
icon="pi pi-plus" iconPos="right"/>
|
||||
</div>
|
||||
</div> : null}
|
||||
|
||||
<div className="appPageSection__message warning">
|
||||
{data.id
|
||||
? <div className="appPageSection__message warning">
|
||||
<i className="pi pi-exclamation-triangle"></i>
|
||||
<span className="summary">{__('Attenzione', 'gepafin')}</span>
|
||||
<span>{__('Inviare la documentazione richiesta completa delle integrazioni esclusivamente via PEC. In caso contarrio l’integrazione non può essere ritenuta valida.', 'gepafin')}</span>
|
||||
</div>
|
||||
</div> : null}
|
||||
|
||||
<div className="appPageSection">
|
||||
<div className="appPageSection__actions">
|
||||
<Button
|
||||
{data.id
|
||||
? <Button
|
||||
type="button"
|
||||
disabled={isAsyncRequest}
|
||||
onClick={() => setIsVisibleEmailDialog(true)}
|
||||
label={__('Invia documenti via PEC', 'gepafin')}
|
||||
icon="pi pi-envelope" iconPos="right"/>
|
||||
icon="pi pi-envelope" iconPos="right"/> : null}
|
||||
<Button
|
||||
type="button"
|
||||
outlined
|
||||
|
||||
@@ -122,6 +122,7 @@ const DomandaEditPreInstructor = () => {
|
||||
|
||||
const updateCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
setData(getFormattedData(data.data));
|
||||
if (toast.current) {
|
||||
toast.current.show({
|
||||
severity: 'success',
|
||||
@@ -198,28 +199,32 @@ const DomandaEditPreInstructor = () => {
|
||||
const criteriaDataItem = (item) => {
|
||||
let content = '';
|
||||
|
||||
if (is(String, item.fieldValue)) {
|
||||
content = item.fieldValue;
|
||||
} else if (item.fieldValue && item.fieldValue.length && !isNil(item.fieldValue[0].filePath)) {
|
||||
content = <ul>
|
||||
{item.fieldValue.map(o => <li key={o.id}>
|
||||
{o.filePath ? <a href={o.filePath}>{o.name}</a> : null}
|
||||
</li>)}
|
||||
</ul>;
|
||||
} else if (item.fieldValue && item.fieldValue.length && isNil(item.fieldValue[0].filePath)) {
|
||||
const th = Object.keys(item.fieldValue[0]);
|
||||
content = <table>
|
||||
<thead>
|
||||
<tr>
|
||||
{th.map(v => <th key={v}>{v}</th>)}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{item.fieldValue.map((o, i) => <tr key={i}>
|
||||
{Object.values(o).map(v => <td key={v}>{v}</td>)}
|
||||
</tr>)}
|
||||
</tbody>
|
||||
</table>;
|
||||
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>)}
|
||||
</ul>;
|
||||
break;
|
||||
case 'table' :
|
||||
const th = Object.keys(item.fieldValue[0]);
|
||||
content = <table>
|
||||
<thead>
|
||||
<tr>
|
||||
{th.map(v => <th key={v}>{v}</th>)}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{item.fieldValue.map((o, i) => <tr key={i}>
|
||||
{Object.values(o).map(v => <td key={v}>{v}</td>)}
|
||||
</tr>)}
|
||||
</tbody>
|
||||
</table>;
|
||||
break;
|
||||
default :
|
||||
content = item.fieldValue;
|
||||
break;
|
||||
}
|
||||
|
||||
return <div key={item.id} className="criterionRelatedData__item">
|
||||
@@ -312,7 +317,7 @@ const DomandaEditPreInstructor = () => {
|
||||
</p>
|
||||
<p className="appPageSection__pMeta">
|
||||
<span>{__('Stato', 'gepafin')}</span>
|
||||
<span>{getBandoLabel(data.applicationStatus)}</span>
|
||||
<span>{getBandoLabel(data.status)}</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -333,6 +338,7 @@ const DomandaEditPreInstructor = () => {
|
||||
<td>
|
||||
<div className="p-inputgroup">
|
||||
<InputNumber
|
||||
disabled={data.status === 'CLOSE'}
|
||||
placeholder={__('Punteggio', 'gepafin')}
|
||||
keyfilter="int"
|
||||
value={o.score}
|
||||
@@ -355,6 +361,7 @@ const DomandaEditPreInstructor = () => {
|
||||
onClick={() => displayCriterionData(o.id)}
|
||||
aria-label={__('Mostra', 'gepafin')}/> : null}
|
||||
<Button icon="pi pi-thumbs-up" rounded outlined
|
||||
disabled={data.status === 'CLOSE'}
|
||||
severity={!isNil(o.valid) && o.valid ? 'success' : 'secondary'}
|
||||
onClick={() => updateEvaluationValue(
|
||||
true,
|
||||
@@ -362,6 +369,7 @@ const DomandaEditPreInstructor = () => {
|
||||
)}
|
||||
aria-label={__('Su', 'gepafin')}/>
|
||||
<Button icon="pi pi-thumbs-down" rounded outlined
|
||||
disabled={data.status === 'CLOSE'}
|
||||
severity={!isNil(o.valid) && !o.valid ? 'danger' : 'secondary'}
|
||||
onClick={() => updateEvaluationValue(
|
||||
false,
|
||||
@@ -402,6 +410,7 @@ const DomandaEditPreInstructor = () => {
|
||||
<div className="appPageSection__checklist">
|
||||
{data.checklist.map((o, i) => <div key={o.id}>
|
||||
<Checkbox
|
||||
disabled={data.status === 'CLOSE'}
|
||||
inputId={`checklist_${o.id}`}
|
||||
onChange={(e) => updateEvaluationValue(
|
||||
e.checked,
|
||||
@@ -417,6 +426,7 @@ const DomandaEditPreInstructor = () => {
|
||||
<div>
|
||||
<Editor
|
||||
value={data.note}
|
||||
readOnly={data.status === 'CLOSE'}
|
||||
placeholder={__('Digita qui il messagio', 'gepafin')}
|
||||
headerTemplate={header}
|
||||
onTextChange={(e) => updateEvaluationValue(
|
||||
@@ -444,6 +454,7 @@ const DomandaEditPreInstructor = () => {
|
||||
outlined severity="info"
|
||||
aria-label={__('Mostra', 'gepafin')}/> : null}
|
||||
<Button icon="pi pi-thumbs-up" rounded outlined
|
||||
disabled={data.status === 'CLOSE'}
|
||||
severity={!isNil(o.valid) && o.valid ? 'success' : 'secondary'}
|
||||
onClick={() => updateEvaluationValue(
|
||||
true,
|
||||
@@ -451,6 +462,7 @@ const DomandaEditPreInstructor = () => {
|
||||
)}
|
||||
aria-label={__('Su', 'gepafin')}/>
|
||||
<Button icon="pi pi-thumbs-down" rounded outlined
|
||||
disabled={data.status === 'CLOSE'}
|
||||
severity={!isNil(o.valid) && !o.valid ? 'danger' : 'secondary'}
|
||||
onClick={() => updateEvaluationValue(
|
||||
false,
|
||||
@@ -499,7 +511,7 @@ const DomandaEditPreInstructor = () => {
|
||||
<div className="appPageSection__actions">
|
||||
<Button
|
||||
type="button"
|
||||
disabled={!data.id}
|
||||
disabled={!data.id || data.status === 'CLOSE'}
|
||||
onClick={doNewSoccorso}
|
||||
outlined
|
||||
label={<>
|
||||
@@ -512,6 +524,7 @@ const DomandaEditPreInstructor = () => {
|
||||
{data.id
|
||||
? <Button
|
||||
type="button"
|
||||
disabled={data.status === 'CLOSE'}
|
||||
onClick={doSaveDraft}
|
||||
outlined
|
||||
label={__('Salva bozza valutazione', 'gepafin')}
|
||||
@@ -524,13 +537,14 @@ const DomandaEditPreInstructor = () => {
|
||||
{data.id
|
||||
? <Button
|
||||
type="button"
|
||||
disabled={!isAdmissible}
|
||||
disabled={!isAdmissible || data.status === 'CLOSE'}
|
||||
onClick={doApprove}
|
||||
label={__('Approva Domanda', 'gepafin')}
|
||||
icon="pi pi-check" iconPos="right"/> : null}
|
||||
{data.id
|
||||
? <Button
|
||||
type="button"
|
||||
disabled={data.status === 'CLOSE'}
|
||||
onClick={doReject}
|
||||
label={__('Respingi Domanda', 'gepafin')}
|
||||
icon="pi pi-times" iconPos="right"/> : null}
|
||||
|
||||
@@ -26,8 +26,6 @@ import FileuploadDelega from '../../components/FileuploadDelega';
|
||||
import { Toast } from 'primereact/toast';
|
||||
import getFormatedFileSizeText from '../../helpers/getFormatedFileSizeText';
|
||||
import { defaultMaxFileSize } from '../../configData';
|
||||
import { classNames } from 'primereact/utils';
|
||||
import { Dropdown } from 'primereact/dropdown';
|
||||
import { Dialog } from 'primereact/dialog';
|
||||
import { confirmPopup, ConfirmPopup } from 'primereact/confirmpopup';
|
||||
|
||||
@@ -219,15 +217,6 @@ const ProfileCompany = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const footerRemoveDialog = () => {
|
||||
return <div>
|
||||
<Button type="button" label={__('No', 'gepafin')} onClick={hideRemoveDialog} outlined/>
|
||||
<Button
|
||||
type="button"
|
||||
label={__('Si', 'gepafin')} onClick={doRemoveCompany}/>
|
||||
</div>
|
||||
}
|
||||
|
||||
const headerRemoveDialog = () => {
|
||||
return <span>{__('Rimuovi azienda', 'gepafin')}</span>
|
||||
}
|
||||
|
||||
@@ -22,12 +22,14 @@ import { InputNumber } from 'primereact/inputnumber';
|
||||
import BlockingOverlay from '../../components/BlockingOverlay';
|
||||
import { Toast } from 'primereact/toast';
|
||||
import { InputSwitch } from 'primereact/inputswitch';
|
||||
import ApplicationEvaluationService from '../../service/application-evaluation-service';
|
||||
|
||||
const SoccorsoEditPreInstructor = () => {
|
||||
const SoccorsoAddPreInstructor = () => {
|
||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||
const { id, evaluationId } = useParams();
|
||||
const { id } = useParams();
|
||||
const navigate = useNavigate();
|
||||
const [data, setData] = useState({});
|
||||
const [evaluationId, setEvaluationId] = useState(0);
|
||||
const [formData, setFormData] = useState({});
|
||||
const toast = useRef(null);
|
||||
|
||||
@@ -35,9 +37,25 @@ const SoccorsoEditPreInstructor = () => {
|
||||
navigate(`/domande/${id}`);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const parsed = parseInt(id)
|
||||
const entityId = !isNaN(parsed) ? parsed : 0;
|
||||
|
||||
storeSet.main.setAsyncRequest();
|
||||
ApplicationEvaluationService.getEvaluationByApplId(getCallbackEvaluation, errGetCallback, [
|
||||
['applicationId', entityId]
|
||||
]);
|
||||
}, [id]);
|
||||
|
||||
const getCallbackEvaluation = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
setEvaluationId(data.data.assignedApplicationId);
|
||||
AmendmentsService.getSoccorsoByApplEvalId(data.data.assignedApplicationId, getCallback, errGetCallback)
|
||||
}
|
||||
}
|
||||
|
||||
const getCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
console.log(data.data)
|
||||
setData(data.data);
|
||||
setFormData(getFormattedFormData(data.data));
|
||||
}
|
||||
@@ -134,14 +152,6 @@ const SoccorsoEditPreInstructor = () => {
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const parsed = parseInt(evaluationId)
|
||||
const entityId = !isNaN(parsed) ? parsed : 0;
|
||||
|
||||
storeSet.main.setAsyncRequest();
|
||||
AmendmentsService.getSoccorsoByApplEvalId(entityId, getCallback, errGetCallback);
|
||||
}, [evaluationId]);
|
||||
|
||||
return (
|
||||
<div className="appPage">
|
||||
<div className="appPage__pageHeader">
|
||||
@@ -297,4 +307,4 @@ const SoccorsoEditPreInstructor = () => {
|
||||
|
||||
}
|
||||
|
||||
export default SoccorsoEditPreInstructor;
|
||||
export default SoccorsoAddPreInstructor;
|
||||
Reference in New Issue
Block a user