- fiexed redirection to login error;
- refactored the code;
This commit is contained in:
@@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -36,6 +36,7 @@ import DownloadApplicationArchive from './components/DownloadApplicationArchive'
|
|||||||
import DownloadCompanyDelegation from './components/DownloadCompanyDelegation';
|
import DownloadCompanyDelegation from './components/DownloadCompanyDelegation';
|
||||||
import DownloadSignedApplication from './components/DownloadSignedApplication';
|
import DownloadSignedApplication from './components/DownloadSignedApplication';
|
||||||
import AppointmentService from '../../service/appointment-service';
|
import AppointmentService from '../../service/appointment-service';
|
||||||
|
import ListOfFiles from './components/ListOfFiles';
|
||||||
|
|
||||||
const APP_EVALUATION_FLOW_ID = process.env.REACT_APP_EVALUATION_FLOW_ID;
|
const APP_EVALUATION_FLOW_ID = process.env.REACT_APP_EVALUATION_FLOW_ID;
|
||||||
|
|
||||||
@@ -140,15 +141,14 @@ const DomandaEditPreInstructor = () => {
|
|||||||
|
|
||||||
const header = renderHeader();
|
const header = renderHeader();
|
||||||
|
|
||||||
const updateEvaluationValue = (value, path, maxValue) => {
|
const updateEvaluationValue = (value, path, maxValue = null) => {
|
||||||
const pathEls = path.split('.');
|
|
||||||
let finalValue = value;
|
let finalValue = value;
|
||||||
|
|
||||||
if (maxValue || maxValue === 0) {
|
if (maxValue || maxValue === 0) {
|
||||||
finalValue = value > maxValue ? maxValue : value;
|
finalValue = value > maxValue ? maxValue : value;
|
||||||
}
|
}
|
||||||
|
|
||||||
const newData = wrap(data).set(pathEls, finalValue).value();
|
const newData = wrap(data).set(path, finalValue).value();
|
||||||
setData(newData);
|
setData(newData);
|
||||||
updateFlagsForSoccorso(newData);
|
updateFlagsForSoccorso(newData);
|
||||||
}
|
}
|
||||||
@@ -548,7 +548,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
inputId={`checklist_${o.id}`}
|
inputId={`checklist_${o.id}`}
|
||||||
onChange={(e) => updateEvaluationValue(
|
onChange={(e) => updateEvaluationValue(
|
||||||
e.checked,
|
e.checked,
|
||||||
`checklist.${i}.valid`
|
['checklist', i, 'valid']
|
||||||
)}
|
)}
|
||||||
checked={o.valid}></Checkbox>
|
checked={o.valid}></Checkbox>
|
||||||
<label htmlFor={`checklist_${o.id}`}>{o.label}</label>
|
<label htmlFor={`checklist_${o.id}`}>{o.label}</label>
|
||||||
@@ -565,7 +565,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
headerTemplate={header}
|
headerTemplate={header}
|
||||||
onTextChange={(e) => updateEvaluationValue(
|
onTextChange={(e) => updateEvaluationValue(
|
||||||
e.htmlValue,
|
e.htmlValue,
|
||||||
'note'
|
['note']
|
||||||
)}
|
)}
|
||||||
style={{ height: 80 * 3, width: '100%' }}
|
style={{ height: 80 * 3, width: '100%' }}
|
||||||
/>
|
/>
|
||||||
@@ -573,65 +573,13 @@ const DomandaEditPreInstructor = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h3>{__('Documenti allegati', 'gepafin')}</h3>
|
<h3>{__('Documenti allegati', 'gepafin')}</h3>
|
||||||
<ol className="appPageSection__list">
|
<ListOfFiles
|
||||||
{data.files.map((o, i) => <li key={o.id} className="appPageSection__listItem">
|
files={data.files}
|
||||||
<div className="appPageSection__listItemRow">
|
updateFn={updateEvaluationValue}
|
||||||
<span>{o.label}</span>
|
shouldDisableFieldFn={shouldDisableField}
|
||||||
<div className="appPageSection__iconActions">
|
name="files"
|
||||||
{o.fileDetail && o.fileDetail.length === 1
|
ndg={data.ndg}
|
||||||
? <Button icon="pi pi-eye" rounded
|
applicationId={id}/>
|
||||||
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} applicationId={id} 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>
|
||||||
</div>
|
</div>
|
||||||
@@ -660,8 +608,8 @@ const DomandaEditPreInstructor = () => {
|
|||||||
max={o.maxScore}
|
max={o.maxScore}
|
||||||
onChange={(e) => updateEvaluationValue(
|
onChange={(e) => updateEvaluationValue(
|
||||||
e.value,
|
e.value,
|
||||||
`criteria.${i}.score`,
|
['criteria', i, 'score'],
|
||||||
o.maxScore
|
o.criteria
|
||||||
)}/>
|
)}/>
|
||||||
<span className="p-inputgroup-addon">
|
<span className="p-inputgroup-addon">
|
||||||
/ {o.maxScore}
|
/ {o.maxScore}
|
||||||
@@ -680,7 +628,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
severity={!isNil(o.valid) && o.valid ? 'success' : 'secondary'}
|
severity={!isNil(o.valid) && o.valid ? 'success' : 'secondary'}
|
||||||
onClick={() => updateEvaluationValue(
|
onClick={() => updateEvaluationValue(
|
||||||
true,
|
true,
|
||||||
`criteria.${i}.valid`
|
['criteria', i, 'valid']
|
||||||
)}
|
)}
|
||||||
aria-label={__('Su', 'gepafin')}/>
|
aria-label={__('Su', 'gepafin')}/>
|
||||||
<Button icon="pi pi-thumbs-down" rounded outlined
|
<Button icon="pi pi-thumbs-down" rounded outlined
|
||||||
@@ -688,7 +636,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
severity={!isNil(o.valid) && !o.valid ? 'danger' : 'secondary'}
|
severity={!isNil(o.valid) && !o.valid ? 'danger' : 'secondary'}
|
||||||
onClick={() => updateEvaluationValue(
|
onClick={() => updateEvaluationValue(
|
||||||
false,
|
false,
|
||||||
`criteria.${i}.valid`
|
['criteria', i, 'valid']
|
||||||
)}
|
)}
|
||||||
aria-label={__('Giu', 'gepafin')}/>
|
aria-label={__('Giu', 'gepafin')}/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { __, sprintf } from '@wordpress/i18n';
|
|||||||
import { classNames } from 'primereact/utils';
|
import { classNames } from 'primereact/utils';
|
||||||
import { isEmpty, isNil } from 'ramda';
|
import { isEmpty, isNil } from 'ramda';
|
||||||
import hotkeys from 'hotkeys-js';
|
import hotkeys from 'hotkeys-js';
|
||||||
|
import { useSearchParams } from 'react-router-dom';
|
||||||
|
|
||||||
// store
|
// store
|
||||||
import { storeSet, useStore } from '../../store';
|
import { storeSet, useStore } from '../../store';
|
||||||
@@ -13,7 +14,6 @@ import AuthenticationService from '../../service/authentication-service';
|
|||||||
// components
|
// components
|
||||||
import LogoIcon from '../../icons/LogoIcon';
|
import LogoIcon from '../../icons/LogoIcon';
|
||||||
import { Messages } from 'primereact/messages';
|
import { Messages } from 'primereact/messages';
|
||||||
import { useSearchParams } from 'react-router-dom';
|
|
||||||
import { Dialog } from 'primereact/dialog';
|
import { Dialog } from 'primereact/dialog';
|
||||||
import { Accordion } from 'primereact/accordion';
|
import { Accordion } from 'primereact/accordion';
|
||||||
import { AccordionTab } from 'primereact/accordion';
|
import { AccordionTab } from 'primereact/accordion';
|
||||||
@@ -98,7 +98,9 @@ const Login = () => {
|
|||||||
}, [isMaintenance])
|
}, [isMaintenance])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isEmpty(token)) {
|
const queryParams = Object.fromEntries(searchParams);
|
||||||
|
|
||||||
|
if (!isEmpty(token) && isNil(queryParams.redirectReason)) {
|
||||||
window.location.replace('/')
|
window.location.replace('/')
|
||||||
}
|
}
|
||||||
}, [token]);
|
}, [token]);
|
||||||
|
|||||||
Reference in New Issue
Block a user