- added uploading files for evaluation;
- added uploading files for amendment for instructor; (need more tests)
This commit is contained in:
@@ -113,7 +113,7 @@ const SoccorsoEditPreInstructor = () => {
|
||||
const header = renderHeader();
|
||||
|
||||
const updateNewAmendmentData = (value, path) => {
|
||||
const newData = wrap(data).set(path.split('.'), value).value();
|
||||
const newData = wrap(data).set(path, value).value();
|
||||
setData(newData);
|
||||
}
|
||||
|
||||
@@ -136,10 +136,22 @@ const SoccorsoEditPreInstructor = () => {
|
||||
});
|
||||
return acc;
|
||||
}, []);
|
||||
const newAmendDocs = data.amendmentDocuments
|
||||
.reduce((acc, cur) => {
|
||||
const newObj = {
|
||||
...klona(cur),
|
||||
fileValue: cur.fileValue[0] ? cur.fileValue[0].id : ''
|
||||
}
|
||||
|
||||
acc.push(newObj);
|
||||
return acc;
|
||||
}, []);
|
||||
|
||||
const submitData = {
|
||||
applicationFormFields: newFormValues
|
||||
applicationFormFields: newFormValues,
|
||||
amendmentDocuments: newAmendDocs
|
||||
}
|
||||
|
||||
storeSet.main.setAsyncRequest();
|
||||
AmendmentsService.updateSoccorso(amendmentId, submitData, updateAmendmentCallback, errUpdateAmendmentCallback);
|
||||
}
|
||||
@@ -177,6 +189,7 @@ const SoccorsoEditPreInstructor = () => {
|
||||
}
|
||||
|
||||
const doCloseAmendment = () => {
|
||||
doUpdateAmendment();
|
||||
const submitData = {
|
||||
internalNote: data.internalNote
|
||||
}
|
||||
@@ -194,7 +207,7 @@ const SoccorsoEditPreInstructor = () => {
|
||||
});
|
||||
}
|
||||
if (data.data.status) {
|
||||
updateNewAmendmentData(data.data.status, 'status')
|
||||
updateNewAmendmentData(data.data.status, ['status'])
|
||||
}
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
@@ -311,6 +324,10 @@ const SoccorsoEditPreInstructor = () => {
|
||||
AmendmentsService.getSoccorsoById(getCallback, errGetCallback, [['id', soccorsoEntityId]]);
|
||||
}, [amendmentId]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log(data);
|
||||
}, [data]);
|
||||
|
||||
return (
|
||||
<div className="appPage">
|
||||
<div className="appPage__pageHeader">
|
||||
@@ -389,17 +406,12 @@ const SoccorsoEditPreInstructor = () => {
|
||||
<SoccorsoComunications amendmentId={amendmentId} soccorsoStatus={data.status}/>
|
||||
</div>
|
||||
|
||||
<div className="appPageSection">
|
||||
<h2>{__('Documenti ricevuti', 'gepafin')}</h2>
|
||||
<RepeaterFields sourceId={id} sourceName="evaluation"/>
|
||||
</div>
|
||||
{data.formFields && !isEmpty(data.formFields)
|
||||
? <div className="appPageSection">
|
||||
<h2>{__('Documenti Ricevuti', 'gepafin')}</h2>
|
||||
|
||||
<div className="appPageSection">
|
||||
<h2>{__('Documenti Ricevuti', 'gepafin')}</h2>
|
||||
|
||||
<form className="appForm" onSubmit={handleSubmit(onSubmit)}>
|
||||
{data.formFields
|
||||
? data.formFields.map((o, i) => {
|
||||
<form className="appForm" onSubmit={handleSubmit(onSubmit)}>
|
||||
{data.formFields.map((o, i) => {
|
||||
return <FormField
|
||||
key={o.fieldId}
|
||||
disabled={data.status === 'CLOSE'}
|
||||
@@ -417,8 +429,20 @@ const SoccorsoEditPreInstructor = () => {
|
||||
sourceId={data.applicationId}
|
||||
multiple={true}
|
||||
/>
|
||||
}) : null}
|
||||
</form>
|
||||
})}
|
||||
</form>
|
||||
</div> : null}
|
||||
|
||||
<div className="appPageSection">
|
||||
<h2>{__('Documenti aggiuntivi', 'gepafin')}</h2>
|
||||
<RepeaterFields
|
||||
defaultValue={data.amendmentDocuments ?? []}
|
||||
updateFn={(data) => updateNewAmendmentData(
|
||||
data,
|
||||
['amendmentDocuments']
|
||||
)}
|
||||
sourceId={amendmentId}
|
||||
sourceName="AMENDMENT"/>
|
||||
</div>
|
||||
|
||||
<div className="appForm__field">
|
||||
@@ -432,7 +456,7 @@ const SoccorsoEditPreInstructor = () => {
|
||||
headerTemplate={header}
|
||||
onTextChange={(e) => updateNewAmendmentData(
|
||||
e.htmlValue,
|
||||
'internalNote'
|
||||
['internalNote']
|
||||
)}
|
||||
style={{ height: 80 * 3, width: '100%' }}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user