diff --git a/src/pages/DomandaEditPreInstructor/components/ArchiveDocument/index.js b/src/pages/DomandaEditPreInstructor/components/ArchiveDocument/index.js
index 094d468..b50c321 100644
--- a/src/pages/DomandaEditPreInstructor/components/ArchiveDocument/index.js
+++ b/src/pages/DomandaEditPreInstructor/components/ArchiveDocument/index.js
@@ -80,8 +80,8 @@ const ArchiveDocument = ({ applicationId, ndg = '', fileId = 0 }) => {
}
}
}
- console.log('submitData', submitData);
- //AppointmentService.archiveDocument(applicationId, fileId, submitData, submitCallback, errSubmitCallback)
+
+ AppointmentService.archiveDocument(applicationId, fileId, submitData, submitCallback, errSubmitCallback)
}
}
diff --git a/src/pages/DomandaEditPreInstructor/components/ListOfFiles/index.js b/src/pages/DomandaEditPreInstructor/components/ListOfFiles/index.js
new file mode 100644
index 0000000..80f5a85
--- /dev/null
+++ b/src/pages/DomandaEditPreInstructor/components/ListOfFiles/index.js
@@ -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 (
+
+ {files.map((o, i) => -
+
+
{o.label}
+
+ {o.fileDetail && o.fileDetail.length === 1
+ ?
+
+ {o.fileDetail && o.fileDetail.length > 1
+ ?
+ {o.fileDetail.map((k) => -
+ {k.name}
+
+
+ {
+ window.open(k.filePath, '_blank').focus()
+ }}
+ outlined severity="info"
+ aria-label={__('Mostra', 'gepafin')}/>
+
+ )}
+
+ : null}
+ )}
+
+ )
+}
+
+export default ListOfFiles;
diff --git a/src/pages/DomandaEditPreInstructor/index.js b/src/pages/DomandaEditPreInstructor/index.js
index 2bd14cb..f9b5d75 100644
--- a/src/pages/DomandaEditPreInstructor/index.js
+++ b/src/pages/DomandaEditPreInstructor/index.js
@@ -36,6 +36,7 @@ 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;
@@ -140,15 +141,14 @@ const DomandaEditPreInstructor = () => {
const header = renderHeader();
- const updateEvaluationValue = (value, path, maxValue) => {
- const pathEls = path.split('.');
+ const updateEvaluationValue = (value, path, maxValue = null) => {
let finalValue = value;
if (maxValue || maxValue === 0) {
finalValue = value > maxValue ? maxValue : value;
}
- const newData = wrap(data).set(pathEls, finalValue).value();
+ const newData = wrap(data).set(path, finalValue).value();
setData(newData);
updateFlagsForSoccorso(newData);
}
@@ -548,7 +548,7 @@ const DomandaEditPreInstructor = () => {
inputId={`checklist_${o.id}`}
onChange={(e) => updateEvaluationValue(
e.checked,
- `checklist.${i}.valid`
+ ['checklist', i, 'valid']
)}
checked={o.valid}>
@@ -565,7 +565,7 @@ const DomandaEditPreInstructor = () => {
headerTemplate={header}
onTextChange={(e) => updateEvaluationValue(
e.htmlValue,
- 'note'
+ ['note']
)}
style={{ height: 80 * 3, width: '100%' }}
/>
@@ -573,65 +573,13 @@ const DomandaEditPreInstructor = () => {
{__('Documenti allegati', 'gepafin')}
-
- {data.files.map((o, i) => -
-
-
{o.label}
-
- {o.fileDetail && o.fileDetail.length === 1
- ? {
- window.open(o.fileDetail[0].filePath, '_blank').focus()
- }}
- outlined severity="info"
- aria-label={__('Mostra', 'gepafin')}/> : null}
- updateEvaluationValue(
- true,
- `files.${i}.valid`
- )}
- aria-label={__('Su', 'gepafin')}/>
- updateEvaluationValue(
- false,
- `files.${i}.valid`
- )}
- aria-label={__('Giu', 'gepafin')}/>
-
-
- {o.fileDetail && o.fileDetail.length > 1
- ?
- {o.fileDetail.map((k, i) => -
- {k.name}
-
-
- {
- window.open(k.filePath, '_blank').focus()
- }}
- outlined severity="info"
- aria-label={__('Mostra', 'gepafin')}/>
-
- )}
-
- : null}
- )}
-
+
@@ -660,8 +608,8 @@ const DomandaEditPreInstructor = () => {
max={o.maxScore}
onChange={(e) => updateEvaluationValue(
e.value,
- `criteria.${i}.score`,
- o.maxScore
+ ['criteria', i, 'score'],
+ o.criteria
)}/>
/ {o.maxScore}
@@ -680,7 +628,7 @@ const DomandaEditPreInstructor = () => {
severity={!isNil(o.valid) && o.valid ? 'success' : 'secondary'}
onClick={() => updateEvaluationValue(
true,
- `criteria.${i}.valid`
+ ['criteria', i, 'valid']
)}
aria-label={__('Su', 'gepafin')}/>
{
severity={!isNil(o.valid) && !o.valid ? 'danger' : 'secondary'}
onClick={() => updateEvaluationValue(
false,
- `criteria.${i}.valid`
+ ['criteria', i, 'valid']
)}
aria-label={__('Giu', 'gepafin')}/>
diff --git a/src/pages/Login/index.js b/src/pages/Login/index.js
index eacfec4..be260a1 100644
--- a/src/pages/Login/index.js
+++ b/src/pages/Login/index.js
@@ -3,6 +3,7 @@ import { __, sprintf } from '@wordpress/i18n';
import { classNames } from 'primereact/utils';
import { isEmpty, isNil } from 'ramda';
import hotkeys from 'hotkeys-js';
+import { useSearchParams } from 'react-router-dom';
// store
import { storeSet, useStore } from '../../store';
@@ -13,7 +14,6 @@ import AuthenticationService from '../../service/authentication-service';
// components
import LogoIcon from '../../icons/LogoIcon';
import { Messages } from 'primereact/messages';
-import { useSearchParams } from 'react-router-dom';
import { Dialog } from 'primereact/dialog';
import { Accordion } from 'primereact/accordion';
import { AccordionTab } from 'primereact/accordion';
@@ -98,7 +98,9 @@ const Login = () => {
}, [isMaintenance])
useEffect(() => {
- if (!isEmpty(token)) {
+ const queryParams = Object.fromEntries(searchParams);
+
+ if (!isEmpty(token) && isNil(queryParams.redirectReason)) {
window.location.replace('/')
}
}, [token]);