- added pages for CONFIDI user;

This commit is contained in:
Vitalii Kiiko
2025-03-06 15:20:42 +01:00
parent 00b4ad8569
commit a9a92baf18
11 changed files with 443 additions and 43 deletions

View File

@@ -32,21 +32,21 @@ const AppSidebar = () => {
icon: 'pi pi-file', icon: 'pi pi-file',
href: '/imieibandi', href: '/imieibandi',
id: 3, id: 3,
enable: intersection(permissions, ['APPLY_CALLS']).length enable: intersection(permissions, ['APPLY_CALLS', 'APPLY_CONFIDI_CALLS']).length
}, },
{ {
label: __('Bandi disponibili', 'gepafin'), label: __('Bandi disponibili', 'gepafin'),
icon: 'pi pi-bookmark', icon: 'pi pi-bookmark',
href: '/bandi', href: '/bandi',
id: 4, id: 4,
enable: intersection(permissions, ['VIEW_CALLS']).length enable: intersection(permissions, ['VIEW_CALLS', 'VIEW_CONFIDI_CALLS']).length
}, },
{ {
label: __('Bandi osservati', 'gepafin'), label: __('Bandi osservati', 'gepafin'),
icon: 'pi pi-star', icon: 'pi pi-star',
href: '/bandi-osservati', href: '/bandi-osservati',
id: 5, id: 5,
enable: intersection(permissions, ['VIEW_CALLS']).length enable: intersection(permissions, ['VIEW_CALLS', 'VIEW_CONFIDI_CALLS']).length
}, },
{ {
label: __('Gestione domande', 'gepafin'), label: __('Gestione domande', 'gepafin'),
@@ -81,7 +81,7 @@ const AppSidebar = () => {
icon: 'pi pi-briefcase', icon: 'pi pi-briefcase',
href: '/domande', href: '/domande',
id: 10, id: 10,
enable: intersection(permissions, ['APPLY_CALLS']).length enable: intersection(permissions, ['APPLY_CALLS', 'APPLY_CONFIDI_CALLS']).length
}, },
{ {
label: __('Archivio domande', 'gepafin'), label: __('Archivio domande', 'gepafin'),
@@ -136,14 +136,14 @@ const AppSidebar = () => {
icon: 'pi pi-chart-bar', icon: 'pi pi-chart-bar',
href: '/stats', href: '/stats',
id: 15, id: 15,
enable: intersection(permissions, ['APPLY_CALLS']).length enable: intersection(permissions, ['APPLY_CALLS', 'APPLY_CONFIDI_CALLS']).length
}, },
{ {
label: __('Documenti', 'gepafin'), label: __('Documenti', 'gepafin'),
icon: 'pi pi-folder-open', icon: 'pi pi-folder-open',
href: '/documenti', href: '/documenti',
id: 16, id: 16,
enable: intersection(permissions, ['APPLY_CALLS']).length enable: intersection(permissions, ['APPLY_CALLS', 'APPLY_CONFIDI_CALLS']).length
}, },
{ {
label: __('Log di Sistema', 'gepafin'), label: __('Log di Sistema', 'gepafin'),

View File

@@ -14,6 +14,7 @@ import { storeSet, storeGet, useStore } from '../../store';
// api // api
import ApplicationService from '../../service/application-service'; import ApplicationService from '../../service/application-service';
import CompanyDocumentsService from '../../service/company-documents-service';
// tools // tools
import { import {
@@ -33,6 +34,7 @@ import renderWithDataVars from '../../helpers/renderWithDataVars';
import getTokens from '../../helpers/getTokens'; import getTokens from '../../helpers/getTokens';
import formatDateString from '../../helpers/formatDateString'; import formatDateString from '../../helpers/formatDateString';
import isDateTimeInPast from '../../helpers/isDateTimeInPast'; import isDateTimeInPast from '../../helpers/isDateTimeInPast';
import parseCommaDecimal from '../../helpers/parseCommaDecimal';
// components // components
import { Skeleton } from 'primereact/skeleton'; import { Skeleton } from 'primereact/skeleton';
@@ -46,8 +48,8 @@ import { Dialog } from 'primereact/dialog';
import FileuploadApplicationSignedPdf from '../../components/FileuploadApplicationSignedPdf'; import FileuploadApplicationSignedPdf from '../../components/FileuploadApplicationSignedPdf';
import { defaultMaxFileSize } from '../../configData'; import { defaultMaxFileSize } from '../../configData';
import parseCommaDecimal from '../../helpers/parseCommaDecimal';
import CompanyDocumentsService from '../../service/company-documents-service'; const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
const BandoApplication = () => { const BandoApplication = () => {
const chosenCompanyId = useStore().main.chosenCompanyId(); const chosenCompanyId = useStore().main.chosenCompanyId();
@@ -652,12 +654,6 @@ const BandoApplication = () => {
['companyId', chosenCompanyId] ['companyId', chosenCompanyId]
]); ]);
CompanyDocumentsService.getCompanyDocuments(chosenCompanyId, getDocsCallback, errDocsGetCallbacks); CompanyDocumentsService.getCompanyDocuments(chosenCompanyId, getDocsCallback, errDocsGetCallbacks);
/*CompanyDocumentsService.getCompanyDocuments(chosenCompanyId, (resp) => getDocsCallback(resp, 'COMPANY_DOCUMENT'), errDocsGetCallbacks, [
['documentType', 'COMPANY_DOCUMENT']
]);
CompanyDocumentsService.getCompanyDocuments(chosenCompanyId, (resp) => getDocsCallback(resp, 'PERSONAL_DOCUMENT'), errDocsGetCallbacks, [
['documentType', 'PERSONAL_DOCUMENT']
]);*/
} }
}, [id, chosenCompanyId]); }, [id, chosenCompanyId]);
@@ -690,7 +686,10 @@ const BandoApplication = () => {
setVisibleConfirmation(false); setVisibleConfirmation(false);
}}> }}>
<p> <p>
{__('Grazie, la tua domanda è stata inviata correttamente. Entro 24 ore riceverai una pec con data, ora e numero di protocollo.', 'gepafin')} {APP_HUB_ID === 't7jh5wfg9QXylNaTZkPoE'
? __('Grazie, la tua domanda è stata inviata correttamente. Entro 24 ore riceverai una email con data, ora e numero di protocollo.', 'gepafin')
: __('Grazie, la tua domanda è stata inviata correttamente. Entro 24 ore riceverai una pec con data, ora e numero di protocollo.', 'gepafin')
}
</p> </p>
</Dialog> </Dialog>
@@ -750,9 +749,9 @@ const BandoApplication = () => {
return acc; return acc;
}, {}); }, {});
if (o.name === 'fileselect') { /*if (o.name === 'fileselect') {
console.log('options::', options) console.log('options::', options)
} }*/
return ['paragraph'].includes(o.name) && text return ['paragraph'].includes(o.name) && text
? <div key={o.id}> ? <div key={o.id}>

View File

@@ -121,6 +121,9 @@ const Login = () => {
hotkeys('command+x,ctrl+x', function(event, handler){ hotkeys('command+x,ctrl+x', function(event, handler){
window.location.replace('/loginadmin') window.location.replace('/loginadmin')
}); });
hotkeys('command+shift+x,ctrl+shift+x', function(event, handler){
window.location.replace('/confidi')
});
}, []); }, []);
return ( return (

View File

@@ -31,7 +31,7 @@ const LoginAdmin = () => {
} = useForm({ mode: 'onChange' }); } = useForm({ mode: 'onChange' });
const gotToResetPassword = () => { const gotToResetPassword = () => {
navigate('/reset-password'); navigate('/reset-password-admin');
} }
const onSubmit = (formData) => { const onSubmit = (formData) => {
@@ -83,7 +83,7 @@ const LoginAdmin = () => {
<div className="appPageLogin__wrapper"> <div className="appPageLogin__wrapper">
<LogoIcon/> <LogoIcon/>
<h1>{__('Accedi o Registrati', 'gepafin')}</h1> <h1>{__('Accedi', 'gepafin')}</h1>
<Messages ref={errorMsgs}/> <Messages ref={errorMsgs}/>

View File

@@ -0,0 +1,126 @@
import React, { useRef, useState, useEffect } from 'react';
import { __, sprintf } from '@wordpress/i18n';
import { useForm } from 'react-hook-form';
import { classNames } from 'primereact/utils';
import { isEmpty } from 'ramda';
import { useNavigate } from 'react-router-dom';
// tools
import AuthenticationService from '../../service/authentication-service';
// store
import { storeSet, useStore } from '../../store';
// components
import FormField from '../../components/FormField';
import LogoIcon from '../../icons/LogoIcon';
import { Button } from 'primereact/button';
import { Messages } from 'primereact/messages';
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
const LoginConfidi = () => {
const navigate = useNavigate();
const token = useStore().main.token();
const [loading, setLoading] = useState(false);
const errorMsgs = useRef(null);
const {
control,
handleSubmit,
formState: { errors },
} = useForm({ mode: 'onChange' });
const gotToResetPassword = () => {
navigate('/reset-password');
}
const onSubmit = (formData) => {
errorMsgs.current.clear();
setLoading(true);
const request = {
...formData,
hubUuid: APP_HUB_ID,
rememberMe: true
}
AuthenticationService.login(request, loginCallback, loginError);
};
const loginCallback = (data) => {
if (data.status === 'SUCCESS') {
storeSet.main.setAuthData({
token: data.data.token,
userData: data.data.user
});
} else {
errorMsgs.current.show([
{ sticky: true, severity: 'error', summary: '',
detail: data.message,
closable: true }
]);
}
setLoading(false);
}
const loginError = (err) => {
errorMsgs.current.show([
{ sticky: true, severity: 'error', summary: '',
detail: sprintf(__('%s', 'gepafin'), err.message),
closable: true }
]);
setLoading(false);
}
useEffect(() => {
if (!isEmpty(token)) {
setLoading(true);
window.location.replace('/')
}
}, [token]);
return (
<div className={classNames(['appPage', 'appPageLogin'])}>
<div className="appPageLogin__wrapper">
<LogoIcon/>
<h1>{__('Accedi', 'gepafin')}</h1>
<Messages ref={errorMsgs}/>
<div className="appPage__spacer"></div>
<form className="appForm" onSubmit={handleSubmit(onSubmit)}>
<FormField
type="textinput"
fieldName="email"
label={__('Email', 'gepafin')}
control={control}
errors={errors}
config={{ required: __('È obbligatorio', 'gepafin') }}
placeholder="sample@example.com"
/>
<FormField
type="textinput"
inputtype="password"
fieldName="password"
label={__('Password', 'gepafin')}
control={control}
errors={errors}
config={{ required: __('È obbligatorio', 'gepafin') }}
/>
<Button
label={__('Accedi', 'gepafin')}
disabled={loading}/>
<Button
label={__('Password dimenticata?', 'gepafin')}
link onClick={gotToResetPassword}/>
</form>
</div>
</div>
)
}
export default LoginConfidi;

View File

@@ -36,8 +36,8 @@ const ResetPassword = () => {
setValue setValue
} = useForm({ mode: 'onChange' }); } = useForm({ mode: 'onChange' });
const gotToLoginAdmin = () => { const gotToLogin = () => {
navigate('/loginadmin'); navigate('/confidi');
} }
const onSubmit = (formData) => { const onSubmit = (formData) => {
@@ -110,7 +110,6 @@ const ResetPassword = () => {
}, [token]); }, [token]);
useEffect(() => { useEffect(() => {
console.log(resetPassToken, resetPassEmail);
reset(); reset();
setValue('token', resetPassToken); setValue('token', resetPassToken);
setValue('email', resetPassEmail); setValue('email', resetPassEmail);
@@ -191,7 +190,7 @@ const ResetPassword = () => {
<Button <Button
label={__('Accedi', 'gepafin')} label={__('Accedi', 'gepafin')}
link onClick={gotToLoginAdmin}/> link onClick={gotToLogin}/>
</form> </form>
</div> </div>
</div> </div>

View File

@@ -0,0 +1,200 @@
import React, { useRef, useState, useEffect } from 'react';
import { __, sprintf } from '@wordpress/i18n';
import { useForm } from 'react-hook-form';
import { classNames } from 'primereact/utils';
import { isEmpty } from 'ramda';
import { useNavigate, useSearchParams } from 'react-router-dom';
// tools
import AuthenticationService from '../../service/authentication-service';
// store
import { useStore } from '../../store';
// components
import FormField from '../../components/FormField';
import LogoIcon from '../../icons/LogoIcon';
import { Button } from 'primereact/button';
import { Messages } from 'primereact/messages';
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
const ResetPasswordAdmin = () => {
const navigate = useNavigate();
const token = useStore().main.token();
const [loading, setLoading] = useState(false);
const [resetPassToken, setResetPassToken] = useState('');
const [resetPassEmail, setResetPassEmail] = useState('');
const errorMsgs = useRef(null);
let [searchParams] = useSearchParams();
const {
control,
handleSubmit,
formState: { errors },
reset,
register,
setValue
} = useForm({ mode: 'onChange' });
const gotToLogin = () => {
navigate('/loginadmin');
}
const onSubmit = (formData) => {
errorMsgs.current.clear();
setLoading(true);
const request = {
...formData,
hubUuid: APP_HUB_ID
}
if (request.token && !isEmpty(request.token)) {
AuthenticationService.resetPassword(request, getCallbackReset, errCallback);
} else {
AuthenticationService.forgotPassword(request, getCallback, errCallback);
}
};
const getCallbackReset = (data) => {
if (data.status === 'SUCCESS') {
errorMsgs.current.show([
{
sticky: true, severity: 'success', summary: '',
detail: data.message,
closable: true
}
]);
} else {
errorMsgs.current.show([
{
sticky: true, severity: 'error', summary: '',
detail: data.message,
closable: true
}
]);
}
setLoading(false);
}
const getCallback = (data) => {
if (data.status === 'SUCCESS') {
setResetPassToken(data.data)
} else {
errorMsgs.current.show([
{
sticky: true, severity: 'error', summary: '',
detail: data.message,
closable: true
}
]);
}
setLoading(false);
}
const errCallback = (err) => {
errorMsgs.current.show([
{
sticky: true, severity: 'error', summary: '',
detail: sprintf(__('%s', 'gepafin'), err.message),
closable: true
}
]);
setLoading(false);
}
useEffect(() => {
if (!isEmpty(token)) {
setLoading(true);
window.location.replace('/')
}
}, [token]);
useEffect(() => {
reset();
setValue('token', resetPassToken);
setValue('email', resetPassEmail);
}, [resetPassToken, resetPassEmail]);
useEffect(() => {
const token = searchParams.get('token');
const email = searchParams.get('email');
setResetPassToken(token);
setResetPassEmail(email);
}, [searchParams]);
return (
<div className={classNames(['appPage', 'appPageLogin'])}>
<div className="appPageLogin__wrapper">
<LogoIcon/>
<h1>{__('Password dimenticata', 'gepafin')}</h1>
<Messages ref={errorMsgs}/>
<div className="appPage__spacer"></div>
<form className="appForm" onSubmit={handleSubmit(onSubmit)}>
<FormField
type="textinput"
fieldName="email"
label={__('Email', 'gepafin')}
control={control}
errors={errors}
config={{ required: __('È obbligatorio', 'gepafin') }}
placeholder="sample@example.com"
/>
{resetPassToken && !isEmpty(resetPassToken)
? <input
type="hidden"
name="token"
{...register('token', {
required: true
})}
/> : null}
{resetPassToken && !isEmpty(resetPassToken)
? <FormField
type="password"
fieldName="newPassword"
label={__('Password', 'gepafin')}
control={control}
errors={errors}
config={{
required: __('È obbligatorio', 'gepafin'),
validate: {
passEqual: (value, values) => values.confirmPassword === value
}
}}
/> : null}
{resetPassToken && !isEmpty(resetPassToken)
? <FormField
type="password"
inputtype="password"
fieldName="confirmPassword"
label={__('Conferma password', 'gepafin')}
control={control}
errors={errors}
config={{
required: __('È obbligatorio', 'gepafin'),
validate: {
passEqual: (value, values) => values.newPassword === value
}
}}
/> : null}
<Button
label={__('Invia', 'gepafin')}
disabled={loading}/>
<Button
label={__('Accedi', 'gepafin')}
link onClick={gotToLogin}/>
</form>
</div>
</div>
)
}
export default ResetPasswordAdmin;

View File

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

View File

@@ -1,6 +1,6 @@
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef, useCallback } from 'react';
import { __ } from '@wordpress/i18n'; import { __ } from '@wordpress/i18n';
import { isEmpty, isNil } from 'ramda'; import { head, isEmpty, isNil } from 'ramda';
import { klona } from 'klona'; import { klona } from 'klona';
// store // store
@@ -11,7 +11,7 @@ import UserService from '../../service/user-service';
// tools // tools
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse'; import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
import { isEmail } from '../../helpers/validators'; import { isCodiceFiscale, isEmail, isPIVA } from '../../helpers/validators';
// components // components
import AllUsersTable from './components/AllUsersTable'; import AllUsersTable from './components/AllUsersTable';
@@ -34,7 +34,8 @@ const Users = () => {
phoneNumber: '', phoneNumber: '',
password: '', password: '',
confPassword: '', confPassword: '',
roleId: 0 roleId: 0,
codiceFiscale: ''
}); });
const [roles, setRoles] = useState([]); const [roles, setRoles] = useState([]);
const toast = useRef(null); const toast = useRef(null);
@@ -56,18 +57,27 @@ const Users = () => {
phoneNumber: '', phoneNumber: '',
password: '', password: '',
confPassword: '', confPassword: '',
roleId: 0 roleId: 0,
codiceFiscale: ''
}); });
} }
const saveEditDialog = () => { const saveEditDialog = () => {
const emptyValues = Object.values(newUserData).filter(v => isEmpty(v)); const isConfidi = isConfidiRoleChosen();
const emptyValues = Object.keys(newUserData)
.filter(v => v !== 'phoneNumber')
.filter(v => isConfidi ? v : v !== 'codiceFiscale')
.filter(v => isInvalidField(newUserData, v));
if (isEmpty(emptyValues) && newUserData.password === newUserData.confPassword && !loading) { if (isEmpty(emptyValues) && newUserData.password === newUserData.confPassword && !loading) {
setLoading(true); setLoading(true);
const body = { let body = klona({
...newUserData, ...newUserData,
hubUuid: APP_HUB_ID hubUuid: APP_HUB_ID
});
if (!isConfidi) {
delete body.codiceFiscale;
} }
UserService.createUser(body, createUserCallback, errCreateUserCallback); UserService.createUser(body, createUserCallback, errCreateUserCallback);
@@ -108,23 +118,33 @@ const Users = () => {
setNewUserData(userData); setNewUserData(userData);
} }
const footerEditDialog = () => { const footerEditDialog = useCallback(() => {
const isConfidi = isConfidiRoleChosen();
const errorValues = Object.keys(newUserData)
.filter(v => v !== 'phoneNumber')
.filter(v => isConfidi ? v : v !== 'codiceFiscale')
.filter(v => isInvalidField(newUserData, v));
return <div> return <div>
<Button type="button" label={__('Anulla', 'gepafin')} onClick={hideEditDialog} outlined/> <Button type="button" label={__('Anulla', 'gepafin')} onClick={hideEditDialog} outlined/>
<Button <Button
type="button" type="button"
disabled={isEmpty(newUserData) || loading} disabled={!isEmpty(errorValues) || loading}
label={__('Salva', 'gepafin')} onClick={saveEditDialog}/> label={__('Salva', 'gepafin')} onClick={saveEditDialog}/>
</div> </div>
} }, [newUserData]);
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', 'ROLE_INSTRUCTOR_MANAGER'].includes(o.roleType)) .filter(o => [
'ROLE_SUPER_ADMIN', 'ROLE_PRE_INSTRUCTOR', 'ROLE_INSTRUCTOR_MANAGER', 'ROLE_CONFIDI'
].includes(o.roleType))
.map(o => ({ .map(o => ({
name: o.roleName, name: o.roleName,
value: o.id value: o.id,
id: o.id,
roleType: o.roleType
})); }));
setRoles(roles); setRoles(roles);
} }
@@ -136,7 +156,14 @@ const Users = () => {
storeSet.main.unsetAsyncRequest(); storeSet.main.unsetAsyncRequest();
} }
const isInvalidField = (data, key) => isEmpty(data[key]) || isNil(data[key]) const isInvalidField = (data, key) => key === 'codiceFiscale'
? !isCodiceFiscale(data[key]) && !isPIVA(data[key])
: isEmpty(data[key]) || isNil(data[key]);
const isConfidiRoleChosen = useCallback(() => {
const chosen = head(roles.filter(o => o.id === newUserData.roleId));
return chosen ? chosen.roleType === 'ROLE_CONFIDI' : false;
}, [roles, newUserData])
useEffect(() => { useEffect(() => {
if (isVisibleEditDialog) { if (isVisibleEditDialog) {
@@ -151,7 +178,7 @@ const Users = () => {
</div> </div>
<div className="appPage__spacer"></div> <div className="appPage__spacer"></div>
<Toast ref={toast} /> <Toast ref={toast}/>
<div className="appPageSection"> <div className="appPageSection">
<div className="appPageSection__actions"> <div className="appPageSection__actions">
@@ -201,13 +228,11 @@ const Users = () => {
onChange={(e) => onChangeEditItem(e.target.value, 'email')}/> onChange={(e) => onChangeEditItem(e.target.value, 'email')}/>
</div> </div>
<div className="appForm__field"> <div className="appForm__field">
<label <label>
className={classNames({ 'p-error': isInvalidField(newUserData, 'phoneNumber') })}>
{__('Telefono', 'gepafin')} {__('Telefono', 'gepafin')}
</label> </label>
<InputText value={newUserData.phoneNumber} <InputText value={newUserData.phoneNumber}
keyfilter="int" keyfilter="int"
invalid={isInvalidField(newUserData, 'phoneNumber')}
onChange={(e) => onChangeEditItem(e.target.value, 'phoneNumber')}/> onChange={(e) => onChangeEditItem(e.target.value, 'phoneNumber')}/>
</div> </div>
</div> </div>
@@ -244,6 +269,16 @@ const Users = () => {
optionLabel="name" optionLabel="name"
optionValue="value"/> optionValue="value"/>
</div> </div>
{isConfidiRoleChosen()
? <div className="appForm__field">
<label
className={classNames({ 'p-error': isInvalidField(newUserData, 'codiceFiscale') })}>
{__('Codice Fiscale', 'gepafin')}*
</label>
<InputText value={newUserData.codiceFiscale}
invalid={isInvalidField(newUserData, 'codiceFiscale')}
onChange={(e) => onChangeEditItem(e.target.value, 'codiceFiscale')}/>
</div> : null}
<div className="appPage__spacer"></div> <div className="appPage__spacer"></div>
</Dialog> </Dialog>
</div> </div>

View File

@@ -52,6 +52,8 @@ import SoccorsoIstruttorioInstructorManager from './pages/SoccorsoIstruttorioIns
import SoccorsoIstruttorioMioInstructorManager from './pages/SoccorsoIstruttorioMioInstructorManager'; import SoccorsoIstruttorioMioInstructorManager from './pages/SoccorsoIstruttorioMioInstructorManager';
import StatsBeneficiary from './pages/StatsBeneficiary'; import StatsBeneficiary from './pages/StatsBeneficiary';
import DocumentsBeneficiary from './pages/DocumentsBeneficiary'; import DocumentsBeneficiary from './pages/DocumentsBeneficiary';
import LoginConfidi from './pages/LoginConfidi';
import ResetPasswordAdmin from './pages/ResetPasswordAdmin';
const routes = ({ role, chosenCompanyId }) => { const routes = ({ role, chosenCompanyId }) => {
@@ -61,199 +63,233 @@ const routes = ({ role, chosenCompanyId }) => {
<Route path="/" element={<DefaultLayout> <Route path="/" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <Dashboard/> : null} {'ROLE_SUPER_ADMIN' === role ? <Dashboard/> : null}
{'ROLE_BENEFICIARY' === role ? <DashboardBeneficiario/> : null} {'ROLE_BENEFICIARY' === role ? <DashboardBeneficiario/> : null}
{'ROLE_CONFIDI' === role ? <DashboardBeneficiario/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <DashboardPreInstructor/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <DashboardPreInstructor/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <DashboardInstructorManager/> : null} {'ROLE_INSTRUCTOR_MANAGER' === role ? <DashboardInstructorManager/> : 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_CONFIDI' === role ? <BandiBeneficiario/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <BandiPreInstructor/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <BandiPreInstructor/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <BandiPreInstructor/> : null} {'ROLE_INSTRUCTOR_MANAGER' === role ? <BandiPreInstructor/> : 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_CONFIDI' === role ? <BandoViewBeneficiario/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <BandoViewPreInstructor/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <BandoViewPreInstructor/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <BandoViewPreInstructor/> : null} {'ROLE_INSTRUCTOR_MANAGER' === role ? <BandoViewPreInstructor/> : 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_CONFIDI' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === 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_CONFIDI' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === 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_CONFIDI' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === 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_CONFIDI' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === 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_CONFIDI' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === 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_CONFIDI' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === 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_CONFIDI' === role ? <BandiPreferredBeneficiario/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === 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_CONFIDI' === role ? <DomandeBeneficiario/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <DomandePreInstructor/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <DomandePreInstructor/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <DomandeInstructorManager/> : 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 ? <SoccorsoEditBeneficiario/> : null} {'ROLE_BENEFICIARY' === role ? <SoccorsoEditBeneficiario/> : null}
{'ROLE_CONFIDI' === role ? <SoccorsoEditBeneficiario/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <DomandaEditPreInstructor/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <DomandaEditPreInstructor/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <DomandaEditPreInstructor/> : null} {'ROLE_INSTRUCTOR_MANAGER' === role ? <DomandaEditPreInstructor/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/domande/:id/preview" element={<DefaultLayout> <Route path="/domande/:id/preview" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <BandoApplicationPreview/> : null} {'ROLE_SUPER_ADMIN' === role ? <BandoApplicationPreview/> : null}
{'ROLE_BENEFICIARY' === role ? <BandoApplicationPreview/> : null} {'ROLE_BENEFICIARY' === role ? <BandoApplicationPreview/> : null}
{'ROLE_CONFIDI' === role ? <BandoApplicationPreview/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <BandoApplicationPreview/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <BandoApplicationPreview/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <BandoApplicationPreview/> : null} {'ROLE_INSTRUCTOR_MANAGER' === role ? <BandoApplicationPreview/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/domande-archivio" element={<DefaultLayout> <Route path="/domande-archivio" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <DomandeArchive/> : null} {'ROLE_SUPER_ADMIN' === role ? <DomandeArchive/> : null}
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null} {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
{'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <DomandeArchivePreInstructor/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <DomandeArchivePreInstructor/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <DomandeArchive/> : null} {'ROLE_INSTRUCTOR_MANAGER' === role ? <DomandeArchive/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/domande-archivio/:id/preview" element={<DefaultLayout> <Route path="/domande-archivio/:id/preview" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <BandoApplicationPreview/> : null} {'ROLE_SUPER_ADMIN' === role ? <BandoApplicationPreview/> : null}
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null} {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
{'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <BandoApplicationPreview/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <BandoApplicationPreview/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <BandoApplicationPreview/> : 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_CONFIDI' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <SoccorsoAddPreInstructor/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <SoccorsoAddPreInstructor/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null} {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : 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_CONFIDI' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <SoccorsoEditPreInstructor/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <SoccorsoEditPreInstructor/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === 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_CONFIDI' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <SoccorsoIstruttorioPreInstructor/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <SoccorsoIstruttorioPreInstructor/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoIstruttorioInstructorManager/> : null} {'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoIstruttorioInstructorManager/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/mie-domande" element={<DefaultLayout> <Route path="/mie-domande" 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_CONFIDI' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <DomandeMieInstructorManager/> : null} {'ROLE_INSTRUCTOR_MANAGER' === role ? <DomandeMieInstructorManager/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/mie-domande/:id/" element={<DefaultLayout> <Route path="/mie-domande/:id/" 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_CONFIDI' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <DomandaEditInstructorManager/> : null} {'ROLE_INSTRUCTOR_MANAGER' === role ? <DomandaEditInstructorManager/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/mie-domande/:id/aggiungi-soccorso" element={<DefaultLayout> <Route path="/mie-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_CONFIDI' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoAddInstructorManager/> : null} {'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoAddInstructorManager/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/mie-domande/:id/soccorso/:amendmentId" element={<DefaultLayout> <Route path="/mie-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_CONFIDI' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoEditInstructorManager/> : null} {'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoEditInstructorManager/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/mio-soccorso-istruttorio/" element={<DefaultLayout> <Route path="/mio-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_CONFIDI' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoIstruttorioMioInstructorManager/> : null} {'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoIstruttorioMioInstructorManager/> : 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_CONFIDI' === role ? <Applications/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === 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_CONFIDI' === role ? <BandoApplication/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === 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_CONFIDI' === role ? <ProfileBeneficiario/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <Profile/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <Profile/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === 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_CONFIDI' === role && chosenCompanyId > 0 ? <ProfileCompany/> : <PageNotFound/>}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === 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_CONFIDI' === role ? <AddCompany/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === 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_CONFIDI' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null} {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/utenti/:id" element={<DefaultLayout> <Route path="/utenti/:id" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <UserActivity/> : null} {'ROLE_SUPER_ADMIN' === role ? <UserActivity/> : null}
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null} {'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
{'ROLE_CONFIDI' === role ? <PageNotFound/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null} {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/stats" element={<DefaultLayout> <Route path="/stats" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null} {'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
{'ROLE_BENEFICIARY' === role ? <StatsBeneficiary/> : null} {'ROLE_BENEFICIARY' === role ? <StatsBeneficiary/> : null}
{'ROLE_CONFIDI' === role ? <StatsBeneficiary/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null} {'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : null}
</DefaultLayout>}/> </DefaultLayout>}/>
<Route path="/documenti" element={<DefaultLayout> <Route path="/documenti" element={<DefaultLayout>
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null} {'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
{'ROLE_BENEFICIARY' === role ? <DocumentsBeneficiary/> : null} {'ROLE_BENEFICIARY' === role ? <DocumentsBeneficiary/> : null}
{'ROLE_CONFIDI' === role ? <DocumentsBeneficiary/> : null}
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null} {'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
{'ROLE_INSTRUCTOR_MANAGER' === 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/>}/>
<Route exact path="/reset-password-admin" element={<ResetPasswordAdmin/>}/>
<Route exact path="/login" element={<Login/>}/> <Route exact path="/login" element={<Login/>}/>
<Route exact path="/loginAdmin" element={<LoginAdmin/>}/> <Route exact path="/loginadmin" element={<LoginAdmin/>}/>
<Route exact path="/confidi" element={<LoginConfidi/>}/>
<Route exact path="/registration" element={<Registration/>}/> <Route exact path="/registration" element={<Registration/>}/>
<Route path="*" element={<PageNotFound/>}/> <Route path="*" element={<PageNotFound/>}/>
</Routes>) </Routes>)

View File

@@ -9,7 +9,7 @@ export class NetworkService {
} else if (status === 403) { } else if (status === 403) {
storeSet.main.token(''); storeSet.main.token('');
const { pathname } = window.location; const { pathname } = window.location;
if (!['/login', '/loginadmin', '/reset-password', '/registration'].includes(pathname)) { if (!['/login', '/registration', '/loginadmin', '/reset-password-admin', '/confidi', '/reset-password'].includes(pathname)) {
window.location.replace('/login'); window.location.replace('/login');
} }
} }