Merge pull request #24 from Kitzanos/feature/91-instructor-manager-role

Feature/91 instructor manager role
This commit is contained in:
Vitalii Kiiko
2024-12-20 17:11:13 +01:00
committed by GitHub
17 changed files with 386 additions and 116 deletions

View File

@@ -29,6 +29,9 @@ const getBandoLabel = (status) => {
case 'ADMISSIBLE': case 'ADMISSIBLE':
return __('Ammisibile', 'gepafin'); return __('Ammisibile', 'gepafin');
case 'RESPONSE_RECEIVED':
return __('Riposta ricevuta', 'gepafin');
case 'SOCCORSO': case 'SOCCORSO':
return __('Soccorso', 'gepafin'); return __('Soccorso', 'gepafin');

View File

@@ -27,6 +27,9 @@ const getBandoSeverity = (status) => {
case 'ADMISSIBLE': case 'ADMISSIBLE':
return 'info'; return 'info';
case 'RESPONSE_RECEIVED':
return 'warning';
case 'SOCCORSO': case 'SOCCORSO':
return 'warning'; return 'warning';

View File

@@ -4,7 +4,7 @@ import { useNavigate } from 'react-router-dom';
import { head } from 'ramda'; import { head } from 'ramda';
// store // store
import { storeGet, useStore } from '../../store'; import { useStore } from '../../store';
// components // components
import MyLatestSubmissionsTable from '../DashboardBeneficiario/components/MyLatestSubmissionsTable'; import MyLatestSubmissionsTable from '../DashboardBeneficiario/components/MyLatestSubmissionsTable';

View File

@@ -42,7 +42,7 @@ const DraftApplicationsTable = () => {
if (data.status === 'SUCCESS') { if (data.status === 'SUCCESS') {
if (is(Array, data.data)) { if (is(Array, data.data)) {
setItems(getFormattedBandiData(data.data)); setItems(getFormattedBandiData(data.data));
setStatuses(uniq(items.map(o => o.status))) setStatuses(uniq(data.data.map(o => o.status)))
initFilters(); initFilters();
} }
} }

View File

@@ -19,6 +19,7 @@ const RepeaterFields = ({
updateCallbackFn = () => { updateCallbackFn = () => {
}, },
defaultValue = [], defaultValue = [],
shouldDisable = false
}) => { }) => {
const [chosen, setChosen] = useState(''); const [chosen, setChosen] = useState('');
const { const {
@@ -92,6 +93,7 @@ const RepeaterFields = ({
<div className="fieldsRepeater__heading p-panel p-panel-header"> <div className="fieldsRepeater__heading p-panel p-panel-header">
<span onClick={() => setNewChosen(o.fieldId)}>{o.nameValue}</span> <span onClick={() => setNewChosen(o.fieldId)}>{o.nameValue}</span>
<Button icon="pi pi-times" <Button icon="pi pi-times"
disabled={shouldDisable}
outlined outlined
severity="danger" severity="danger"
className="actionBtn" className="actionBtn"
@@ -102,6 +104,7 @@ const RepeaterFields = ({
<div className="fieldsRepeater__fields p-panel-content" data-hide={chosen !== o.fieldId}> <div className="fieldsRepeater__fields p-panel-content" data-hide={chosen !== o.fieldId}>
<FormField <FormField
type="textinput" type="textinput"
disabled={shouldDisable}
fieldName={`items.${index}.nameValue`} fieldName={`items.${index}.nameValue`}
label={__('Titolo del file', 'gepafin')} label={__('Titolo del file', 'gepafin')}
control={control} control={control}
@@ -111,7 +114,7 @@ const RepeaterFields = ({
/> />
<FormField <FormField
type="fileupload" type="fileupload"
disabled={isEmpty(o.nameValue)} disabled={isEmpty(o.nameValue) || shouldDisable}
setDataFn={setValue} setDataFn={setValue}
saveFormCallback={doUpdateAfterFileUploaded} saveFormCallback={doUpdateAfterFileUploaded}
fieldName={`items.${index}.fileValue`} fieldName={`items.${index}.fileValue`}
@@ -135,7 +138,7 @@ const RepeaterFields = ({
className="fieldsRepeater__addNew" className="fieldsRepeater__addNew"
outlined outlined
type="button" type="button"
disabled={watchFields && watchFields.filter(o => isEmpty(o.nameValue) || isEmpty(o.fileValue)).length > 0} disabled={watchFields && watchFields.filter(o => isEmpty(o.nameValue) || isEmpty(o.fileValue)).length > 0 || shouldDisable}
onClick={addNew} onClick={addNew}
label={__('Aggiungi nuovo file', 'gepafin')} label={__('Aggiungi nuovo file', 'gepafin')}
/> />

View File

@@ -226,6 +226,7 @@ const DomandaEditPreInstructor = () => {
motivation motivation
} }
setIsVisibleCompleteDialog(false);
ApplicationEvaluationService.updateEvaluation(data.assignedApplicationId, formData, updateStatusCallback, errUpdateStatusCallback); ApplicationEvaluationService.updateEvaluation(data.assignedApplicationId, formData, updateStatusCallback, errUpdateStatusCallback);
} }
@@ -239,11 +240,13 @@ const DomandaEditPreInstructor = () => {
motivation motivation
} }
setIsVisibleCompleteDialog(false);
ApplicationEvaluationService.updateEvaluation(data.assignedApplicationId, formData, updateStatusCallback, errUpdateStatusCallback); ApplicationEvaluationService.updateEvaluation(data.assignedApplicationId, formData, updateStatusCallback, errUpdateStatusCallback);
} }
const updateStatusCallback = (data) => { const updateStatusCallback = (data) => {
if (data.status === 'SUCCESS') { if (data.status === 'SUCCESS') {
setData(getFormattedData(data.data));
if (toast.current) { if (toast.current) {
toast.current.show({ toast.current.show({
severity: 'success', severity: 'success',
@@ -607,6 +610,7 @@ const DomandaEditPreInstructor = () => {
data, data,
['evaluationDocument'] ['evaluationDocument']
)} )}
shouldDisable={['APPROVED', 'REJECTED'].includes(data.applicationStatus)}
sourceId={data.assignedApplicationId} sourceId={data.assignedApplicationId}
sourceName="evaluation"/> sourceName="evaluation"/>
</div> </div>
@@ -762,7 +766,8 @@ const DomandaEditPreInstructor = () => {
{['EVALUATION', 'SOCCORSO', 'CLOSE'].includes(data.applicationStatus) {['EVALUATION', 'SOCCORSO', 'CLOSE'].includes(data.applicationStatus)
? <Button ? <Button
type="button" type="button"
disabled={!data.id || data.status === 'CLOSE' || !allFilesRated || !atLeastOneChecked} disabled={!data.id || data.status === 'CLOSE' || (data.applicationStatus === 'EVALUATION'
&& (!allFilesRated || !atLeastOneChecked))}
onClick={doNewSoccorso} onClick={doNewSoccorso}
outlined outlined
label={<> label={<>
@@ -811,8 +816,9 @@ const DomandaEditPreInstructor = () => {
{data.id {data.id
? <Button ? <Button
type="button" type="button"
disabled={!isAdmissible disabled={!isAdmissible || ['APPROVED'].includes(data.applicationStatus)}
|| (APP_EVALUATION_FLOW_ID === '1' && !['ADMISSIBLE', 'APPOINTMENT'].includes(data.applicationStatus))} /*disabled={!isAdmissible
|| (APP_EVALUATION_FLOW_ID === '1' && !['ADMISSIBLE', 'APPOINTMENT'].includes(data.applicationStatus))}*/
onClick={initiateApproving} onClick={initiateApproving}
label={__('Approva Domanda', 'gepafin')} label={__('Approva Domanda', 'gepafin')}
icon="pi pi-check" iconPos="right"/> : null} icon="pi pi-check" iconPos="right"/> : null}

View File

@@ -6,6 +6,13 @@ import { Link, useLocation } from 'react-router-dom';
// api // api
import ApplicationService from '../../../../service/application-service'; import ApplicationService from '../../../../service/application-service';
// tools
import getBandoLabel from '../../../../helpers/getBandoLabel';
import getBandoSeverity from '../../../../helpers/getBandoSeverity';
// translation
import translationStrings from '../../../../translationStringsForComponents';
// components // components
import { FilterMatchMode, FilterOperator } from 'primereact/api'; import { FilterMatchMode, FilterOperator } from 'primereact/api';
import { DataTable } from 'primereact/datatable'; import { DataTable } from 'primereact/datatable';
@@ -13,14 +20,15 @@ import { Column } from 'primereact/column';
import { Button } from 'primereact/button'; import { Button } from 'primereact/button';
import { Calendar } from 'primereact/calendar'; import { Calendar } from 'primereact/calendar';
import ProperBandoLabel from '../../../../components/ProperBandoLabel'; import ProperBandoLabel from '../../../../components/ProperBandoLabel';
import translationStrings from '../../../../translationStringsForComponents'; import { Dropdown } from 'primereact/dropdown';
import { Tag } from 'primereact/tag';
const AllDomandeTable = ({ openDialogFn, updaterString = '' }) => { const AllDomandeTable = ({ openDialogFn, updaterString = '' }) => {
const [items, setItems] = useState(null); const [items, setItems] = useState(null);
const [filters, setFilters] = useState(null); const [filters, setFilters] = useState(null);
const [localAsyncRequest, setLocalAsyncRequest] = useState(false); const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
const [, setStatuses] = useState([]); const [statuses, setStatuses] = useState([]);
const location = useLocation(); const location = useLocation();
useEffect(() => { useEffect(() => {
@@ -82,7 +90,8 @@ const AllDomandeTable = ({ openDialogFn, updaterString = '' }) => {
callEndDate: { callEndDate: {
operator: FilterOperator.AND, operator: FilterOperator.AND,
constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }] constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }]
} },
status: { operator: FilterOperator.OR, constraints: [{ value: null, matchMode: FilterMatchMode.EQUALS }] },
}); });
}; };
@@ -99,9 +108,12 @@ const AllDomandeTable = ({ openDialogFn, updaterString = '' }) => {
return formatDate(rowData.submissionDate); return formatDate(rowData.submissionDate);
}; };
/*const dateEndBodyTemplate = (rowData) => { const statusFilterTemplate = (options) => {
return formatDate(rowData.callEndDate); return <Dropdown value={options.value} options={statuses}
};*/ onChange={(e) => options.filterCallback(e.value, options.index)}
itemTemplate={statusItemTemplate} placeholder={translationStrings.selectOneLabel} className="p-column-filter"
showClear/>;
};
const dateFilterTemplate = (options) => { const dateFilterTemplate = (options) => {
return <Calendar value={options.value} onChange={(e) => options.filterCallback(e.value, options.index)} return <Calendar value={options.value} onChange={(e) => options.filterCallback(e.value, options.index)}
@@ -112,9 +124,13 @@ const AllDomandeTable = ({ openDialogFn, updaterString = '' }) => {
return <ProperBandoLabel status={rowData.status}/>; return <ProperBandoLabel status={rowData.status}/>;
}; };
const statusItemTemplate = (option) => {
return <Tag value={getBandoLabel(option)} severity={getBandoSeverity(option)}/>;
};
const actionsBodyTemplate = (rowData) => { const actionsBodyTemplate = (rowData) => {
return <div className="appPageSection__tableActions lessGap"> return <div className="appPageSection__tableActions lessGap">
{openDialogFn && rowData.status === 'SUBMIT' {openDialogFn && ['SUBMIT', 'EVALUATION', 'SOCCORSO'].includes(rowData.status)
? <Button severity="info" ? <Button severity="info"
onClick={() => openDialogFn(rowData.id)} onClick={() => openDialogFn(rowData.id)}
label={__('Assegnare', 'gepafin')} label={__('Assegnare', 'gepafin')}
@@ -162,7 +178,9 @@ const AllDomandeTable = ({ openDialogFn, updaterString = '' }) => {
style={{ minWidth: '8rem' }} style={{ minWidth: '8rem' }}
body={dateEndBodyTemplate} filter filterElement={dateFilterTemplate}/>*/} body={dateEndBodyTemplate} filter filterElement={dateFilterTemplate}/>*/}
<Column field="status" header={__('Stato', 'gepafin')} <Column field="status" header={__('Stato', 'gepafin')}
style={{ minWidth: '8rem' }} body={statusBodyTemplate}/> style={{ minWidth: '8rem' }} body={statusBodyTemplate}
filter
filterElement={statusFilterTemplate}/>
<Column header={__('Azioni', 'gepafin')} <Column header={__('Azioni', 'gepafin')}
body={actionsBodyTemplate}/> body={actionsBodyTemplate}/>
</DataTable> </DataTable>

View File

@@ -24,7 +24,7 @@ import DraftApplicationsTable from '../Dashboard/components/DraftApplicationsTab
const Domande = () => { const Domande = () => {
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [isVisibleEditDialog, setIsVisibleEditDialog] = useState(false); const [isVisibleEditDialog, setIsVisibleEditDialog] = useState(false);
const [roleId, setRoleId] = useState(0); const [roleIds, setRoleIds] = useState([]);
const [users, setUsers] = useState([]); const [users, setUsers] = useState([]);
const [chosenUser, setChosenUser] = useState(0); const [chosenUser, setChosenUser] = useState(0);
const [chosenApplication, setChosenApplication] = useState(0); const [chosenApplication, setChosenApplication] = useState(0);
@@ -34,10 +34,8 @@ const Domande = () => {
const getRolesCallback = (data) => { const getRolesCallback = (data) => {
if (data.status === 'SUCCESS') { if (data.status === 'SUCCESS') {
const roles = data.data const roles = data.data
.filter(o => ['ROLE_PRE_INSTRUCTOR'].includes(o.roleType)); .filter(o => ['ROLE_PRE_INSTRUCTOR', 'ROLE_INSTRUCTOR_MANAGER'].includes(o.roleType));
if (roles.length) { setRoleIds(roles.map(o => o.id));
setRoleId(roles[0].id);
}
} }
setLoading(false); setLoading(false);
} }
@@ -126,11 +124,11 @@ const Domande = () => {
} }
useEffect(() => { useEffect(() => {
if (roleId !== 0) { if (roleIds.length > 0) {
setLoading(true); setLoading(true);
UserService.getUsers(getUsersCallback, errGetUsersCallback, [['roleId', roleId]]) UserService.getUsers(getUsersCallback, errGetUsersCallback, [['roleIds', roleIds]])
} }
}, [roleId]); }, [roleIds]);
useEffect(() => { useEffect(() => {
if (isVisibleEditDialog) { if (isVisibleEditDialog) {

View File

@@ -4,7 +4,7 @@ import { is, isEmpty, uniq } from 'ramda';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
// store // store
import { useStore, storeGet } from '../../../../store'; import { useStore } from '../../../../store';
// api // api
import ApplicationService from '../../../../service/application-service'; import ApplicationService from '../../../../service/application-service';

View File

@@ -0,0 +1,184 @@
import React, { useEffect, useRef, useState } from 'react';
import { __ } from '@wordpress/i18n';
import { isEmpty } from 'ramda';
// store
import { storeSet } from '../../store';
// tools
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
import uniqid from '../../helpers/uniqid';
// api
import AssignedApplicationService from '../../service/assigned-application-service';
import UserService from '../../service/user-service';
// components
import PreInstructorDomandeTable from '../DashboardPreInstructor/components/PreInstructorDomandeTable';
import AllDomandeTable from '../Domande/components/AllDomandeTable';
import { classNames } from 'primereact/utils';
import { Dropdown } from 'primereact/dropdown';
import { Dialog } from 'primereact/dialog';
import { Button } from 'primereact/button';
const DomandeInstructorManager = () => {
const [loading, setLoading] = useState(false);
const [isVisibleEditDialog, setIsVisibleEditDialog] = useState(false);
const [roleIds, setRoleIds] = useState(0);
const [users, setUsers] = useState([]);
const [chosenUser, setChosenUser] = useState(0);
const [chosenApplication, setChosenApplication] = useState(0);
const [updaterString, setUpdaterString] = useState('');
const toast = useRef(null);
const getRolesCallback = (data) => {
if (data.status === 'SUCCESS') {
const roles = data.data
.filter(o => ['ROLE_PRE_INSTRUCTOR', 'ROLE_INSTRUCTOR_MANAGER'].includes(o.roleType));
setRoleIds(roles.map(o => o.id));
}
setLoading(false);
}
const errGetRolesCallback = (data) => {
set404FromErrorResponse(data);
setLoading(false);
}
const getUsersCallback = (data) => {
if (data.status === 'SUCCESS') {
const users = data.data
.map(o => ({
name: `${o.firstName} ${o.lastName} (${o.email})`,
value: o.id
}));
setUsers(users);
}
setLoading(false);
}
const errGetUsersCallback = (data) => {
set404FromErrorResponse(data);
setLoading(false);
}
const headerEditDialog = () => {
return <span>{__('Assegni la domanda', 'gepafin')}</span>
}
const hideEditDialog = () => {
setIsVisibleEditDialog(false);
setChosenUser(0);
setChosenApplication(0);
}
const footerEditDialog = () => {
return <div>
<Button type="button" label={__('Anulla', 'gepafin')} onClick={hideEditDialog} outlined/>
<Button
type="button"
disabled={loading}
label={__('Invia', 'gepafin')} onClick={saveEditDialog}/>
</div>
}
const openAssignDialog = (applId) => {
setChosenApplication(applId)
setIsVisibleEditDialog(true);
}
const saveEditDialog = () => {
if (chosenUser !== 0 && chosenApplication !== 0) {
storeSet.main.setAsyncRequest();
AssignedApplicationService.assignApplication(chosenApplication, assignApplCallback, errAssignApplCallback, [
['userId', chosenUser]
]);
hideEditDialog();
}
}
const assignApplCallback = (data) => {
if (data.status === 'SUCCESS') {
if (toast.current) {
toast.current.show({
severity: 'success',
summary: '',
detail: data.message
});
}
setUpdaterString(uniqid());
}
storeSet.main.unsetAsyncRequest();
}
const errAssignApplCallback = (data) => {
if (toast.current && data.message) {
toast.current.show({
severity: 'error',
summary: '',
detail: data.message
});
}
set404FromErrorResponse(data);
storeSet.main.unsetAsyncRequest();
}
useEffect(() => {
if (roleIds.length > 0) {
setLoading(true);
UserService.getUsers(getUsersCallback, errGetUsersCallback, [['roleIds', roleIds]])
}
}, [roleIds]);
useEffect(() => {
if (isVisibleEditDialog) {
setLoading(true);
UserService.getRoles(getRolesCallback, errGetRolesCallback)
}
}, [isVisibleEditDialog]);
return(
<div className="appPage">
<div className="appPage__pageHeader">
<h1>{__('Domande da valutare', 'gepafin')}</h1>
</div>
<div className="appPage__spacer"></div>
<div className="appPageSection">
<PreInstructorDomandeTable/>
</div>
<div className="appPage__spacer"></div>
<div className="appPageSection">
<h2>{__('Domande pubblicate', 'gepafin')}</h2>
<AllDomandeTable openDialogFn={openAssignDialog} updaterString={updaterString}/>
</div>
<Dialog
visible={isVisibleEditDialog}
modal
header={headerEditDialog}
footer={footerEditDialog}
style={{ maxWidth: '600px', width: '100%' }}
onHide={hideEditDialog}>
<div className="appForm__field">
<label
className={classNames({ 'p-error': isEmpty(chosenUser) || chosenUser === 0 || chosenApplication === 0 })}>
{__('Istruttore', 'gepafin')}*
</label>
<Dropdown
value={chosenUser}
invalid={isEmpty(chosenUser) || chosenUser === 0 || chosenApplication === 0}
onChange={(e) => setChosenUser(e.value)}
options={users}
optionLabel="name"
optionValue="value"/>
</div>
</Dialog>
</div>
)
}
export default DomandeInstructorManager;

View File

@@ -8,7 +8,7 @@ const DomandePreInstructor = () => {
return( return(
<div className="appPage"> <div className="appPage">
<div className="appPage__pageHeader"> <div className="appPage__pageHeader">
<h1>{__('Archivio domande', 'gepafin')}</h1> <h1>{__('Domande da valutare', 'gepafin')}</h1>
</div> </div>
<div className="appPage__spacer"></div> <div className="appPage__spacer"></div>

View File

@@ -4,6 +4,7 @@ import { useNavigate, useParams } from 'react-router-dom';
import { is, isEmpty } from 'ramda'; import { is, isEmpty } from 'ramda';
import { useForm } from 'react-hook-form'; import { useForm } from 'react-hook-form';
import { klona } from 'klona'; import { klona } from 'klona';
import { wrap } from 'object-path-immutable';
// store // store
import { storeSet, useStore } from '../../store'; import { storeSet, useStore } from '../../store';
@@ -25,11 +26,9 @@ import { Toast } from 'primereact/toast';
import { Dialog } from 'primereact/dialog'; import { Dialog } from 'primereact/dialog';
import FormField from '../../components/FormField'; import FormField from '../../components/FormField';
import SoccorsoComunications from '../SoccorsoEditPreInstructor/components/SoccorsoComunications'; import SoccorsoComunications from '../SoccorsoEditPreInstructor/components/SoccorsoComunications';
import RepeaterFields from '../DomandaEditPreInstructor/components/RepeaterFields';
import { wrap } from 'object-path-immutable';
import { Editor } from 'primereact/editor'; import { Editor } from 'primereact/editor';
const DomandaBeneficiario = () => { const SoccorsoEditBeneficiario = () => {
const isAsyncRequest = useStore().main.isAsyncRequest(); const isAsyncRequest = useStore().main.isAsyncRequest();
const { id } = useParams(); const { id } = useParams();
const navigate = useNavigate(); const navigate = useNavigate();
@@ -117,7 +116,7 @@ const DomandaBeneficiario = () => {
const onSubmit = () => { const onSubmit = () => {
}; };
const doUpdateAmendment = () => { const doUpdateAmendment = (doClose = false) => {
trigger(); trigger();
let formValues = klona(getValues()); let formValues = klona(getValues());
const newFormValues = Object.keys(formValues) const newFormValues = Object.keys(formValues)
@@ -146,29 +145,47 @@ const DomandaBeneficiario = () => {
const amendmentId = data.id; const amendmentId = data.id;
storeSet.main.setAsyncRequest(); storeSet.main.setAsyncRequest();
AmendmentsService.updateSoccorso(amendmentId, submitData, updateAmendmentCallback, errUpdateAmendmentCallback);
AmendmentsService.updateSoccorso(
amendmentId,
submitData,
(resp) => updateAmendmentCallback(resp, doClose),
errUpdateAmendmentCallback
);
} }
const updateAmendmentCallback = (data) => { const doUpdateAmendmentAndCompleteTask = () => {
doUpdateAmendment(true);
}
const updateAmendmentCallback = (data, doClose = false) => {
if (data.status === 'SUCCESS') { if (data.status === 'SUCCESS') {
if (toast.current) { setData(getFormattedData(data.data));
toast.current.show({
severity: 'success', if (doClose) {
summary: '', AmendmentsService.updateStatusSoccorso(data.data.id, updateAmendmentCallback, errUpdateAmendmentCallback, [
detail: data.message ['status', 'RESPONSE_RECEIVED']
}); ]);
} } else {
let formDataInitial = data.data.applicationFormFields.reduce((acc, cur) => { if (toast.current) {
if (cur.fieldValue) { toast.current.show({
acc[cur.fieldId] = cur.fieldValue; severity: 'success',
summary: '',
detail: data.message
});
} }
return acc; let formDataInitial = data.data.applicationFormFields.reduce((acc, cur) => {
}, {}); if (cur.fieldValue) {
formDataInitial = { acc[cur.fieldId] = cur.fieldValue;
...formDataInitial, }
amendmentDocuments: data.data.amendmentDocuments return acc;
}, {});
formDataInitial = {
...formDataInitial,
amendmentDocuments: data.data.amendmentDocuments
}
setFormInitialData(formDataInitial);
} }
setFormInitialData(formDataInitial);
} }
storeSet.main.unsetAsyncRequest(); storeSet.main.unsetAsyncRequest();
} }
@@ -330,7 +347,7 @@ const DomandaBeneficiario = () => {
? data.formFields.map((o, i) => { ? data.formFields.map((o, i) => {
return <FormField return <FormField
key={o.fieldId} key={o.fieldId}
disabled={data.status === 'CLOSE'} disabled={data.status !== 'AWAITING'}
type="fileupload" type="fileupload"
setDataFn={setValue} setDataFn={setValue}
saveFormCallback={doUpdateAmendment} saveFormCallback={doUpdateAmendment}
@@ -361,10 +378,11 @@ const DomandaBeneficiario = () => {
<h2>{__('Documenti aggiuntivi', 'gepafin')}</h2> <h2>{__('Documenti aggiuntivi', 'gepafin')}</h2>
<div className="appPageSection"> <div className="appPageSection">
<h3>{__('Notes', 'gepafin')}</h3> <h3>{__('Notes', 'gepafin')}</h3>
<div style={{ marginBottom: '30px', width: '100%' }}> <div style={{ marginBottom: '30px', width: '100%', position: 'relative' }}>
<BlockingOverlay shouldDisplay={data.status !== 'AWAITING'}/>
<Editor <Editor
value={data.amendmentNotes} value={data.amendmentNotes}
readOnly={data.status === 'CLOSE'} readOnly={data.status !== 'AWAITING'}
placeholder={__('Digita qui il messagio', 'gepafin')} placeholder={__('Digita qui il messagio', 'gepafin')}
headerTemplate={header} headerTemplate={header}
onTextChange={(e) => updateNewAmendmentData( onTextChange={(e) => updateNewAmendmentData(
@@ -376,7 +394,7 @@ const DomandaBeneficiario = () => {
</div> </div>
<FormField <FormField
type="fileupload" type="fileupload"
disabled={data.status === 'CLOSE'} disabled={data.status !== 'AWAITING'}
setDataFn={setValue} setDataFn={setValue}
saveFormCallback={doUpdateAmendment} saveFormCallback={doUpdateAmendment}
fieldName="amendmentDocuments" fieldName="amendmentDocuments"
@@ -405,30 +423,30 @@ const DomandaBeneficiario = () => {
{data.id {data.id
? <Button ? <Button
type="button" type="button"
disabled={isAsyncRequest} disabled={isAsyncRequest || data.status !== 'AWAITING'}
onClick={() => setIsVisibleEmailDialog(true)} onClick={doUpdateAmendmentAndCompleteTask}
label={__('Invia documenti via PEC', 'gepafin')} label={__('Invia documenti', 'gepafin')}
icon="pi pi-envelope" iconPos="right"/> : null} icon="pi pi-save" iconPos="right"/> : null}
{data.id {data.id
? <Button ? <Button
type="button" type="button"
disabled={isAsyncRequest} outlined
onClick={doUpdateAmendment} disabled={isAsyncRequest || data.status !== 'AWAITING'}
label={__('Salva', 'gepafin')} onClick={() => doUpdateAmendment()}
label={__('Salva bozza', 'gepafin')}
icon="pi pi-save" iconPos="right"/> : null} icon="pi pi-save" iconPos="right"/> : null}
<Button <Button
type="button" type="button"
outlined outlined
onClick={goToArchivePage} onClick={goToArchivePage}
disabled={isAsyncRequest} label={__('Indietro', 'gepafin')}
label={__('Chiudi', 'gepafin')}
icon="pi pi-times" iconPos="right"/> icon="pi pi-times" iconPos="right"/>
</div> </div>
</div> </div>
</div> </div>
<Dialog <Dialog
header={__('Invia documenti via PEC', 'gepafin')} header={__('Invia documenti', 'gepafin')}
visible={isVisibleEmailDialog} visible={isVisibleEmailDialog}
style={{ width: '50vw' }} style={{ width: '50vw' }}
onHide={() => { onHide={() => {
@@ -444,4 +462,4 @@ const DomandaBeneficiario = () => {
} }
export default DomandaBeneficiario; export default SoccorsoEditBeneficiario;

View File

@@ -28,7 +28,6 @@ import FormField from '../../components/FormField';
import { Editor } from 'primereact/editor'; import { Editor } from 'primereact/editor';
import { InputNumber } from 'primereact/inputnumber'; import { InputNumber } from 'primereact/inputnumber';
import SoccorsoComunications from './components/SoccorsoComunications'; import SoccorsoComunications from './components/SoccorsoComunications';
import RepeaterFields from '../DomandaEditPreInstructor/components/RepeaterFields';
const SoccorsoEditPreInstructor = () => { const SoccorsoEditPreInstructor = () => {
@@ -41,6 +40,7 @@ const SoccorsoEditPreInstructor = () => {
const [extendedTime, setExtendedTime] = useState(3); const [extendedTime, setExtendedTime] = useState(3);
const [isLoadingExtendingTime, setIsLoadingExtendingTime] = useState(false); const [isLoadingExtendingTime, setIsLoadingExtendingTime] = useState(false);
const [isLoadingReminding, setIsLoadingReminding] = useState(false); const [isLoadingReminding, setIsLoadingReminding] = useState(false);
const [internalNote, setInternalNote] = useState('');
const toast = useRef(null); const toast = useRef(null);
const [formInitialData, setFormInitialData] = useState({}); const [formInitialData, setFormInitialData] = useState({});
const { const {
@@ -125,7 +125,7 @@ const SoccorsoEditPreInstructor = () => {
const onSubmit = () => { const onSubmit = () => {
}; };
const doUpdateAmendment = () => { const doUpdateAmendment = (doClose = false) => {
trigger(); trigger();
let formValues = klona(getValues()); let formValues = klona(getValues());
const newFormValues = Object.keys(formValues) const newFormValues = Object.keys(formValues)
@@ -148,33 +148,49 @@ const SoccorsoEditPreInstructor = () => {
const submitData = { const submitData = {
applicationFormFields: newFormValues, applicationFormFields: newFormValues,
amendmentDocuments: newAmendDocs amendmentDocuments: newAmendDocs,
amendmentNotes: data.amendmentNotes
} }
storeSet.main.setAsyncRequest(); storeSet.main.setAsyncRequest();
AmendmentsService.updateSoccorso(amendmentId, submitData, updateAmendmentCallback, errUpdateAmendmentCallback); AmendmentsService.updateSoccorso(
amendmentId,
submitData,
(resp) => updateAmendmentCallback(resp, doClose),
errUpdateAmendmentCallback
);
} }
const updateAmendmentCallback = (data) => { const updateAmendmentCallback = (data, doClose = false) => {
if (data.status === 'SUCCESS') { if (data.status === 'SUCCESS') {
if (toast.current) { setData(getFormattedData(data.data));
toast.current.show({ console.log('internalNote', internalNote)
severity: 'success', if (doClose) {
summary: '', const submitData = {
detail: data.message internalNote
});
}
let formDataInitial = data.data.applicationFormFields.reduce((acc, cur) => {
if (cur.fieldValue) {
acc[cur.fieldId] = cur.fieldValue;
} }
return acc; storeSet.main.setAsyncRequest();
}, formInitialData); AmendmentsService.closeSoccorso(amendmentId, submitData, closeAmendmentCallback, errCloseAmendmentCallback);
formDataInitial = { } else {
...formDataInitial, if (toast.current) {
amendmentDocuments: data.data.amendmentDocuments toast.current.show({
severity: 'success',
summary: '',
detail: data.message
});
}
let formDataInitial = data.data.applicationFormFields.reduce((acc, cur) => {
if (cur.fieldValue) {
acc[cur.fieldId] = cur.fieldValue;
}
return acc;
}, formInitialData);
formDataInitial = {
...formDataInitial,
amendmentDocuments: data.data.amendmentDocuments
}
setFormInitialData(formDataInitial);
} }
setFormInitialData(formDataInitial);
} }
storeSet.main.unsetAsyncRequest(); storeSet.main.unsetAsyncRequest();
} }
@@ -214,11 +230,7 @@ const SoccorsoEditPreInstructor = () => {
} }
const doCloseAmendment = () => { const doCloseAmendment = () => {
const submitData = { doUpdateAmendment(true);
internalNote: data.internalNote
}
storeSet.main.setAsyncRequest();
AmendmentsService.closeSoccorso(amendmentId, submitData, closeAmendmentCallback, errCloseAmendmentCallback);
} }
const closeAmendmentCallback = (data) => { const closeAmendmentCallback = (data) => {
@@ -434,7 +446,7 @@ const SoccorsoEditPreInstructor = () => {
{data.formFields.map((o, i) => { {data.formFields.map((o, i) => {
return <FormField return <FormField
key={o.fieldId} key={o.fieldId}
disabled={data.status === 'CLOSE'} disabled={data.status === 'CLOSE' || data.status === 'AWAITING'}
type="fileupload" type="fileupload"
setDataFn={setValue} setDataFn={setValue}
saveFormCallback={doUpdateAmendment} saveFormCallback={doUpdateAmendment}
@@ -456,16 +468,24 @@ const SoccorsoEditPreInstructor = () => {
<div className="appPageSection"> <div className="appPageSection">
<h2>{__('Documenti aggiuntivi', 'gepafin')}</h2> <h2>{__('Documenti aggiuntivi', 'gepafin')}</h2>
<div className="appPageSection"> <div className="appPageSection">
{data.amendmentNotes <h3>{__('Notes', 'gepafin')}</h3>
? <> <div style={{ marginBottom: '30px', width: '100%', position: 'relative' }}>
<h3>{__('Notes', 'gepafin')}</h3> <BlockingOverlay shouldDisplay={data.status === 'CLOSE' || data.status === 'AWAITING'}/>
<div className="ql-editor" style={{ marginBottom: '30px', width: '100%' }}> <Editor
{renderHtmlContent(data.amendmentNotes)} value={data.amendmentNotes}
</div> readOnly={data.status === 'CLOSE' || data.status === 'AWAITING'}
</> : null} placeholder={__('Digita qui il messagio', 'gepafin')}
headerTemplate={header}
onTextChange={(e) => updateNewAmendmentData(
e.htmlValue,
'amendmentNotes'
)}
style={{ height: 80 * 3, width: '100%' }}
/>
</div>
<FormField <FormField
type="fileupload" type="fileupload"
disabled={data.status === 'CLOSE'} disabled={data.status === 'CLOSE' || data.status === 'AWAITING'}
setDataFn={setValue} setDataFn={setValue}
saveFormCallback={doUpdateAmendment} saveFormCallback={doUpdateAmendment}
fieldName="amendmentDocuments" fieldName="amendmentDocuments"
@@ -490,12 +510,6 @@ const SoccorsoEditPreInstructor = () => {
<div className="appPageSection"> <div className="appPageSection">
<div className="appPageSection__actions"> <div className="appPageSection__actions">
{/*<Button
type="button"
disabled={isAsyncRequest}
onClick={doUpdateAmendment}
label={__('Salva', 'gepafin')}
icon="pi pi-save" iconPos="right"/>*/}
<Button <Button
type="button" type="button"
onClick={sendReminder} onClick={sendReminder}
@@ -512,12 +526,12 @@ const SoccorsoEditPreInstructor = () => {
label={__('Estendi Scadenza', 'gepafin')} label={__('Estendi Scadenza', 'gepafin')}
icon="pi pi-stopwatch" icon="pi pi-stopwatch"
/> />
{/*<Button <Button
type="button" type="button"
onClick={doUpdateAmendment} onClick={() => doUpdateAmendment()}
disabled={isAsyncRequest || data.status === 'CLOSE'} disabled={isAsyncRequest || data.status === 'CLOSE' || data.status === 'AWAITING'}
label={__('Salva bozza', 'gepafin')} label={__('Salva bozza', 'gepafin')}
icon="pi pi-save" iconPos="right"/>*/} icon="pi pi-save" iconPos="right"/>
<Button <Button
type="button" type="button"
onClick={openCloseAmendmentDialog} onClick={openCloseAmendmentDialog}
@@ -562,14 +576,11 @@ const SoccorsoEditPreInstructor = () => {
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
<BlockingOverlay shouldDisplay={data.status === 'CLOSE'}/> <BlockingOverlay shouldDisplay={data.status === 'CLOSE'}/>
<Editor <Editor
value={data.internalNote} value={internalNote}
readOnly={data.status === 'CLOSE'} readOnly={data.status === 'CLOSE'}
placeholder={__('Digita qui il messagio', 'gepafin')} placeholder={__('Digita qui il messagio', 'gepafin')}
headerTemplate={header} headerTemplate={header}
onTextChange={(e) => updateNewAmendmentData( onTextChange={(e) => setInternalNote(e.htmlValue)}
e.htmlValue,
['internalNote']
)}
style={{ height: 80 * 3, width: '100%' }} style={{ height: 80 * 3, width: '100%' }}
/> />
</div> </div>

View File

@@ -53,7 +53,7 @@ const AllUsersTable = () => {
const getFormattedData = (data) => { const getFormattedData = (data) => {
return data return data
.filter(o => ['ROLE_SUPER_ADMIN', 'ROLE_PRE_INSTRUCTOR'].includes(o.role.roleType)); .filter(o => ['ROLE_SUPER_ADMIN', 'ROLE_PRE_INSTRUCTOR', 'ROLE_INSTRUCTOR_MANAGER'].includes(o.role.roleType));
}; };
const clearFilter = () => { const clearFilter = () => {

View File

@@ -121,7 +121,7 @@ const Users = () => {
const getRolesCallback = (data) => { const getRolesCallback = (data) => {
if (data.status === 'SUCCESS') { if (data.status === 'SUCCESS') {
const roles = data.data const roles = data.data
.filter(o => ['ROLE_SUPER_ADMIN', 'ROLE_PRE_INSTRUCTOR'].includes(o.roleType)) .filter(o => ['ROLE_SUPER_ADMIN', 'ROLE_PRE_INSTRUCTOR', 'ROLE_INSTRUCTOR_MANAGER'].includes(o.roleType))
.map(o => ({ .map(o => ({
name: o.roleName, name: o.roleName,
value: o.id value: o.id

View File

@@ -34,9 +34,10 @@ import SoccorsoIstruttorioPreInstructor from './pages/SoccorsoIstruttorioPreInst
import SoccorsoEditPreInstructor from './pages/SoccorsoEditPreInstructor'; import SoccorsoEditPreInstructor from './pages/SoccorsoEditPreInstructor';
import SoccorsoAddPreInstructor from './pages/SoccorsoAddPreInstructor'; import SoccorsoAddPreInstructor from './pages/SoccorsoAddPreInstructor';
import DomandeBeneficiario from './pages/DomandeBeneficiario'; import DomandeBeneficiario from './pages/DomandeBeneficiario';
import DomandaBeneficiario from './pages/DomandaBeneficiario'; import SoccorsoEditBeneficiario from './pages/SoccorsoEditBeneficiario';
import BandoApplicationPreview from './pages/BandoApplicationPreview'; import BandoApplicationPreview from './pages/BandoApplicationPreview';
import BandiPreferredBeneficiario from './pages/BandiPreferredBeneficiario'; import BandiPreferredBeneficiario from './pages/BandiPreferredBeneficiario';
import DomandeInstructorManager from './pages/DomandeInstructorManager';
const routes = ({ role, chosenCompanyId }) => { const routes = ({ role, chosenCompanyId }) => {
@@ -47,106 +48,127 @@ const routes = ({ role, chosenCompanyId }) => {
{'ROLE_SUPER_ADMIN' === role ? <Dashboard/> : null} {'ROLE_SUPER_ADMIN' === role ? <Dashboard/> : null}
{'ROLE_BENEFICIARY' === role ? <DashboardBeneficiario/> : null} {'ROLE_BENEFICIARY' === role ? <DashboardBeneficiario/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <DashboardPreInstructor/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <DashboardPreInstructor/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <DashboardPreInstructor/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/bandi" element={<DefaultLayout> <Route path="/bandi" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <Bandi/> : null} {'ROLE_SUPER_ADMIN' === role ? <Bandi/> : null}
{'ROLE_BENEFICIARY' === role ? <BandiBeneficiario/> : null} {'ROLE_BENEFICIARY' === role ? <BandiBeneficiario/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/bandi/:id" element={<DefaultLayout> <Route path="/bandi/:id" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <BandoEdit/> : null} {'ROLE_SUPER_ADMIN' === role ? <BandoEdit/> : null}
{'ROLE_BENEFICIARY' === role ? <BandoViewBeneficiario/> : null} {'ROLE_BENEFICIARY' === role ? <BandoViewBeneficiario/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/bandi/:id/preview" element={<DefaultLayout> <Route path="/bandi/:id/preview" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <BandoView/> : null} {'ROLE_SUPER_ADMIN' === role ? <BandoView/> : null}
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null} {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/bandi/:id/preview-evaluation" element={<DefaultLayout> <Route path="/bandi/:id/preview-evaluation" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <BandoView/> : null} {'ROLE_SUPER_ADMIN' === role ? <BandoView/> : null}
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null} {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/bandi/:id/forms" element={<DefaultLayout> <Route path="/bandi/:id/forms" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <BandoForms/> : null} {'ROLE_SUPER_ADMIN' === role ? <BandoForms/> : null}
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null} {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/bandi/:id/forms/:formId" element={<DefaultLayout> <Route path="/bandi/:id/forms/:formId" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <BandoFormsEdit/> : null} {'ROLE_SUPER_ADMIN' === role ? <BandoFormsEdit/> : null}
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null} {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/bandi/:id/forms/:formId/preview" element={<DefaultLayout> <Route path="/bandi/:id/forms/:formId/preview" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <BandoFormsPreview/> : null} {'ROLE_SUPER_ADMIN' === role ? <BandoFormsPreview/> : null}
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null} {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/bandi/:id/flow" element={<DefaultLayout> <Route path="/bandi/:id/flow" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <BandoFlowEdit/> : null} {'ROLE_SUPER_ADMIN' === role ? <BandoFlowEdit/> : null}
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null} {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/bandi-osservati" element={<DefaultLayout> <Route path="/bandi-osservati" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null} {'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
{'ROLE_BENEFICIARY' === role ? <BandiPreferredBeneficiario/> : null} {'ROLE_BENEFICIARY' === role ? <BandiPreferredBeneficiario/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/domande" element={<DefaultLayout> <Route path="/domande" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <Domande/> : null} {'ROLE_SUPER_ADMIN' === role ? <Domande/> : null}
{'ROLE_BENEFICIARY' === role ? <DomandeBeneficiario/> : null} {'ROLE_BENEFICIARY' === role ? <DomandeBeneficiario/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <DomandePreInstructor/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <DomandePreInstructor/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <DomandeInstructorManager/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/domande/:id/" element={<DefaultLayout> <Route path="/domande/:id/" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <BandoApplicationPreview/> : null} {'ROLE_SUPER_ADMIN' === role ? <BandoApplicationPreview/> : null}
{'ROLE_BENEFICIARY' === role ? <DomandaBeneficiario/> : null} {'ROLE_BENEFICIARY' === role ? <SoccorsoEditBeneficiario/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <DomandaEditPreInstructor/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <DomandaEditPreInstructor/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <BandoApplicationPreview/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/domande/:id/aggiungi-soccorso" element={<DefaultLayout> <Route path="/domande/:id/aggiungi-soccorso" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null} {'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null} {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <SoccorsoAddPreInstructor/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <SoccorsoAddPreInstructor/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoAddPreInstructor/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/domande/:id/soccorso/:amendmentId" element={<DefaultLayout> <Route path="/domande/:id/soccorso/:amendmentId" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null} {'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null} {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <SoccorsoEditPreInstructor/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <SoccorsoEditPreInstructor/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoEditPreInstructor/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/soccorso-istruttorio/" element={<DefaultLayout> <Route path="/soccorso-istruttorio/" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null} {'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null} {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <SoccorsoIstruttorioPreInstructor/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <SoccorsoIstruttorioPreInstructor/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoIstruttorioPreInstructor/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/imieibandi" element={<DefaultLayout> <Route path="/imieibandi" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null} {'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
{'ROLE_BENEFICIARY' === role ? <Applications/> : null} {'ROLE_BENEFICIARY' === role ? <Applications/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/imieibandi/:id/" element={<DefaultLayout> <Route path="/imieibandi/:id/" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null} {'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
{'ROLE_BENEFICIARY' === role ? <BandoApplication/> : null} {'ROLE_BENEFICIARY' === role ? <BandoApplication/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/profilo" element={<DefaultLayout> <Route path="/profilo" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <Profile/> : null} {'ROLE_SUPER_ADMIN' === role ? <Profile/> : null}
{'ROLE_BENEFICIARY' === role ? <ProfileBeneficiario/> : null} {'ROLE_BENEFICIARY' === role ? <ProfileBeneficiario/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <Profile/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <Profile/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <Profile/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/profilo-aziendale" element={<DefaultLayout> <Route path="/profilo-aziendale" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null} {'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
{'ROLE_BENEFICIARY' === role && chosenCompanyId > 0 ? <ProfileCompany/> : <PageNotFound/>} {'ROLE_BENEFICIARY' === role && chosenCompanyId > 0 ? <ProfileCompany/> : <PageNotFound/>}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/agguingi-azienda" element={<DefaultLayout> <Route path="/agguingi-azienda" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null} {'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
{'ROLE_BENEFICIARY' === role ? <AddCompany/> : null} {'ROLE_BENEFICIARY' === role ? <AddCompany/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/utenti" element={<DefaultLayout> <Route path="/utenti" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <Users/> : null} {'ROLE_SUPER_ADMIN' === role ? <Users/> : null}
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null} {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
</Route> </Route>
<Route exact path="/reset-password" element={<ResetPassword/>}/> <Route exact path="/reset-password" element={<ResetPassword/>}/>

View File

@@ -28,6 +28,10 @@ export default class AmendmentsService {
NetworkService.put(`${API_BASE_URL}/amendments/${id}`, body, callback, errCallback, queryParams); NetworkService.put(`${API_BASE_URL}/amendments/${id}`, body, callback, errCallback, queryParams);
}; };
static updateStatusSoccorso = (id, callback, errCallback, queryParams) => {
NetworkService.put(`${API_BASE_URL}/amendments/${id}/status`, {}, callback, errCallback, queryParams);
};
static extendSoccorso = (id, days, callback, errCallback, queryParams) => { static extendSoccorso = (id, days, callback, errCallback, queryParams) => {
NetworkService.put(`${API_BASE_URL}/amendments/${id}/extendExpiration`, {}, callback, errCallback, [ NetworkService.put(`${API_BASE_URL}/amendments/${id}/extendExpiration`, {}, callback, errCallback, [
['extendedDays', days] ['extendedDays', days]