- saving progress;
This commit is contained in:
@@ -116,6 +116,20 @@ img {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
li div.nonLink {
|
||||||
|
display: flex;
|
||||||
|
padding: 10.5px 17.5px;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 14px;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 100%;
|
||||||
|
text-decoration: none;
|
||||||
|
border-bottom: 1px solid var(--menu-borderColor);
|
||||||
|
background-color: var(--button-secondary-borderColor);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,69 +53,97 @@ const AppSidebar = () => {
|
|||||||
icon: 'pi pi-file',
|
icon: 'pi pi-file',
|
||||||
href: '/domande',
|
href: '/domande',
|
||||||
id: 6,
|
id: 6,
|
||||||
enable: intersection(permissions, ['VIEW_USERS', 'MANAGE_USERS']).length
|
enable: intersection(permissions, ['VIEW_USERS', 'MANAGE_USERS', 'ASSIGED_APPLICATION']).length
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: __('Domande da valutare', 'gepafin'),
|
label: __('Domande da valutare', 'gepafin'),
|
||||||
icon: 'pi pi-calendar-clock',
|
icon: 'pi pi-calendar-clock',
|
||||||
href: '/domande',
|
href: '/domande',
|
||||||
id: 7,
|
id: 7,
|
||||||
|
enable: intersection(permissions, ['EVALUATE_APPLICATIONS']).length && !intersection(permissions, ['ASSIGED_APPLICATION']).length
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: __('Bandi attivi', 'gepafin'),
|
||||||
|
icon: 'pi pi-file',
|
||||||
|
href: '/bandi',
|
||||||
|
id: 8,
|
||||||
|
enable: intersection(permissions, ['EVALUATE_APPLICATIONS']).length
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: __('Soccorso', 'gepafin'),
|
||||||
|
icon: <HelpIcon/>,
|
||||||
|
href: '/soccorso-istruttorio',
|
||||||
|
id: 9,
|
||||||
enable: intersection(permissions, ['EVALUATE_APPLICATIONS']).length
|
enable: intersection(permissions, ['EVALUATE_APPLICATIONS']).length
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: __('Archivio domande', 'gepafin'),
|
label: __('Archivio domande', 'gepafin'),
|
||||||
icon: 'pi pi-briefcase',
|
icon: 'pi pi-briefcase',
|
||||||
href: '/domande',
|
href: '/domande',
|
||||||
id: 8,
|
id: 10,
|
||||||
enable: intersection(permissions, ['APPLY_CALLS']).length
|
enable: intersection(permissions, ['APPLY_CALLS']).length
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: __('Archivio domande', 'gepafin'),
|
label: __('Archivio domande', 'gepafin'),
|
||||||
icon: 'pi pi-briefcase',
|
icon: 'pi pi-briefcase',
|
||||||
href: '/domande-archivio',
|
href: '/domande-archivio',
|
||||||
id: 9,
|
id: 11,
|
||||||
enable: intersection(permissions, ['VIEW_USERS', 'MANAGE_USERS']).length
|
enable: intersection(permissions, ['VIEW_USERS', 'MANAGE_USERS']).length
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: __('Archivio domande', 'gepafin'),
|
label: __('Archivio domande', 'gepafin'),
|
||||||
icon: 'pi pi-briefcase',
|
icon: 'pi pi-briefcase',
|
||||||
href: '/domande-archivio',
|
href: '/domande-archivio',
|
||||||
id: 10,
|
id: 12,
|
||||||
enable: intersection(permissions, ['EVALUATE_APPLICATIONS']).length
|
enable: intersection(permissions, ['EVALUATE_APPLICATIONS']).length
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: __('Area personale', 'gepafin'),
|
||||||
|
icon: 'pi pi-calendar-clock',
|
||||||
|
id: 17,
|
||||||
|
enable: intersection(permissions, ['ASSIGED_APPLICATION']).length
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: __('Domande da valutare', 'gepafin'),
|
||||||
|
icon: 'pi pi-calendar-clock',
|
||||||
|
href: '/mie-domande',
|
||||||
|
id: 18,
|
||||||
|
enable: intersection(permissions, ['ASSIGED_APPLICATION']).length
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: __('Soccorso istruttorio', 'gepafin'),
|
label: __('Soccorso istruttorio', 'gepafin'),
|
||||||
icon: <HelpIcon/>,
|
icon: <HelpIcon/>,
|
||||||
href: '/soccorso-istruttorio',
|
href: '/mio-soccorso-istruttorio',
|
||||||
id: 11,
|
id: 19,
|
||||||
enable: intersection(permissions, ['EVALUATE_APPLICATIONS']).length
|
enable: intersection(permissions, ['ASSIGED_APPLICATION']).length
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: __('Gestione utenti', 'gepafin'),
|
label: __('Gestione utenti', 'gepafin'),
|
||||||
icon: 'pi pi-users',
|
icon: 'pi pi-users',
|
||||||
href: '/utenti',
|
href: '/utenti',
|
||||||
id: 12,
|
id: 13,
|
||||||
enable: intersection(permissions, ['VIEW_USERS', 'MANAGE_USERS']).length
|
enable: intersection(permissions, ['VIEW_USERS', 'MANAGE_USERS']).length
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: __('Configurazione', 'gepafin'),
|
label: __('Configurazione', 'gepafin'),
|
||||||
icon: 'pi pi-cog',
|
icon: 'pi pi-cog',
|
||||||
//href: '/configurazione',
|
//href: '/configurazione',
|
||||||
id: 13,
|
id: 14,
|
||||||
enable: false
|
enable: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: __('Report e Analisi', 'gepafin'),
|
label: __('Report e Analisi', 'gepafin'),
|
||||||
icon: 'pi pi-chart-bar',
|
icon: 'pi pi-chart-bar',
|
||||||
//href: '/stats',
|
//href: '/stats',
|
||||||
id: 14,
|
id: 15,
|
||||||
enable: false
|
enable: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: __('Log di Sistema', 'gepafin'),
|
label: __('Log di Sistema', 'gepafin'),
|
||||||
icon: 'pi pi-receipt',
|
icon: 'pi pi-receipt',
|
||||||
clickFn: () => {},
|
clickFn: () => {
|
||||||
id: 15,
|
},
|
||||||
|
id: 16,
|
||||||
enable: false
|
enable: false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -132,12 +160,17 @@ const AppSidebar = () => {
|
|||||||
: o.icon}
|
: o.icon}
|
||||||
<span>{o.label}</span>
|
<span>{o.label}</span>
|
||||||
</NavLink>
|
</NavLink>
|
||||||
: <button onClick={() => {}}>
|
: (o.clickFn ?
|
||||||
|
<button onClick={() => {
|
||||||
|
}}>
|
||||||
{is(String, o.icon)
|
{is(String, o.icon)
|
||||||
? <i className={o.icon}></i>
|
? <i className={o.icon}></i>
|
||||||
: o.icon}
|
: o.icon}
|
||||||
<span>{o.label}</span>
|
<span>{o.label}</span>
|
||||||
</button>}
|
</button>
|
||||||
|
: <div className="nonLink">
|
||||||
|
<span>{o.label}</span>
|
||||||
|
</div>)}
|
||||||
</li>)}
|
</li>)}
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
|
|||||||
149
src/pages/BandiPreInstructor/components/AllBandiTable/index.js
Normal file
149
src/pages/BandiPreInstructor/components/AllBandiTable/index.js
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
import React, { useState, useEffect} from 'react';
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
import { is, uniq } from 'ramda';
|
||||||
|
|
||||||
|
// tools
|
||||||
|
import getBandoSeverity from '../../../../helpers/getBandoSeverity';
|
||||||
|
import getBandoLabel from '../../../../helpers/getBandoLabel';
|
||||||
|
import getDateFromISOstring from '../../../../helpers/getDateFromISOstring';
|
||||||
|
|
||||||
|
// api
|
||||||
|
import BandoService from '../../../../service/bando-service';
|
||||||
|
|
||||||
|
// components
|
||||||
|
import { FilterMatchMode, FilterOperator } from 'primereact/api';
|
||||||
|
import { DataTable } from 'primereact/datatable';
|
||||||
|
import { Column } from 'primereact/column';
|
||||||
|
import { Dropdown } from 'primereact/dropdown';
|
||||||
|
import { Button } from 'primereact/button';
|
||||||
|
import { Calendar } from 'primereact/calendar';
|
||||||
|
import { Tag } from 'primereact/tag';
|
||||||
|
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
import translationStrings from '../../../../translationStringsForComponents';
|
||||||
|
|
||||||
|
|
||||||
|
const AllBandiTable = () => {
|
||||||
|
const [items, setItems] = useState(null);
|
||||||
|
const [filters, setFilters] = useState(null);
|
||||||
|
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
||||||
|
const [statuses, setStatuses] = useState([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setLocalAsyncRequest(true);
|
||||||
|
BandoService.getBandi(getCallback, errGetCallbacks);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const getCallback = (data) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
setItems(getFormattedBandiData(data.data));
|
||||||
|
setStatuses(uniq(data.data.map(o => o.status)))
|
||||||
|
initFilters();
|
||||||
|
}
|
||||||
|
setLocalAsyncRequest(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
const errGetCallbacks = (data) => {
|
||||||
|
setLocalAsyncRequest(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
const getFormattedBandiData = (data) => {
|
||||||
|
return data.map((d) => {
|
||||||
|
d.dates = d.dates.map(v => is(String, v) ? new Date(v) : (v ? v : ''));
|
||||||
|
return d;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const clearFilter = () => {
|
||||||
|
initFilters();
|
||||||
|
};
|
||||||
|
|
||||||
|
const initFilters = () => {
|
||||||
|
setFilters({
|
||||||
|
global: { value: null, matchMode: FilterMatchMode.CONTAINS },
|
||||||
|
name: { operator: FilterOperator.AND, constraints: [{ value: null, matchMode: FilterMatchMode.STARTS_WITH }] },
|
||||||
|
start_date: { operator: FilterOperator.AND, constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }] },
|
||||||
|
end_date: { operator: FilterOperator.AND, constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }] },
|
||||||
|
status: { operator: FilterOperator.OR, constraints: [{ value: null, matchMode: FilterMatchMode.EQUALS }] },
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const renderHeader = () => {
|
||||||
|
return (
|
||||||
|
<div className="appTableHeader">
|
||||||
|
<Button type="button" icon="pi pi-filter-slash" label={__('Pulisci', 'gepafin')} outlined onClick={clearFilter} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
/*const nameBodyTemplate = (rowData) => {
|
||||||
|
return <span>{rowData.name}</span>
|
||||||
|
}*/
|
||||||
|
|
||||||
|
const dateStartBodyTemplate = (rowData) => {
|
||||||
|
return getDateFromISOstring(rowData.dates[0]);
|
||||||
|
};
|
||||||
|
|
||||||
|
const dateEndBodyTemplate = (rowData) => {
|
||||||
|
return getDateFromISOstring(rowData.dates[1]);
|
||||||
|
};
|
||||||
|
|
||||||
|
const dateFilterTemplate = (options) => {
|
||||||
|
return <Calendar value={options.value} onChange={(e) => options.filterCallback(e.value, options.index)} dateFormat="mm/dd/yy" placeholder="mm/dd/yyyy" mask="99/99/9999" />;
|
||||||
|
};
|
||||||
|
|
||||||
|
const statusBodyTemplate = (rowData) => {
|
||||||
|
return <ProperBandoLabel status={rowData.status}/>;
|
||||||
|
};
|
||||||
|
|
||||||
|
const statusFilterTemplate = (options) => {
|
||||||
|
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 statusItemTemplate = (option) => {
|
||||||
|
return <Tag value={getBandoLabel(option)} severity={getBandoSeverity(option)} />;
|
||||||
|
};
|
||||||
|
|
||||||
|
const actionsBodyTemplate = (rowData) => {
|
||||||
|
return <Link to={`/bandi/${rowData.id}`}>
|
||||||
|
<Button severity="info" label={__('Mostra', 'gepafin')} icon="pi pi-eye" size="small" iconPos="right" />
|
||||||
|
</Link>
|
||||||
|
}
|
||||||
|
|
||||||
|
const header = renderHeader();
|
||||||
|
|
||||||
|
return(
|
||||||
|
<div className="appPageSection__table">
|
||||||
|
<DataTable value={items} paginator showGridlines rows={5} loading={localAsyncRequest} dataKey="id"
|
||||||
|
filters={filters} stripedRows removableSort
|
||||||
|
header={header}
|
||||||
|
emptyMessage={translationStrings.emptyMessage}
|
||||||
|
onFilter={(e) => setFilters(e.filters)}>
|
||||||
|
<Column field="name" header={__('Nome Bando', 'gepafin')}
|
||||||
|
filter sortable
|
||||||
|
filterPlaceholder={__('Cerca', 'gepafin')}
|
||||||
|
style={{ minWidth: '8rem' }}/>
|
||||||
|
<Column header={__('Data Pubblicazione', 'gepafin')} filterField="start_date" dataType="date"
|
||||||
|
style={{ minWidth: '8rem' }}
|
||||||
|
body={dateStartBodyTemplate} filter filterElement={dateFilterTemplate}/>
|
||||||
|
<Column header={__('Data Scadenza', 'gepafin')} filterField="end_date" dataType="date"
|
||||||
|
style={{ minWidth: '8rem' }}
|
||||||
|
body={dateEndBodyTemplate} filter filterElement={dateFilterTemplate}/>
|
||||||
|
<Column field="status" header={__('Stato', 'gepafin')} filterMenuStyle={{ width: '14rem' }}
|
||||||
|
style={{ minWidth: '7rem' }} body={statusBodyTemplate} filter
|
||||||
|
filterElement={statusFilterTemplate}/>
|
||||||
|
<Column header={__('Azioni', 'gepafin')}
|
||||||
|
body={actionsBodyTemplate}/>
|
||||||
|
</DataTable>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AllBandiTable;
|
||||||
27
src/pages/BandiPreInstructor/index.js
Normal file
27
src/pages/BandiPreInstructor/index.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
// components
|
||||||
|
import AllBandiTable from './components/AllBandiTable';
|
||||||
|
import { Button } from 'primereact/button';
|
||||||
|
|
||||||
|
const BandiPreInstructor = () => {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
return(
|
||||||
|
<div className="appPage">
|
||||||
|
<div className="appPage__pageHeader">
|
||||||
|
<h1>{__('Bandi attivi', 'gepafin')}</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
|
<div className="appPageSection">
|
||||||
|
<AllBandiTable/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default BandiPreInstructor;
|
||||||
274
src/pages/BandoViewPreInstructor/index.js
Normal file
274
src/pages/BandoViewPreInstructor/index.js
Normal file
@@ -0,0 +1,274 @@
|
|||||||
|
import React, { useState, useEffect, useRef } from 'react';
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
import { useNavigate, useParams } from 'react-router-dom';
|
||||||
|
import { is, isEmpty, isNil } from 'ramda';
|
||||||
|
import 'quill/dist/quill.core.css';
|
||||||
|
|
||||||
|
// store
|
||||||
|
import { storeSet, useStore } from '../../store';
|
||||||
|
|
||||||
|
// tools
|
||||||
|
import getNumberWithCurrency from '../../helpers/getNumberWithCurrency';
|
||||||
|
import getDateFromISOstring from '../../helpers/getDateFromISOstring';
|
||||||
|
|
||||||
|
// components
|
||||||
|
import { Skeleton } from 'primereact/skeleton';
|
||||||
|
import { Accordion } from 'primereact/accordion';
|
||||||
|
import { AccordionTab } from 'primereact/accordion';
|
||||||
|
import { InputTextarea } from 'primereact/inputtextarea';
|
||||||
|
import { Button } from 'primereact/button';
|
||||||
|
import BandoService from '../../service/bando-service';
|
||||||
|
import { Messages } from 'primereact/messages';
|
||||||
|
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
||||||
|
import renderHtmlContent from '../../helpers/renderHtmlContent';
|
||||||
|
|
||||||
|
const REACT_APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
||||||
|
|
||||||
|
const BandoViewPreInstructor = () => {
|
||||||
|
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||||
|
const { id } = useParams();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const [data, setData] = useState({});
|
||||||
|
const [newQuestion, setNewQuestion] = useState('');
|
||||||
|
const bandoMsgs = useRef(null);
|
||||||
|
|
||||||
|
const closePreview = () => {
|
||||||
|
navigate(`/bandi/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const getCallback = (data) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
setData(getFormattedBandiData(data.data));
|
||||||
|
}
|
||||||
|
storeSet.main.unsetAsyncRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
const errGetCallback = (data) => {
|
||||||
|
if (bandoMsgs.current && data.message) {
|
||||||
|
bandoMsgs.current.show([
|
||||||
|
{
|
||||||
|
sticky: true, severity: 'error', summary: '',
|
||||||
|
detail: data.message,
|
||||||
|
closable: true
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
set404FromErrorResponse(data);
|
||||||
|
storeSet.main.unsetAsyncRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
const getFormattedBandiData = (data) => {
|
||||||
|
data.dates = data.dates.map(v => is(String, v) ? new Date(v) : (v ? v : ''));
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const parsed = parseInt(id)
|
||||||
|
const bandoId = !isNaN(parsed) ? parsed : 0;
|
||||||
|
|
||||||
|
BandoService.getBando(bandoId, getCallback, errGetCallback);
|
||||||
|
}, [id]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="appPage">
|
||||||
|
{!isAsyncRequest && !isEmpty(data)
|
||||||
|
? <div className="appPage__pageHeader">
|
||||||
|
<h1>{data.name}</h1>
|
||||||
|
<p>
|
||||||
|
{__('Data:', 'gepafin')}
|
||||||
|
<span>{getDateFromISOstring(data.createdDate)}</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
: <>
|
||||||
|
<Skeleton width="20%" height="1rem" className="mb-2"></Skeleton>
|
||||||
|
<Skeleton width="100%" height="2rem" className="mb-8"></Skeleton>
|
||||||
|
</>}
|
||||||
|
|
||||||
|
<div className="appPage__spacer"></div>
|
||||||
|
<Messages ref={bandoMsgs}/>
|
||||||
|
|
||||||
|
{!isAsyncRequest && !isEmpty(data)
|
||||||
|
? <div className="appPage__content">
|
||||||
|
{!isEmpty(data.images)
|
||||||
|
? <picture className="appPageSection__hero">
|
||||||
|
<source srcSet={data.images[0] ? data.images[0].filePath : ''}/>
|
||||||
|
<img src={data.images[0] ? data.images[0].filePath : ''} alt={data.name}/>
|
||||||
|
</picture> : null}
|
||||||
|
|
||||||
|
<div className="appPageSection__withBorder">
|
||||||
|
<h2>{__('Descrizione breve', 'gepafin')}</h2>
|
||||||
|
<div className="ql-editor">
|
||||||
|
{renderHtmlContent(data.descriptionShort)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPageSection__row">
|
||||||
|
<div className="appPageSection__withBorder">
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('Importo totale', 'gepafin')}</span>
|
||||||
|
<span>{getNumberWithCurrency(data.amount)}</span>
|
||||||
|
</p>
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('Importo minimo per progetto', 'gepafin')}</span>
|
||||||
|
<span>{getNumberWithCurrency(data.amountMin)}</span>
|
||||||
|
</p>
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('Importo massimo per progetto', 'gepafin')}</span>
|
||||||
|
<span>{getNumberWithCurrency(data.amountMax)}</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPageSection__withBorder">
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('Data apertura', 'gepafin')}</span>
|
||||||
|
<span>{getDateFromISOstring(data.dates[0])} {data.startTime}</span>
|
||||||
|
</p>
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('Data chiusura', 'gepafin')}</span>
|
||||||
|
<span>{getDateFromISOstring(data.dates[1])} {data.endTime}</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPageSection__withBorder">
|
||||||
|
<h2>{__('Descrizione dettagliata', 'gepafin')}</h2>
|
||||||
|
<div className="ql-editor">
|
||||||
|
{renderHtmlContent(data.descriptionLong)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPageSection__withBorder">
|
||||||
|
<h2>{__('Requisiti di Partecipazione', 'gepafin')}</h2>
|
||||||
|
<div className="row rowContent">
|
||||||
|
<ul>
|
||||||
|
{data.aimedTo.map((o, i) => <li key={i}>
|
||||||
|
{o.value}
|
||||||
|
</li>)}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPageSection__withBorder">
|
||||||
|
<h2>{__('Documentazione richiesta', 'gepafin')}</h2>
|
||||||
|
<div className="ql-editor">
|
||||||
|
{renderHtmlContent(data.documentationRequested)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/*<div className="appPageSection__withBorder">
|
||||||
|
<h2>{__('Criteri di Valutazione', 'gepafin')}</h2>
|
||||||
|
<div className="row rowContent">
|
||||||
|
<ul>
|
||||||
|
{data.criteria.map((o, i) => <li key={i}>
|
||||||
|
{o.value} {o.score > 0 ? sprintf(__(' (%d punti)'), o.score) : null}
|
||||||
|
</li>)}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>*/}
|
||||||
|
|
||||||
|
<div className="appPageSection__withBorder">
|
||||||
|
<h2>{__('Allegati', 'gepafin')}</h2>
|
||||||
|
<div className="row rowContent">
|
||||||
|
<ul>
|
||||||
|
{data.docs
|
||||||
|
.filter(o => o.source === 'CALL' && o.type === 'DOCUMENT')
|
||||||
|
.map((o, i) => <li key={i}>
|
||||||
|
<a href={o.filePath} target="_blank" rel="noreferrer">{o.name}</a>
|
||||||
|
</li>)}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPageSection">
|
||||||
|
<h2>{__('FAQ', 'gepafin')}</h2>
|
||||||
|
<Accordion>
|
||||||
|
{data.faq
|
||||||
|
.filter(o => o.isVisible)
|
||||||
|
.map((o, i) => <AccordionTab key={i} header={renderHtmlContent(o.value)}>
|
||||||
|
<div className="ql-editor">
|
||||||
|
{renderHtmlContent(o.response)}
|
||||||
|
</div>
|
||||||
|
</AccordionTab>)}
|
||||||
|
</Accordion>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{REACT_APP_HUB_ID === 't7jh5wfg9QXylNaTZkPoE'
|
||||||
|
? null
|
||||||
|
: <div className="appPageSection">
|
||||||
|
<h2>{__('Non hai trovato la risposta che cercavi?', 'gepafin')}</h2>
|
||||||
|
<div className="appForm__field">
|
||||||
|
<label htmlFor="newQuestion">{__('Fai una domanda', 'gepafin')}</label>
|
||||||
|
<InputTextarea
|
||||||
|
id="newQuestion"
|
||||||
|
disabled
|
||||||
|
rows={7}
|
||||||
|
value={newQuestion}
|
||||||
|
placeholder={__('Digita qui la tua domanda', 'gepafin')}
|
||||||
|
onChange={(e) => setNewQuestion(e.target.value)}
|
||||||
|
aria-describedby="newQuestion-help"/>
|
||||||
|
<small id="newQuestion-help">
|
||||||
|
{__('Riceverai una notifica quando ti risponderemo', 'gepafin')}
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
</div>}
|
||||||
|
|
||||||
|
<div className="appPageSection">
|
||||||
|
<h2>{__('Download Documenti', 'gepafin')}</h2>
|
||||||
|
<div className="appPageSection__actions">
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
outlined
|
||||||
|
onClick={() => {
|
||||||
|
}}
|
||||||
|
label={__('Scarica Bando Completo', 'gepafin')}
|
||||||
|
icon="pi pi-download" iconPos="right"/>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
outlined
|
||||||
|
onClick={() => {
|
||||||
|
}}
|
||||||
|
label={__('Scarica Modulistica', 'gepafin')}
|
||||||
|
icon="pi pi-download" iconPos="right"/>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
disabled={true}
|
||||||
|
onClick={() => {
|
||||||
|
}}
|
||||||
|
label={__('Presenta Domanda', 'gepafin')}
|
||||||
|
icon="pi pi-save" iconPos="right"/>
|
||||||
|
{/*<Button
|
||||||
|
type="button"
|
||||||
|
outlined
|
||||||
|
rounded
|
||||||
|
disabled={true}
|
||||||
|
onClick={() => {}}
|
||||||
|
label={__('Aggiungi a preferiti', 'gepafin')}
|
||||||
|
icon="pi pi-heart" iconPos="left"/>*/}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPageSection__withBorder">
|
||||||
|
<h2>{__('Contatti per Assistenza', 'gepafin')}</h2>
|
||||||
|
<div className="row rowContent">
|
||||||
|
<p>Email: {data.email}</p>
|
||||||
|
{!isNil(data.phoneNumber) ?
|
||||||
|
<p>{__('Telefono', 'gepafin')}: +39 {data.phoneNumber}</p> : null}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
: <>
|
||||||
|
<Skeleton width="20%" height="1rem" className="mb-2"></Skeleton>
|
||||||
|
<Skeleton width="100%" height="2rem" className="mb-8"></Skeleton>
|
||||||
|
<Skeleton width="20%" height="1rem" className="mb-2"></Skeleton>
|
||||||
|
<Skeleton width="100%" height="4rem" className="mb-8"></Skeleton>
|
||||||
|
<Skeleton width="20%" height="1rem" className="mb-2"></Skeleton>
|
||||||
|
<Skeleton width="100%" height="2rem" className="mb-8"></Skeleton>
|
||||||
|
<Skeleton width="20%" height="1rem" className="mb-2"></Skeleton>
|
||||||
|
<Skeleton width="100%" height="4rem"></Skeleton>
|
||||||
|
</>}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export default BandoViewPreInstructor;
|
||||||
@@ -0,0 +1,195 @@
|
|||||||
|
import React, { useState, useEffect} from 'react';
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
import { is, uniq, isNil } from 'ramda';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
|
// api
|
||||||
|
import AssignedApplicationService from '../../../../service/assigned-application-service';
|
||||||
|
|
||||||
|
// tools
|
||||||
|
import getBandoLabel from '../../../../helpers/getBandoLabel';
|
||||||
|
import getBandoSeverity from '../../../../helpers/getBandoSeverity';
|
||||||
|
|
||||||
|
// components
|
||||||
|
import { FilterMatchMode, FilterOperator } from 'primereact/api';
|
||||||
|
import { DataTable } from 'primereact/datatable';
|
||||||
|
import { Column } from 'primereact/column';
|
||||||
|
import { Button } from 'primereact/button';
|
||||||
|
import { Calendar } from 'primereact/calendar';
|
||||||
|
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||||
|
import { Dropdown } from 'primereact/dropdown';
|
||||||
|
import { Tag } from 'primereact/tag';
|
||||||
|
|
||||||
|
import translationStrings from '../../../../translationStringsForComponents';
|
||||||
|
import { useStore } from '../../../../store';
|
||||||
|
|
||||||
|
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
||||||
|
|
||||||
|
const InstructorManagerMieDomandeTable = ({ userId = null, statuses = [] }) => {
|
||||||
|
const [items, setItems] = useState(null);
|
||||||
|
const [filters, setFilters] = useState(null);
|
||||||
|
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
||||||
|
const [statusesForFilter, setStatusesForFilter] = useState([]);
|
||||||
|
const userData = useStore().main.userData();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!isNil(userId)) {
|
||||||
|
setLocalAsyncRequest(true);
|
||||||
|
|
||||||
|
if (userId === 0) {
|
||||||
|
AssignedApplicationService.getAssignedApplications(getCallback, errGetCallbacks, [
|
||||||
|
['statuses', statuses]
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
AssignedApplicationService.getAssignedApplications(getCallback, errGetCallbacks, [
|
||||||
|
['userId', userId],
|
||||||
|
['statuses', statuses]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [userId]);
|
||||||
|
|
||||||
|
const getCallback = (data) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
setItems(getFormattedData(data.data));
|
||||||
|
setStatusesForFilter(uniq(data.data.map(o => o.status)))
|
||||||
|
initFilters();
|
||||||
|
}
|
||||||
|
setLocalAsyncRequest(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
const errGetCallbacks = (data) => {
|
||||||
|
setLocalAsyncRequest(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
const getFormattedData = (data) => {
|
||||||
|
return data.map((d) => {
|
||||||
|
d.evaluationEndDate = is(String, d.evaluationEndDate) ? new Date(d.evaluationEndDate) : (d.evaluationEndDate ? d.evaluationEndDate : '');
|
||||||
|
d.submissionDate = is(String, d.submissionDate) ? new Date(d.submissionDate) : (d.submissionDate ? d.submissionDate : '');
|
||||||
|
return d;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatDate = (value) => {
|
||||||
|
return value.toLocaleDateString('it-IT', {
|
||||||
|
day: '2-digit',
|
||||||
|
month: '2-digit',
|
||||||
|
year: 'numeric'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const clearFilter = () => {
|
||||||
|
initFilters();
|
||||||
|
};
|
||||||
|
|
||||||
|
const initFilters = () => {
|
||||||
|
setFilters({
|
||||||
|
global: { value: null, matchMode: FilterMatchMode.CONTAINS },
|
||||||
|
callName: {
|
||||||
|
operator: FilterOperator.AND,
|
||||||
|
constraints: [{ value: null, matchMode: FilterMatchMode.STARTS_WITH }]
|
||||||
|
},
|
||||||
|
companyName: {
|
||||||
|
operator: FilterOperator.AND,
|
||||||
|
constraints: [{ value: null, matchMode: FilterMatchMode.STARTS_WITH }]
|
||||||
|
},
|
||||||
|
submissionDate: {
|
||||||
|
operator: FilterOperator.AND,
|
||||||
|
constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }]
|
||||||
|
},
|
||||||
|
evaluationEndDate: {
|
||||||
|
operator: FilterOperator.AND,
|
||||||
|
constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const renderHeader = () => {
|
||||||
|
return (
|
||||||
|
<div className="appTableHeader">
|
||||||
|
<Button type="button" icon="pi pi-filter-slash" label={__('Pulisci', 'gepafin')} outlined onClick={clearFilter} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const dateAppliedBodyTemplate = (rowData) => {
|
||||||
|
return formatDate(rowData.submissionDate);
|
||||||
|
};
|
||||||
|
|
||||||
|
const dateEndBodyTemplate = (rowData) => {
|
||||||
|
return formatDate(rowData.evaluationEndDate);
|
||||||
|
};
|
||||||
|
|
||||||
|
const dateFilterTemplate = (options) => {
|
||||||
|
return <Calendar value={options.value} onChange={(e) => options.filterCallback(e.value, options.index)} dateFormat="mm/dd/yy" placeholder="mm/dd/yyyy" mask="99/99/9999" />;
|
||||||
|
};
|
||||||
|
|
||||||
|
const statusBodyTemplate = (rowData) => {
|
||||||
|
return <ProperBandoLabel status={rowData.status}/>;
|
||||||
|
};
|
||||||
|
|
||||||
|
const statusFilterTemplate = (options) => {
|
||||||
|
return <Dropdown value={options.value} options={statusesForFilter} onChange={(e) => options.filterCallback(e.value, options.index)} itemTemplate={statusItemTemplate} placeholder={translationStrings.selectOneLabel} className="p-column-filter" showClear />;
|
||||||
|
};
|
||||||
|
|
||||||
|
const statusItemTemplate = (option) => {
|
||||||
|
return <Tag value={getBandoLabel(option)} severity={getBandoSeverity(option)} />;
|
||||||
|
};
|
||||||
|
|
||||||
|
const actionsBodyTemplate = (rowData) => {
|
||||||
|
const label = ['OPEN', 'SOCCORSO'].includes(rowData.status) && userData.id === rowData.userId
|
||||||
|
? __('Valuta', 'gepafin')
|
||||||
|
: __('Mostra', 'gepafin');
|
||||||
|
return <Link to={`/mie-domande/${rowData.applicationId}`}>
|
||||||
|
<Button severity="info" label={label} icon="pi pi-eye" size="small" iconPos="right"/>
|
||||||
|
</Link>
|
||||||
|
}
|
||||||
|
|
||||||
|
const header = renderHeader();
|
||||||
|
|
||||||
|
return(
|
||||||
|
<div className="appPageSection__table">
|
||||||
|
<DataTable value={items} paginator showGridlines rows={5} loading={localAsyncRequest} dataKey="id"
|
||||||
|
filters={filters} stripedRows removableSort
|
||||||
|
header={header}
|
||||||
|
emptyMessage={translationStrings.emptyMessage}
|
||||||
|
onFilter={(e) => setFilters(e.filters)}>
|
||||||
|
<Column field="applicationId" header={__('ID domanda', 'gepafin')}
|
||||||
|
sortable filterPlaceholder={__('Cerca', 'gepafin')}
|
||||||
|
style={{ minWidth: '6rem' }}/>
|
||||||
|
<Column field="protocolNumber" header={__('Protocollo', 'gepafin')}
|
||||||
|
sortable filterPlaceholder={__('Cerca', 'gepafin')}
|
||||||
|
style={{ minWidth: '6rem' }}/>
|
||||||
|
{APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
|
||||||
|
? <Column field="ndg" header={__('NDG', 'gepafin')}
|
||||||
|
sortable filterPlaceholder={__('Cerca', 'gepafin')}
|
||||||
|
style={{ minWidth: '6rem' }}/> : null}
|
||||||
|
{APP_HUB_ID !== 't7jh5wfg9QXylNaTZkPoE'
|
||||||
|
? <Column field="appointmentId" header={__('ID appuntamento', 'gepafin')}
|
||||||
|
sortable filterPlaceholder={__('Cerca', 'gepafin')}
|
||||||
|
style={{ minWidth: '6rem' }}/> : null}
|
||||||
|
<Column field="callName" header={__('Bando', 'gepafin')}
|
||||||
|
filter sortable
|
||||||
|
filterPlaceholder={__('Cerca', 'gepafin')}
|
||||||
|
style={{ minWidth: '8rem' }}/>
|
||||||
|
<Column field="companyName" header={__('Azienda', 'gepafin')}
|
||||||
|
filter sortable
|
||||||
|
filterPlaceholder={__('Cerca il nome', 'gepafin')}
|
||||||
|
style={{ minWidth: '8rem' }}/>
|
||||||
|
<Column header={__('Data ricezione', 'gepafin')} filterField="submissionDate" dataType="date"
|
||||||
|
style={{ minWidth: '8rem' }}
|
||||||
|
body={dateAppliedBodyTemplate} filter filterElement={dateFilterTemplate}/>
|
||||||
|
<Column header={__('Scadenza', 'gepafin')} filterField="evaluationEndDate" dataType="date"
|
||||||
|
style={{ minWidth: '8rem' }}
|
||||||
|
body={dateEndBodyTemplate} filter filterElement={dateFilterTemplate}/>
|
||||||
|
<Column field="status" header={__('Stato', 'gepafin')}
|
||||||
|
style={{ minWidth: '7rem' }} body={statusBodyTemplate} filter
|
||||||
|
filterElement={statusFilterTemplate} />
|
||||||
|
<Column header={__('Azioni', 'gepafin')}
|
||||||
|
body={actionsBodyTemplate}/>
|
||||||
|
</DataTable>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default InstructorManagerMieDomandeTable;
|
||||||
119
src/pages/DashboardInstructorManager/index.js
Normal file
119
src/pages/DashboardInstructorManager/index.js
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
import React, { useEffect, useState } from 'react';
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
import NumberFlow from '@number-flow/react';
|
||||||
|
import { pathOr } from 'ramda';
|
||||||
|
|
||||||
|
// service
|
||||||
|
import DashboardService from '../../service/dashboard-service';
|
||||||
|
|
||||||
|
// components
|
||||||
|
import { Button } from 'primereact/button';
|
||||||
|
import PreInstructorDomandeTable from '../DashboardPreInstructor/components/PreInstructorDomandeTable';
|
||||||
|
|
||||||
|
const DashboardInstructorManager = () => {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const [mainStats, setMainStats] = useState({});
|
||||||
|
|
||||||
|
const goToAllEvaluations = () => {
|
||||||
|
navigate('/domande');
|
||||||
|
}
|
||||||
|
|
||||||
|
const getStats = (data) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
setMainStats(data.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const errGetStats = () => {}
|
||||||
|
|
||||||
|
const getStatValue = (key, fallback = '') => {
|
||||||
|
return pathOr(fallback, [key], mainStats);
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
DashboardService.getEvaluationsStats(getStats, errGetStats);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return(
|
||||||
|
<div className="appPage">
|
||||||
|
<div className="appPage__pageHeader">
|
||||||
|
<h1>{__('Dashboard', 'gepafin')}</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
|
<div className="appPageSection statsBigBadges">
|
||||||
|
<h2>{__('Riepilogo', 'gepafin')}</h2>
|
||||||
|
<div className="statsBigBadges__grid applStats">
|
||||||
|
<div className="statsBigBadges__gridItem">
|
||||||
|
<span>{__('Totale domande', 'gepafin')}</span>
|
||||||
|
<span><NumberFlow
|
||||||
|
value={getStatValue('numberOfAssignedApplication', 0)}
|
||||||
|
format={{ notation: 'compact' }}
|
||||||
|
locales="it-IT"/></span>
|
||||||
|
</div>
|
||||||
|
<div className="statsBigBadges__gridItem">
|
||||||
|
<span>{__('In soccorso', 'gepafin')}</span>
|
||||||
|
<span><NumberFlow
|
||||||
|
value={getStatValue('numberOfApplicationInAmendmentState', 0)}
|
||||||
|
format={{ notation: 'compact' }}
|
||||||
|
locales="it-IT"/></span>
|
||||||
|
</div>
|
||||||
|
<div className="statsBigBadges__gridItem">
|
||||||
|
<span>{__('In valutazione', 'gepafin')}</span>
|
||||||
|
<span><NumberFlow
|
||||||
|
value={getStatValue('numberOfApplicationInOpenState', 0)}
|
||||||
|
format={{ notation: 'compact' }}
|
||||||
|
locales="it-IT"/></span>
|
||||||
|
</div>
|
||||||
|
<div className="statsBigBadges__gridItem">
|
||||||
|
<span>{__('Completate', 'gepafin')}</span>
|
||||||
|
<span><NumberFlow
|
||||||
|
value={getStatValue('numberOfApplicationInCloseState', 0)}
|
||||||
|
format={{ notation: 'compact' }}
|
||||||
|
locales="it-IT"/></span>
|
||||||
|
</div>
|
||||||
|
<div className="statsBigBadges__gridItem">
|
||||||
|
<span>{__('Tempo medio di valutazione', 'gepafin')}</span>
|
||||||
|
<span><NumberFlow
|
||||||
|
value={getStatValue('averageEvaluationDays', 0)}
|
||||||
|
format={{ notation: 'compact' }}
|
||||||
|
suffix={` ${__('giorni', 'gepafin')}`}
|
||||||
|
locales="it-IT"/></span>
|
||||||
|
</div>
|
||||||
|
<div className="statsBigBadges__gridItem">
|
||||||
|
<span>{__('Domande in scadenza (48h)', 'gepafin')}</span>
|
||||||
|
<span><NumberFlow
|
||||||
|
value={getStatValue('numberOfApplicationExpiringIn48Hours', 0)}
|
||||||
|
format={{ notation: 'compact' }}
|
||||||
|
locales="en-US"/></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
|
<div className="appPageSection">
|
||||||
|
<h2>{__('Panoramica delle domande da valutare', 'gepafin')}</h2>
|
||||||
|
<PreInstructorDomandeTable statuses={['OPEN', 'SOCCORSO']} userId={0}/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
|
<div className="appPageSection__hr">
|
||||||
|
<span>{__('Azioni rapide', 'gepafin')}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPageSection">
|
||||||
|
<div className="appPageSection__actions">
|
||||||
|
<Button
|
||||||
|
onClick={goToAllEvaluations}
|
||||||
|
label={__('Tutte le domande', 'gepafin')} icon="pi pi-arrow-right" iconPos="right"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DashboardInstructorManager;
|
||||||
@@ -1,11 +1,8 @@
|
|||||||
import React, { useState, useEffect} from 'react';
|
import React, { useState, useEffect} from 'react';
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
import { is, uniq } from 'ramda';
|
import { is, uniq, isNil } from 'ramda';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
// store
|
|
||||||
import { useStore } from '../../../../store';
|
|
||||||
|
|
||||||
// api
|
// api
|
||||||
import AssignedApplicationService from '../../../../service/assigned-application-service';
|
import AssignedApplicationService from '../../../../service/assigned-application-service';
|
||||||
|
|
||||||
@@ -24,27 +21,38 @@ import { Dropdown } from 'primereact/dropdown';
|
|||||||
import { Tag } from 'primereact/tag';
|
import { Tag } from 'primereact/tag';
|
||||||
|
|
||||||
import translationStrings from '../../../../translationStringsForComponents';
|
import translationStrings from '../../../../translationStringsForComponents';
|
||||||
|
import { useStore } from '../../../../store';
|
||||||
|
|
||||||
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
||||||
|
|
||||||
const PreInstructorDomandeTable = () => {
|
const PreInstructorDomandeTable = ({ userId = null, statuses = [] }) => {
|
||||||
const userData = useStore().main.userData();
|
|
||||||
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 [statuses, setStatuses] = useState([]);
|
const [statusesForFilter, setStatusesForFilter] = useState([]);
|
||||||
|
const userData = useStore().main.userData();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!isNil(userId)) {
|
||||||
setLocalAsyncRequest(true);
|
setLocalAsyncRequest(true);
|
||||||
|
|
||||||
|
if (userId === 0) {
|
||||||
AssignedApplicationService.getAssignedApplications(getCallback, errGetCallbacks, [
|
AssignedApplicationService.getAssignedApplications(getCallback, errGetCallbacks, [
|
||||||
['userId', userData.id]
|
['statuses', statuses]
|
||||||
]);
|
]);
|
||||||
}, []);
|
} else {
|
||||||
|
AssignedApplicationService.getAssignedApplications(getCallback, errGetCallbacks, [
|
||||||
|
['userId', userId],
|
||||||
|
['statuses', statuses]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [userId]);
|
||||||
|
|
||||||
const getCallback = (data) => {
|
const getCallback = (data) => {
|
||||||
if (data.status === 'SUCCESS') {
|
if (data.status === 'SUCCESS') {
|
||||||
setItems(getFormattedData(data.data));
|
setItems(getFormattedData(data.data));
|
||||||
setStatuses(uniq(data.data.map(o => o.status)))
|
setStatusesForFilter(uniq(data.data.map(o => o.status)))
|
||||||
initFilters();
|
initFilters();
|
||||||
}
|
}
|
||||||
setLocalAsyncRequest(false);
|
setLocalAsyncRequest(false);
|
||||||
@@ -121,7 +129,7 @@ const PreInstructorDomandeTable = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const statusFilterTemplate = (options) => {
|
const statusFilterTemplate = (options) => {
|
||||||
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 />;
|
return <Dropdown value={options.value} options={statusesForFilter} onChange={(e) => options.filterCallback(e.value, options.index)} itemTemplate={statusItemTemplate} placeholder={translationStrings.selectOneLabel} className="p-column-filter" showClear />;
|
||||||
};
|
};
|
||||||
|
|
||||||
const statusItemTemplate = (option) => {
|
const statusItemTemplate = (option) => {
|
||||||
@@ -129,8 +137,11 @@ const PreInstructorDomandeTable = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const actionsBodyTemplate = (rowData) => {
|
const actionsBodyTemplate = (rowData) => {
|
||||||
|
const label = ['OPEN', 'SOCCORSO'].includes(rowData.status) && userData.id === rowData.userId
|
||||||
|
? __('Valuta', 'gepafin')
|
||||||
|
: __('Mostra', 'gepafin');
|
||||||
return <Link to={`/domande/${rowData.applicationId}`}>
|
return <Link to={`/domande/${rowData.applicationId}`}>
|
||||||
<Button severity="info" label={__('Valuta', 'gepafin')} icon="pi pi-eye" size="small" iconPos="right"/>
|
<Button severity="info" label={label} icon="pi pi-eye" size="small" iconPos="right"/>
|
||||||
</Link>
|
</Link>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,58 +1,106 @@
|
|||||||
import React from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
import NumberFlow from '@number-flow/react';
|
||||||
|
import { pathOr } from 'ramda';
|
||||||
|
|
||||||
// store
|
// store
|
||||||
//import { useStore } from '../../store';
|
import { useStore } from '../../store';
|
||||||
|
|
||||||
// api
|
// service
|
||||||
//import DashboardService from '../../service/dashboard-service';
|
import DashboardService from '../../service/dashboard-service';
|
||||||
|
|
||||||
// components
|
// components
|
||||||
//import LatestBandiTable from './components/LatestBandiTable';
|
|
||||||
//import MyLatestSubmissionsTable from './components/MyLatestSubmissionsTable';
|
|
||||||
import { Button } from 'primereact/button';
|
import { Button } from 'primereact/button';
|
||||||
import PreInstructorDomandeTable from './components/PreInstructorDomandeTable';
|
import PreInstructorDomandeTable from './components/PreInstructorDomandeTable';
|
||||||
|
|
||||||
const DashboardPreInstructor = () => {
|
const DashboardPreInstructor = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
//const [mainStats, setMainStats] = useState({});
|
const [mainStats, setMainStats] = useState({});
|
||||||
|
const userData = useStore().main.userData();
|
||||||
|
|
||||||
const goToAllEvaluations = () => {
|
const goToAllEvaluations = () => {
|
||||||
navigate('/domande');
|
navigate('/domande');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getStats = (data) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
setMainStats(data.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const errGetStats = () => {}
|
||||||
|
|
||||||
|
const getStatValue = (key, fallback = '') => {
|
||||||
|
return pathOr(fallback, [key], mainStats);
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
DashboardService.getEvaluationsStats(getStats, errGetStats);
|
||||||
|
}, []);
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<div className="appPage">
|
<div className="appPage">
|
||||||
<div className="appPage__pageHeader">
|
<div className="appPage__pageHeader">
|
||||||
<h1>{__('Dashboard', 'gepafin')}</h1>
|
<h1>{__('Dashboard', 'gepafin')}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/*<div className="appPage__spacer"></div>
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
<div className="appPageSection statsBigBadges">
|
<div className="appPageSection statsBigBadges">
|
||||||
<h2>{__('Panoramica di Sistema', 'gepafin')}</h2>
|
<h2>{__('Riepilogo', 'gepafin')}</h2>
|
||||||
<div className="statsBigBadges__grid">
|
<div className="statsBigBadges__grid applStats">
|
||||||
<div className="statsBigBadges__gridItem">
|
<div className="statsBigBadges__gridItem">
|
||||||
<span>{__('Domande attive', 'gepafin')}</span>
|
<span>{__('Totale domande', 'gepafin')}</span>
|
||||||
<span>{getStatValue('numberOfApplications', 0)}</span>
|
<span><NumberFlow
|
||||||
|
value={getStatValue('numberOfAssignedApplication', 0)}
|
||||||
|
format={{ notation: 'compact' }}
|
||||||
|
locales="it-IT"/></span>
|
||||||
</div>
|
</div>
|
||||||
<div className="statsBigBadges__gridItem">
|
<div className="statsBigBadges__gridItem">
|
||||||
<span>{__('Bandi osservati', 'gepafin')}</span>
|
<span>{__('In soccorso', 'gepafin')}</span>
|
||||||
<span>{getStatValue('numberOfCalls', 0)}</span>
|
<span><NumberFlow
|
||||||
|
value={getStatValue('numberOfApplicationInAmendmentState', 0)}
|
||||||
|
format={{ notation: 'compact' }}
|
||||||
|
locales="it-IT"/></span>
|
||||||
</div>
|
</div>
|
||||||
<div className="statsBigBadges__gridItem">
|
<div className="statsBigBadges__gridItem">
|
||||||
<span>{__('Documenti da integrare', 'gepafin')}</span>
|
<span>{__('In valutazione', 'gepafin')}</span>
|
||||||
<span>{getStatValue('numberOfIntegratedDocuments', 0)}</span>
|
<span><NumberFlow
|
||||||
|
value={getStatValue('numberOfApplicationInOpenState', 0)}
|
||||||
|
format={{ notation: 'compact' }}
|
||||||
|
locales="it-IT"/></span>
|
||||||
|
</div>
|
||||||
|
<div className="statsBigBadges__gridItem">
|
||||||
|
<span>{__('Completate', 'gepafin')}</span>
|
||||||
|
<span><NumberFlow
|
||||||
|
value={getStatValue('numberOfApplicationInCloseState', 0)}
|
||||||
|
format={{ notation: 'compact' }}
|
||||||
|
locales="it-IT"/></span>
|
||||||
|
</div>
|
||||||
|
<div className="statsBigBadges__gridItem">
|
||||||
|
<span>{__('Tempo medio di valutazione', 'gepafin')}</span>
|
||||||
|
<span><NumberFlow
|
||||||
|
value={getStatValue('averageEvaluationDays', 0)}
|
||||||
|
format={{ notation: 'compact' }}
|
||||||
|
suffix={` ${__('giorni', 'gepafin')}`}
|
||||||
|
locales="it-IT"/></span>
|
||||||
|
</div>
|
||||||
|
<div className="statsBigBadges__gridItem">
|
||||||
|
<span>{__('Domande in scadenza (48h)', 'gepafin')}</span>
|
||||||
|
<span><NumberFlow
|
||||||
|
value={getStatValue('numberOfApplicationExpiringIn48Hours', 0)}
|
||||||
|
format={{ notation: 'compact' }}
|
||||||
|
locales="en-US"/></span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>*/}
|
|
||||||
|
|
||||||
<div className="appPage__spacer"></div>
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
<div className="appPageSection">
|
<div className="appPageSection">
|
||||||
<h2>{__('Coda di lavoro', 'gepafin')}</h2>
|
<h2>{__('Coda di lavoro', 'gepafin')}</h2>
|
||||||
<PreInstructorDomandeTable/>
|
<PreInstructorDomandeTable statuses={['OPEN', 'SOCCORSO']} userId={userData.id}/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="appPage__spacer"></div>
|
<div className="appPage__spacer"></div>
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const goToEvaluationsPage = () => {
|
const goToEvaluationsPage = () => {
|
||||||
navigate('/domande');
|
navigate('/mie-domande');
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateFlagsForSoccorso = (data) => {
|
const updateFlagsForSoccorso = (data) => {
|
||||||
@@ -101,9 +101,9 @@ const DomandaEditPreInstructor = () => {
|
|||||||
|
|
||||||
const doNewSoccorso = () => {
|
const doNewSoccorso = () => {
|
||||||
if (connectedSoccorsoId !== 0) {
|
if (connectedSoccorsoId !== 0) {
|
||||||
navigate(`/domande/${id}/soccorso/${connectedSoccorsoId}`);
|
navigate(`/mie-domande/${id}/soccorso/${connectedSoccorsoId}`);
|
||||||
} else {
|
} else {
|
||||||
doSaveDraft(`/domande/${id}/aggiungi-soccorso/`)
|
doSaveDraft(`/mie-domande/${id}/aggiungi-soccorso/`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -506,7 +506,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const evaluationShouldBeBlocked = (data = {}) => {
|
const evaluationShouldBeBlocked = (data = {}) => {
|
||||||
const userData = storeGet.main.userData()
|
const userData = storeGet.main.userData();
|
||||||
return isAsyncRequest || userData.id !== data.assignedUserId;
|
return isAsyncRequest || userData.id !== data.assignedUserId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -592,6 +592,10 @@ const DomandaEditPreInstructor = () => {
|
|||||||
<span>{__('Data assegnazione', 'gepafin')}</span>
|
<span>{__('Data assegnazione', 'gepafin')}</span>
|
||||||
<span>{getDateTimeFromISOstring(data.assignedAt)}</span>
|
<span>{getDateTimeFromISOstring(data.assignedAt)}</span>
|
||||||
</p>
|
</p>
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('Aassegnato a', 'gepafin')}</span>
|
||||||
|
<span>{data.assignedUserName}</span>
|
||||||
|
</p>
|
||||||
<p className="appPageSection__pMeta">
|
<p className="appPageSection__pMeta">
|
||||||
<span>{__('Scadenza Valutazione', 'gepafin')}</span>
|
<span>{__('Scadenza Valutazione', 'gepafin')}</span>
|
||||||
<span>{getDateFromISOstring(data.evaluationEndDate)}</span>
|
<span>{getDateFromISOstring(data.evaluationEndDate)}</span>
|
||||||
|
|||||||
@@ -594,6 +594,10 @@ const DomandaEditPreInstructor = () => {
|
|||||||
<span>{__('Data assegnazione', 'gepafin')}</span>
|
<span>{__('Data assegnazione', 'gepafin')}</span>
|
||||||
<span>{getDateTimeFromISOstring(data.assignedAt)}</span>
|
<span>{getDateTimeFromISOstring(data.assignedAt)}</span>
|
||||||
</p>
|
</p>
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('Aassegnato a', 'gepafin')}</span>
|
||||||
|
<span>{data.assignedUserName}</span>
|
||||||
|
</p>
|
||||||
<p className="appPageSection__pMeta">
|
<p className="appPageSection__pMeta">
|
||||||
<span>{__('Scadenza Valutazione', 'gepafin')}</span>
|
<span>{__('Scadenza Valutazione', 'gepafin')}</span>
|
||||||
<span>{getDateFromISOstring(data.evaluationEndDate)}</span>
|
<span>{getDateFromISOstring(data.evaluationEndDate)}</span>
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ import React from 'react';
|
|||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
|
|
||||||
// components
|
// components
|
||||||
import AllDomandeArchiveTable from './components/AllDomandeArchiveTable';
|
//import AllDomandeArchiveTable from './components/AllDomandeArchiveTable';
|
||||||
|
import PreInstructorDomandeTable from '../DashboardPreInstructor/components/PreInstructorDomandeTable';
|
||||||
const Domande = () => {
|
|
||||||
|
|
||||||
|
const DomandeArchive = () => {
|
||||||
return (
|
return (
|
||||||
<div className="appPage">
|
<div className="appPage">
|
||||||
<div className="appPage__pageHeader">
|
<div className="appPage__pageHeader">
|
||||||
@@ -15,11 +15,11 @@ const Domande = () => {
|
|||||||
<div className="appPage__spacer"></div>
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
<div className="appPageSection">
|
<div className="appPageSection">
|
||||||
<h2>{__('Domande pubblicate', 'gepafin')}</h2>
|
<h2>{__('Domande completate', 'gepafin')}</h2>
|
||||||
<AllDomandeArchiveTable/>
|
<PreInstructorDomandeTable statuses={['CLOSE']} userId={0}/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Domande;
|
export default DomandeArchive;
|
||||||
29
src/pages/DomandeArchivePreInstructor/index.js
Normal file
29
src/pages/DomandeArchivePreInstructor/index.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
|
||||||
|
// store
|
||||||
|
import { useStore } from '../../store';
|
||||||
|
|
||||||
|
// components
|
||||||
|
import PreInstructorDomandeTable from '../DashboardPreInstructor/components/PreInstructorDomandeTable';
|
||||||
|
|
||||||
|
const DomandeArchivePreInstructor = () => {
|
||||||
|
const userData = useStore().main.userData();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="appPage">
|
||||||
|
<div className="appPage__pageHeader">
|
||||||
|
<h1>{__('Archivio domande', 'gepafin')}</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
|
<div className="appPageSection">
|
||||||
|
<h2>{__('Domande completate', 'gepafin')}</h2>
|
||||||
|
<PreInstructorDomandeTable statuses={['CLOSE']} userId={userData.id}/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DomandeArchivePreInstructor;
|
||||||
@@ -159,17 +159,25 @@ const DomandeInstructorManager = () => {
|
|||||||
return(
|
return(
|
||||||
<div className="appPage">
|
<div className="appPage">
|
||||||
<div className="appPage__pageHeader">
|
<div className="appPage__pageHeader">
|
||||||
<h1>{__('Domande da valutare', 'gepafin')}</h1>
|
<h1>{__('Gestione domande', 'gepafin')}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="appPage__spacer"></div>
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
<div className="appPageSection">
|
<div className="appPageSection">
|
||||||
<PreInstructorDomandeTable/>
|
<h2>{__('Da assegnare', 'gepafin')}</h2>
|
||||||
|
<AllDomandeTable openDialogFn={openAssignDialog} updaterString={updaterString}/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="appPage__spacer"></div>
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
|
<div className="appPageSection">
|
||||||
|
<h2>{__('In lavorazione', 'gepafin')}</h2>
|
||||||
|
<PreInstructorDomandeTable statuses={['OPEN', 'SOCCORSO']} userId={0}/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/*<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
<div className="appPageSection statsBigBadges">
|
<div className="appPageSection statsBigBadges">
|
||||||
<h2>{__('Riepilogo', 'gepafin')}</h2>
|
<h2>{__('Riepilogo', 'gepafin')}</h2>
|
||||||
<div className="statsBigBadges__grid applStats">
|
<div className="statsBigBadges__grid applStats">
|
||||||
@@ -217,14 +225,7 @@ const DomandeInstructorManager = () => {
|
|||||||
locales="en-US"/></span>
|
locales="en-US"/></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>*/}
|
||||||
|
|
||||||
<div className="appPage__spacer"></div>
|
|
||||||
|
|
||||||
<div className="appPageSection">
|
|
||||||
<h2>{__('Domande pubblicate', 'gepafin')}</h2>
|
|
||||||
<AllDomandeTable openDialogFn={openAssignDialog} updaterString={updaterString}/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Dialog
|
<Dialog
|
||||||
visible={isVisibleEditDialog}
|
visible={isVisibleEditDialog}
|
||||||
|
|||||||
37
src/pages/DomandeMieInstructorManager/index.js
Normal file
37
src/pages/DomandeMieInstructorManager/index.js
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
|
||||||
|
// store
|
||||||
|
import { useStore } from '../../store';
|
||||||
|
|
||||||
|
// components
|
||||||
|
import InstructorManagerMieDomandeTable
|
||||||
|
from '../DashboardInstructorManager/components/InstructorManagerMieDomandeTable';
|
||||||
|
|
||||||
|
const DomandeMieInstructorManager = () => {
|
||||||
|
const userData = useStore().main.userData();
|
||||||
|
|
||||||
|
return(
|
||||||
|
<div className="appPage">
|
||||||
|
<div className="appPage__pageHeader">
|
||||||
|
<h1>{__('Domande da valutare', 'gepafin')}</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
|
<div className="appPageSection">
|
||||||
|
<h2>{__('Nuove domande da valutare', 'gepafin')}</h2>
|
||||||
|
<InstructorManagerMieDomandeTable statuses={['AWAITING']} userId={userData.id}/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
|
<div className="appPageSection">
|
||||||
|
<h2>{__('Coda di lavoro', 'gepafin')}</h2>
|
||||||
|
<InstructorManagerMieDomandeTable statuses={['OPEN', 'SOCCORSO']} userId={userData.id}/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DomandeMieInstructorManager;
|
||||||
@@ -1,30 +1,14 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React from 'react';
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
|
|
||||||
|
// store
|
||||||
|
import { useStore } from '../../store';
|
||||||
|
|
||||||
// components
|
// components
|
||||||
import PreInstructorDomandeTable from '../DashboardPreInstructor/components/PreInstructorDomandeTable';
|
import PreInstructorDomandeTable from '../DashboardPreInstructor/components/PreInstructorDomandeTable';
|
||||||
import { pathOr } from 'ramda';
|
|
||||||
import DashboardService from '../../service/dashboard-service';
|
|
||||||
import NumberFlow from '@number-flow/react';
|
|
||||||
|
|
||||||
const DomandePreInstructor = () => {
|
const DomandePreInstructor = () => {
|
||||||
const [mainStats, setMainStats] = useState({});
|
const userData = useStore().main.userData();
|
||||||
|
|
||||||
const getStats = (data) => {
|
|
||||||
if (data.status === 'SUCCESS') {
|
|
||||||
setMainStats(data.data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const errGetStats = () => {}
|
|
||||||
|
|
||||||
const getStatValue = (key, fallback = '') => {
|
|
||||||
return pathOr(fallback, [key], mainStats);
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
DashboardService.getEvaluationsStats(getStats, errGetStats);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<div className="appPage">
|
<div className="appPage">
|
||||||
@@ -35,58 +19,8 @@ const DomandePreInstructor = () => {
|
|||||||
<div className="appPage__spacer"></div>
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
<div className="appPageSection">
|
<div className="appPageSection">
|
||||||
<PreInstructorDomandeTable/>
|
<h2>{__('Nuove domande da valutare', 'gepafin')}</h2>
|
||||||
</div>
|
<PreInstructorDomandeTable statuses={['AWAITING']} userId={userData.id}/>
|
||||||
|
|
||||||
<div className="appPage__spacer"></div>
|
|
||||||
|
|
||||||
<div className="appPageSection statsBigBadges">
|
|
||||||
<h2>{__('Riepilogo', 'gepafin')}</h2>
|
|
||||||
<div className="statsBigBadges__grid applStats">
|
|
||||||
<div className="statsBigBadges__gridItem">
|
|
||||||
<span>{__('Totale domande', 'gepafin')}</span>
|
|
||||||
<span><NumberFlow
|
|
||||||
value={getStatValue('numberOfAssignedApplication', 0)}
|
|
||||||
format={{ notation: 'compact' }}
|
|
||||||
locales="it-IT"/></span>
|
|
||||||
</div>
|
|
||||||
<div className="statsBigBadges__gridItem">
|
|
||||||
<span>{__('In soccorso', 'gepafin')}</span>
|
|
||||||
<span><NumberFlow
|
|
||||||
value={getStatValue('numberOfApplicationInAmendmentState', 0)}
|
|
||||||
format={{ notation: 'compact' }}
|
|
||||||
locales="it-IT"/></span>
|
|
||||||
</div>
|
|
||||||
<div className="statsBigBadges__gridItem">
|
|
||||||
<span>{__('In valutazione', 'gepafin')}</span>
|
|
||||||
<span><NumberFlow
|
|
||||||
value={getStatValue('numberOfApplicationInOpenState', 0)}
|
|
||||||
format={{ notation: 'compact' }}
|
|
||||||
locales="it-IT"/></span>
|
|
||||||
</div>
|
|
||||||
<div className="statsBigBadges__gridItem">
|
|
||||||
<span>{__('Completate', 'gepafin')}</span>
|
|
||||||
<span><NumberFlow
|
|
||||||
value={getStatValue('numberOfApplicationInCloseState', 0)}
|
|
||||||
format={{ notation: 'compact' }}
|
|
||||||
locales="it-IT"/></span>
|
|
||||||
</div>
|
|
||||||
<div className="statsBigBadges__gridItem">
|
|
||||||
<span>{__('Tempo medio di valutazione', 'gepafin')}</span>
|
|
||||||
<span><NumberFlow
|
|
||||||
value={getStatValue('averageEvaluationDays', 0)}
|
|
||||||
format={{ notation: 'compact' }}
|
|
||||||
suffix={` ${__('giorni', 'gepafin')}`}
|
|
||||||
locales="it-IT"/></span>
|
|
||||||
</div>
|
|
||||||
<div className="statsBigBadges__gridItem">
|
|
||||||
<span>{__('Domande in scadenza (48h)', 'gepafin')}</span>
|
|
||||||
<span><NumberFlow
|
|
||||||
value={getStatValue('numberOfApplicationExpiringIn48Hours', 0)}
|
|
||||||
format={{ notation: 'compact' }}
|
|
||||||
locales="en-US"/></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
351
src/pages/SoccorsoAddInstructorManager/index.js
Normal file
351
src/pages/SoccorsoAddInstructorManager/index.js
Normal file
@@ -0,0 +1,351 @@
|
|||||||
|
import React, { useState, useEffect, useRef } from 'react';
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
import { useNavigate, useParams } from 'react-router-dom';
|
||||||
|
import { isEmpty } from 'ramda';
|
||||||
|
import { wrap } from 'object-path-immutable';
|
||||||
|
|
||||||
|
// store
|
||||||
|
import { storeSet, useStore } from '../../store';
|
||||||
|
|
||||||
|
// api
|
||||||
|
import AmendmentsService from '../../service/amendments-service';
|
||||||
|
|
||||||
|
// tools
|
||||||
|
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
||||||
|
|
||||||
|
// components
|
||||||
|
import { Skeleton } from 'primereact/skeleton';
|
||||||
|
import { Button } from 'primereact/button';
|
||||||
|
import { Checkbox } from 'primereact/checkbox';
|
||||||
|
import { Editor } from 'primereact/editor';
|
||||||
|
import { InputNumber } from 'primereact/inputnumber';
|
||||||
|
import BlockingOverlay from '../../components/BlockingOverlay';
|
||||||
|
import { Toast } from 'primereact/toast';
|
||||||
|
import { InputSwitch } from 'primereact/inputswitch';
|
||||||
|
import ApplicationEvaluationService from '../../service/application-evaluation-service';
|
||||||
|
import { Dialog } from 'primereact/dialog';
|
||||||
|
|
||||||
|
const SoccorsoAddInstructorManager = () => {
|
||||||
|
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||||
|
const { id } = useParams();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const [data, setData] = useState({});
|
||||||
|
const [evaluationId, setEvaluationId] = useState(0);
|
||||||
|
const [formData, setFormData] = useState({});
|
||||||
|
const [isVisibleConfirmDialog, setIsVisibleConfirmDialog] = useState(false)
|
||||||
|
const toast = useRef(null);
|
||||||
|
|
||||||
|
const goToEvaluationPage = () => {
|
||||||
|
navigate(`/mie-domande/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const parsed = parseInt(id)
|
||||||
|
const entityId = !isNaN(parsed) ? parsed : 0;
|
||||||
|
|
||||||
|
storeSet.main.setAsyncRequest();
|
||||||
|
ApplicationEvaluationService.getEvaluationByApplId(getCallbackEvaluation, errGetCallback, [
|
||||||
|
['applicationId', entityId]
|
||||||
|
]);
|
||||||
|
}, [id]);
|
||||||
|
|
||||||
|
const getCallbackEvaluation = (data) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
setEvaluationId(data.data.id);
|
||||||
|
AmendmentsService.getSoccorsoByApplEvalId(data.data.id, getCallback, errGetCallback)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const getCallback = (data) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
setData(data.data);
|
||||||
|
setFormData(getFormattedFormData(data.data));
|
||||||
|
}
|
||||||
|
storeSet.main.unsetAsyncRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
const errGetCallback = (data) => {
|
||||||
|
if (toast.current && data.message) {
|
||||||
|
toast.current.show({
|
||||||
|
severity: 'error',
|
||||||
|
summary: '',
|
||||||
|
detail: data.message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
set404FromErrorResponse(data);
|
||||||
|
storeSet.main.unsetAsyncRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
const getFormattedFormData = (data) => {
|
||||||
|
let newData = {};
|
||||||
|
newData.formFields = data.formFields;
|
||||||
|
newData.responseDays = 10;
|
||||||
|
newData.note = '';
|
||||||
|
newData.isSendNotification = true;
|
||||||
|
newData.isSendEmail = true;
|
||||||
|
return newData;
|
||||||
|
};
|
||||||
|
|
||||||
|
const renderHeader = () => {
|
||||||
|
return (
|
||||||
|
<span className="ql-formats">
|
||||||
|
<button className="ql-bold" aria-label="Bold"></button>
|
||||||
|
<button className="ql-italic" aria-label="Italic"></button>
|
||||||
|
<button className="ql-underline" aria-label="Underline"></button>
|
||||||
|
<button className="ql-link" aria-label="Link"></button>
|
||||||
|
<button className="ql-list" value="ordered"></button>
|
||||||
|
<button className="ql-header" value="2"></button>
|
||||||
|
<button className="ql-header" value="3"></button>
|
||||||
|
<button className="ql-blockquote"></button>
|
||||||
|
<button className="ql-list" value="bullet"></button>
|
||||||
|
<button className="ql-indent" value="-1"></button>
|
||||||
|
<button className="ql-indent" value="+1"></button>
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const header = renderHeader();
|
||||||
|
|
||||||
|
const updateEvaluationValue = (value, path, maxValue) => {
|
||||||
|
let finalValue = value;
|
||||||
|
|
||||||
|
if (maxValue) {
|
||||||
|
finalValue = value > maxValue ? maxValue : value;
|
||||||
|
}
|
||||||
|
|
||||||
|
const newData = wrap(formData).set(path.split('.'), finalValue).value();
|
||||||
|
|
||||||
|
setFormData(newData);
|
||||||
|
}
|
||||||
|
|
||||||
|
const doCreate = () => {
|
||||||
|
storeSet.main.setAsyncRequest();
|
||||||
|
|
||||||
|
AmendmentsService.createSoccorso(formData, createCallback, errCreateCallback, [
|
||||||
|
['applicationEvaluationId', evaluationId]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
const createCallback = (data) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
if (toast.current) {
|
||||||
|
toast.current.show({
|
||||||
|
severity: 'success',
|
||||||
|
summary: '',
|
||||||
|
detail: data.message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
navigate(`/mie-domande/${id}/soccorso/${data.data.id}`);
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
storeSet.main.unsetAsyncRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
const errCreateCallback = (data) => {
|
||||||
|
if (toast.current && data.message) {
|
||||||
|
toast.current.show({
|
||||||
|
severity: 'error',
|
||||||
|
summary: '',
|
||||||
|
detail: data.message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
set404FromErrorResponse(data);
|
||||||
|
storeSet.main.unsetAsyncRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
const initCreationProcess = () => {
|
||||||
|
setIsVisibleConfirmDialog(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
const headerConfirmDialog = () => {
|
||||||
|
return <span>{__('Richiesta di conferma', 'gepafin')}</span>;
|
||||||
|
}
|
||||||
|
|
||||||
|
const hideConfirmDialog = () => {
|
||||||
|
setIsVisibleConfirmDialog(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
const footerConfirmDialog = () => {
|
||||||
|
return <div>
|
||||||
|
<Button type="button" label={__('No', 'gepafin')} onClick={goToEvaluationPage} outlined/>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
label={__('Si', 'gepafin')} onClick={doConfirm}/>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
const doConfirm = () => {
|
||||||
|
setIsVisibleConfirmDialog(false);
|
||||||
|
doCreate();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="appPage">
|
||||||
|
<div className="appPage__pageHeader">
|
||||||
|
<h1>{__('Richiesta Integrazione Documentale', 'gepafin')}</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPage__spacer"></div>
|
||||||
|
<Toast ref={toast}/>
|
||||||
|
<BlockingOverlay shouldDisplay={isAsyncRequest}/>
|
||||||
|
|
||||||
|
<div className="appPageSection__row">
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
outlined
|
||||||
|
onClick={goToEvaluationPage}
|
||||||
|
label={__('Indietro', 'gepafin')}
|
||||||
|
icon="pi pi-arrow-left" iconPos="left"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
|
{!isAsyncRequest && !isEmpty(data)
|
||||||
|
? <div className="appPage__content">
|
||||||
|
<div className="appPageSection__withBorder column">
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('ID domanda', 'gepafin')}</span>
|
||||||
|
<span>{data.applicationId}</span>
|
||||||
|
</p>
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('Bando', 'gepafin')}</span>
|
||||||
|
<span>{data.callName}</span>
|
||||||
|
</p>
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('Referente Aziendale', 'gepafin')}</span>
|
||||||
|
<span>{data.beneficiaryName}</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPageSection">
|
||||||
|
<div className="appPageSection columns">
|
||||||
|
<div>
|
||||||
|
<h3>{__('Pec/Email', 'gepafin')}</h3>
|
||||||
|
<div style={{marginBottom: '30px'}}>
|
||||||
|
<Editor
|
||||||
|
value={formData.note}
|
||||||
|
placeholder={__('Digita qui il messagio', 'gepafin')}
|
||||||
|
headerTemplate={header}
|
||||||
|
onTextChange={(e) => updateEvaluationValue(
|
||||||
|
e.htmlValue,
|
||||||
|
'note'
|
||||||
|
)}
|
||||||
|
style={{ height: 80 * 3, width: '100%' }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3>{__('Tempo per la Risposta (giorni)', 'gepafin')}</h3>
|
||||||
|
<div style={{marginBottom: '30px'}}>
|
||||||
|
<InputNumber
|
||||||
|
keyfilter="int"
|
||||||
|
value={formData.responseDays}
|
||||||
|
showButtons
|
||||||
|
onChange={(e) => updateEvaluationValue(
|
||||||
|
e.value,
|
||||||
|
'responseDays',
|
||||||
|
9999
|
||||||
|
)}/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3>{__('Notifica', 'gepafin')}</h3>
|
||||||
|
<div className="appPageSection__withBorder grey">
|
||||||
|
<div className="appForm__field row">
|
||||||
|
<InputSwitch
|
||||||
|
inputId="notify_email"
|
||||||
|
checked={formData.isSendEmail}
|
||||||
|
onChange={(e) => updateEvaluationValue(
|
||||||
|
e.value,
|
||||||
|
'isSendEmail'
|
||||||
|
)}/>
|
||||||
|
<label htmlFor="notify_email">{__('Notifiche Email', 'gepafin')}</label>
|
||||||
|
</div>
|
||||||
|
<div className="appForm__field row">
|
||||||
|
<InputSwitch
|
||||||
|
inputId="notify_push"
|
||||||
|
checked={formData.isSendNotification}
|
||||||
|
onChange={(e) => updateEvaluationValue(
|
||||||
|
e.value,
|
||||||
|
'isSendNotification'
|
||||||
|
)}/>
|
||||||
|
<label htmlFor="notify_push">{__('Notifiche Push', 'gepafin')}</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{formData.formFields
|
||||||
|
? <div>
|
||||||
|
<h3>{__('Documenti da Integrare', 'gepafin')}</h3>
|
||||||
|
<div className="appPageSection__withBorder grey">
|
||||||
|
<div className="appPageSection__checklist">
|
||||||
|
{formData.formFields.map((o, i) => <div key={o.fieldId}>
|
||||||
|
<Checkbox
|
||||||
|
inputId={`checklist_${o.fieldId}`}
|
||||||
|
onChange={(e) => updateEvaluationValue(
|
||||||
|
e.checked,
|
||||||
|
`formFields.${i}.selected`
|
||||||
|
)}
|
||||||
|
checked={o.selected}></Checkbox>
|
||||||
|
<label htmlFor={`checklist_${o.fieldId}`}>{o.label}</label>
|
||||||
|
</div>)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
: null}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPageSection__message warning">
|
||||||
|
<i className="pi pi-exclamation-triangle"></i>
|
||||||
|
<span className="summary">{__('Attenzione', 'gepafin')}</span>
|
||||||
|
<span>{__("L'invio della richiesta di integrazione sospenderà il termine di valutazione della domanda.", 'gepafin')}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPageSection__hr">
|
||||||
|
<span>{__('Azioni', 'gepafin')}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPageSection">
|
||||||
|
<div className="appPageSection__actions">
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
outlined
|
||||||
|
onClick={goToEvaluationPage}
|
||||||
|
label={__('Anulla', 'gepafin')}
|
||||||
|
icon="pi pi-times" iconPos="right"/>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
onClick={initCreationProcess}
|
||||||
|
label={__('Invia richiesta', 'gepafin')}
|
||||||
|
icon="pi pi-check" iconPos="right"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Dialog
|
||||||
|
visible={isVisibleConfirmDialog}
|
||||||
|
modal
|
||||||
|
header={headerConfirmDialog}
|
||||||
|
footer={footerConfirmDialog}
|
||||||
|
style={{ maxWidth: '600px', width: '100%' }}
|
||||||
|
onHide={hideConfirmDialog}>
|
||||||
|
<div className="appForm__field">
|
||||||
|
<p>{__('Soccorso istruttorio autorizzato dal direttore e autorizzazione caricata su portale a seguito del quale parte l\'email?', 'gepafin')}</p>
|
||||||
|
</div>
|
||||||
|
</Dialog>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
: <>
|
||||||
|
<Skeleton width="20%" height="1rem" className="mb-2"></Skeleton>
|
||||||
|
<Skeleton width="100%" height="2rem" className="mb-8"></Skeleton>
|
||||||
|
<Skeleton width="20%" height="1rem" className="mb-2"></Skeleton>
|
||||||
|
<Skeleton width="100%" height="4rem" className="mb-8"></Skeleton>
|
||||||
|
<Skeleton width="20%" height="1rem" className="mb-2"></Skeleton>
|
||||||
|
<Skeleton width="100%" height="2rem" className="mb-8"></Skeleton>
|
||||||
|
<Skeleton width="20%" height="1rem" className="mb-2"></Skeleton>
|
||||||
|
<Skeleton width="100%" height="4rem"></Skeleton>
|
||||||
|
</>}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SoccorsoAddInstructorManager;
|
||||||
587
src/pages/SoccorsoEditInstructorManager/index.js
Normal file
587
src/pages/SoccorsoEditInstructorManager/index.js
Normal file
@@ -0,0 +1,587 @@
|
|||||||
|
import React, { useState, useEffect, useRef, useMemo } from 'react';
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
import { useNavigate, useParams } from 'react-router-dom';
|
||||||
|
import { is, isEmpty } from 'ramda';
|
||||||
|
import { wrap } from 'object-path-immutable';
|
||||||
|
import { klona } from 'klona';
|
||||||
|
import { useForm } from 'react-hook-form';
|
||||||
|
|
||||||
|
// store
|
||||||
|
import { storeSet, useStore } from '../../store';
|
||||||
|
|
||||||
|
// api
|
||||||
|
import AmendmentsService from '../../service/amendments-service';
|
||||||
|
|
||||||
|
// tools
|
||||||
|
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
||||||
|
import getBandoLabel from '../../helpers/getBandoLabel';
|
||||||
|
import getDateFromISOstring from '../../helpers/getDateFromISOstring';
|
||||||
|
import getEmailTemplateForSoccorso from '../../helpers/getStrippedHtmlBodyTags';
|
||||||
|
|
||||||
|
// components
|
||||||
|
import { Button } from 'primereact/button';
|
||||||
|
import BlockingOverlay from '../../components/BlockingOverlay';
|
||||||
|
import { Toast } from 'primereact/toast';
|
||||||
|
import { classNames } from 'primereact/utils';
|
||||||
|
import { Dialog } from 'primereact/dialog';
|
||||||
|
import FormField from '../../components/FormField';
|
||||||
|
import { Editor } from 'primereact/editor';
|
||||||
|
import { InputNumber } from 'primereact/inputnumber';
|
||||||
|
import SoccorsoComunications from '../SoccorsoEditPreInstructor/components/SoccorsoComunications';
|
||||||
|
|
||||||
|
|
||||||
|
const SoccorsoEditInstructorManager = () => {
|
||||||
|
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||||
|
const { id, amendmentId } = useParams();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const [data, setData] = useState({});
|
||||||
|
const [isVisibleCloseAmendDialog, setIsVisibleCloseAmendDialog] = useState(false);
|
||||||
|
const [isVisibleExtendTimeDialog, setIsVisibleExtendTimeDialog] = useState(false);
|
||||||
|
const [extendedTime, setExtendedTime] = useState(3);
|
||||||
|
const [isLoadingExtendingTime, setIsLoadingExtendingTime] = useState(false);
|
||||||
|
const [isLoadingReminding, setIsLoadingReminding] = useState(false);
|
||||||
|
const [internalNote, setInternalNote] = useState('');
|
||||||
|
const toast = useRef(null);
|
||||||
|
const [formInitialData, setFormInitialData] = useState({});
|
||||||
|
const {
|
||||||
|
control,
|
||||||
|
handleSubmit,
|
||||||
|
formState: { errors },
|
||||||
|
setValue,
|
||||||
|
register,
|
||||||
|
trigger,
|
||||||
|
getValues
|
||||||
|
} = useForm({
|
||||||
|
defaultValues: useMemo(() => {
|
||||||
|
return formInitialData;
|
||||||
|
}, [formInitialData]), mode: 'onChange'
|
||||||
|
});
|
||||||
|
|
||||||
|
const goToEvaluationPage = () => {
|
||||||
|
navigate(`/mie-domande/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const getCallback = (data) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
setData(getFormattedData(data.data));
|
||||||
|
let formDataInitial = data.data.applicationFormFields.reduce((acc, cur) => {
|
||||||
|
if (cur.fieldValue) {
|
||||||
|
acc[cur.fieldId] = cur.fieldValue;
|
||||||
|
}
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
formDataInitial = {
|
||||||
|
...formDataInitial,
|
||||||
|
amendmentDocuments: data.data.amendmentDocuments
|
||||||
|
}
|
||||||
|
setFormInitialData(formDataInitial);
|
||||||
|
}
|
||||||
|
storeSet.main.unsetAsyncRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
const errGetCallback = (data) => {
|
||||||
|
if (toast.current && data.message) {
|
||||||
|
toast.current.show({
|
||||||
|
severity: 'error',
|
||||||
|
summary: '',
|
||||||
|
detail: data.message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
set404FromErrorResponse(data);
|
||||||
|
storeSet.main.unsetAsyncRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
const getFormattedData = (data) => {
|
||||||
|
data.startDate = is(String, data.startDate) ? new Date(data.startDate) : (data.startDate ? data.startDate : '');
|
||||||
|
data.expirationDate = is(String, data.expirationDate) ? new Date(data.expirationDate) : (data.expirationDate ? data.expirationDate : '');
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
const renderHeader = () => {
|
||||||
|
return (
|
||||||
|
<span className="ql-formats">
|
||||||
|
<button className="ql-bold" aria-label="Bold"></button>
|
||||||
|
<button className="ql-italic" aria-label="Italic"></button>
|
||||||
|
<button className="ql-underline" aria-label="Underline"></button>
|
||||||
|
<button className="ql-link" aria-label="Link"></button>
|
||||||
|
<button className="ql-list" value="ordered"></button>
|
||||||
|
<button className="ql-header" value="2"></button>
|
||||||
|
<button className="ql-header" value="3"></button>
|
||||||
|
<button className="ql-blockquote"></button>
|
||||||
|
<button className="ql-list" value="bullet"></button>
|
||||||
|
<button className="ql-indent" value="-1"></button>
|
||||||
|
<button className="ql-indent" value="+1"></button>
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const header = renderHeader();
|
||||||
|
|
||||||
|
const updateNewAmendmentData = (value, path) => {
|
||||||
|
const newData = wrap(data).set(path, value).value();
|
||||||
|
setData(newData);
|
||||||
|
}
|
||||||
|
|
||||||
|
const onSubmit = () => {
|
||||||
|
};
|
||||||
|
|
||||||
|
const doUpdateAmendment = (doClose = false) => {
|
||||||
|
trigger();
|
||||||
|
let formValues = klona(getValues());
|
||||||
|
const newFormValues = Object.keys(formValues)
|
||||||
|
.filter(v => v !== 'amendmentDocuments')
|
||||||
|
.reduce((acc, cur) => {
|
||||||
|
let fieldVal = formValues[cur];
|
||||||
|
|
||||||
|
fieldVal = isEmpty(fieldVal) ? null : fieldVal;
|
||||||
|
fieldVal = is(Array, fieldVal) ? fieldVal.map(o => o.id).join(',') : null;
|
||||||
|
|
||||||
|
acc.push({
|
||||||
|
'fieldId': cur,
|
||||||
|
'fieldValue': fieldVal
|
||||||
|
});
|
||||||
|
return acc;
|
||||||
|
}, []);
|
||||||
|
const newAmendDocs = formValues.amendmentDocuments
|
||||||
|
? formValues.amendmentDocuments.map(o => o.id).join(',')
|
||||||
|
: '';
|
||||||
|
|
||||||
|
const submitData = {
|
||||||
|
applicationFormFields: newFormValues,
|
||||||
|
amendmentDocuments: newAmendDocs,
|
||||||
|
amendmentNotes: data.amendmentNotes
|
||||||
|
}
|
||||||
|
|
||||||
|
storeSet.main.setAsyncRequest();
|
||||||
|
AmendmentsService.updateSoccorso(
|
||||||
|
amendmentId,
|
||||||
|
submitData,
|
||||||
|
(resp) => updateAmendmentCallback(resp, doClose),
|
||||||
|
errUpdateAmendmentCallback
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateAmendmentCallback = (data, doClose = false) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
setData(getFormattedData(data.data));
|
||||||
|
|
||||||
|
if (doClose) {
|
||||||
|
const submitData = {
|
||||||
|
internalNote
|
||||||
|
}
|
||||||
|
storeSet.main.setAsyncRequest();
|
||||||
|
AmendmentsService.closeSoccorso(amendmentId, submitData, closeAmendmentCallback, errCloseAmendmentCallback);
|
||||||
|
} else {
|
||||||
|
if (toast.current) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
storeSet.main.unsetAsyncRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
const errUpdateAmendmentCallback = (data) => {
|
||||||
|
if (toast.current && data.message) {
|
||||||
|
toast.current.show({
|
||||||
|
severity: 'error',
|
||||||
|
summary: '',
|
||||||
|
detail: data.message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
set404FromErrorResponse(data);
|
||||||
|
storeSet.main.unsetAsyncRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
const openCloseAmendmentDialog = () => {
|
||||||
|
setIsVisibleCloseAmendDialog(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
const headerCloseAmendDialog = () => {
|
||||||
|
return <span>{__('Chiudi Soccorso Istruttorio', 'gepafin')}</span>
|
||||||
|
}
|
||||||
|
|
||||||
|
const hideCloseAmendDialog = () => {
|
||||||
|
setIsVisibleCloseAmendDialog(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
const footerCloseAmendDialog = () => {
|
||||||
|
return <div>
|
||||||
|
<Button type="button" label={__('Anulla', 'gepafin')} onClick={hideCloseAmendDialog} outlined/>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
disabled={isAsyncRequest || isEmpty(data.internalNotes)}
|
||||||
|
label={__('Invia', 'gepafin')} onClick={doCloseAmendment}/>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
const doCloseAmendment = () => {
|
||||||
|
doUpdateAmendment(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
const closeAmendmentCallback = (data) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
if (toast.current) {
|
||||||
|
toast.current.show({
|
||||||
|
severity: 'success',
|
||||||
|
summary: '',
|
||||||
|
detail: data.message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (data.data.status) {
|
||||||
|
updateNewAmendmentData(data.data.status, ['status']);
|
||||||
|
setIsVisibleCloseAmendDialog(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
storeSet.main.unsetAsyncRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
const errCloseAmendmentCallback = (data) => {
|
||||||
|
if (toast.current && data.message) {
|
||||||
|
toast.current.show({
|
||||||
|
severity: 'error',
|
||||||
|
summary: '',
|
||||||
|
detail: data.message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
set404FromErrorResponse(data);
|
||||||
|
storeSet.main.unsetAsyncRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
const headerExtendRespDialog = () => {
|
||||||
|
return <span>{__('Estendi scadenza', 'gepafin')}</span>
|
||||||
|
}
|
||||||
|
|
||||||
|
const hideExtendRespDialog = () => {
|
||||||
|
setIsVisibleExtendTimeDialog(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
const footerExtendRespDialog = () => {
|
||||||
|
return <div>
|
||||||
|
<Button type="button" label={__('Anulla', 'gepafin')} onClick={hideExtendRespDialog} outlined/>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
disabled={isLoadingExtendingTime || isEmpty(extendedTime)}
|
||||||
|
label={__('Invia', 'gepafin')} onClick={doExtendTimeResponse}/>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
const openExtendResponseTimeDialog = () => {
|
||||||
|
setIsVisibleExtendTimeDialog(true);
|
||||||
|
setExtendedTime(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
const doExtendTimeResponse = () => {
|
||||||
|
setIsLoadingExtendingTime(true);
|
||||||
|
AmendmentsService.extendSoccorso(amendmentId, extendedTime, extendCallback, errExtendCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
const extendCallback = (data) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
if (toast.current) {
|
||||||
|
toast.current.show({
|
||||||
|
severity: 'success',
|
||||||
|
summary: '',
|
||||||
|
detail: data.message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
setIsVisibleExtendTimeDialog(false);
|
||||||
|
}
|
||||||
|
setIsLoadingExtendingTime(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
const errExtendCallback = (data) => {
|
||||||
|
if (toast.current && data.message) {
|
||||||
|
toast.current.show({
|
||||||
|
severity: 'error',
|
||||||
|
summary: '',
|
||||||
|
detail: data.message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
set404FromErrorResponse(data);
|
||||||
|
setIsLoadingExtendingTime(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
const sendReminder = () => {
|
||||||
|
setIsLoadingReminding(true);
|
||||||
|
AmendmentsService.sendReminderForSoccorso(amendmentId, reminderCallback, errReminderCallback)
|
||||||
|
}
|
||||||
|
|
||||||
|
const reminderCallback = (data) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
if (toast.current) {
|
||||||
|
toast.current.show({
|
||||||
|
severity: 'success',
|
||||||
|
summary: '',
|
||||||
|
detail: data.message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setIsLoadingReminding(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
const errReminderCallback = (data) => {
|
||||||
|
if (toast.current && data.message) {
|
||||||
|
toast.current.show({
|
||||||
|
severity: 'error',
|
||||||
|
summary: '',
|
||||||
|
detail: data.message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
set404FromErrorResponse(data);
|
||||||
|
setIsLoadingReminding(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (formInitialData) {
|
||||||
|
Object.keys(formInitialData).map(k => setValue(k, formInitialData[k]));
|
||||||
|
trigger();
|
||||||
|
}
|
||||||
|
}, [formInitialData]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const parsedSoccorsoId = parseInt(amendmentId);
|
||||||
|
const soccorsoEntityId = !isNaN(parsedSoccorsoId) ? parsedSoccorsoId : 0;
|
||||||
|
|
||||||
|
AmendmentsService.getSoccorsoById(getCallback, errGetCallback, [['id', soccorsoEntityId]]);
|
||||||
|
}, [amendmentId]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="appPage">
|
||||||
|
<div className="appPage__pageHeader">
|
||||||
|
<h1>{__('Soccorso Istruttorio - Dettagli', 'gepafin')}</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPage__spacer"></div>
|
||||||
|
<Toast ref={toast}/>
|
||||||
|
<BlockingOverlay shouldDisplay={isAsyncRequest}/>
|
||||||
|
|
||||||
|
<div className="appPageSection__row">
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
outlined
|
||||||
|
onClick={goToEvaluationPage}
|
||||||
|
label={__('Indietro', 'gepafin')}
|
||||||
|
icon="pi pi-arrow-left" iconPos="left"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
|
<div className="appPage__content">
|
||||||
|
<div className="appPageSection__withBorder columns">
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('ID domanda', 'gepafin')}</span>
|
||||||
|
<span>{data.applicationId}</span>
|
||||||
|
</p>
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('Bando', 'gepafin')}</span>
|
||||||
|
<span>{data.callName}</span>
|
||||||
|
</p>
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('Referente Aziendale', 'gepafin')}</span>
|
||||||
|
<span>{data.beneficiaryName}</span>
|
||||||
|
</p>
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('Inizio', 'gepafin')}</span>
|
||||||
|
<span>{getDateFromISOstring(data.startDate)}</span>
|
||||||
|
</p>
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('Scadenza', 'gepafin')}</span>
|
||||||
|
<span>{getDateFromISOstring(data.expirationDate)}</span>
|
||||||
|
</p>
|
||||||
|
<p className="appPageSection__pMeta">
|
||||||
|
<span>{__('Stato', 'gepafin')}</span>
|
||||||
|
<span>{getBandoLabel(data.status)}</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPageSection">
|
||||||
|
<h2>{__('Dettagli richiesta', 'gepafin')}</h2>
|
||||||
|
<h3>{__('Note e spiegazioni', 'gepafin')}</h3>
|
||||||
|
<div
|
||||||
|
className="appPageSection__emailTemplate">{getEmailTemplateForSoccorso(data.emailTemplate, data.note)}</div>
|
||||||
|
</div>
|
||||||
|
<div className="appPageSection">
|
||||||
|
<h3>{__('Documenti richiesti', 'gepafin')}</h3>
|
||||||
|
<ol className="appPageSection__list">
|
||||||
|
{data.formFields
|
||||||
|
? data.formFields.map((o, i) => <li key={o.fieldId}
|
||||||
|
style={{ flexDirection: 'row' }}>
|
||||||
|
<span>{o.label}</span>
|
||||||
|
</li>) : null}
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPageSection">
|
||||||
|
<h2>{__('Comunicazioni', 'gepafin')}</h2>
|
||||||
|
<SoccorsoComunications amendmentId={amendmentId} soccorsoStatus={data.status}/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{data.formFields && !isEmpty(data.formFields)
|
||||||
|
? <div className="appPageSection">
|
||||||
|
<h2>{__('Documenti Ricevuti', 'gepafin')}</h2>
|
||||||
|
|
||||||
|
<form className="appForm" onSubmit={handleSubmit(onSubmit)}>
|
||||||
|
{data.formFields.map((o, i) => {
|
||||||
|
return <FormField
|
||||||
|
key={o.fieldId}
|
||||||
|
disabled={['CLOSE', 'AWAITING', 'EXPIRED'].includes(data.status)}
|
||||||
|
type="fileupload"
|
||||||
|
setDataFn={setValue}
|
||||||
|
saveFormCallback={doUpdateAmendment}
|
||||||
|
fieldName={o.fieldId}
|
||||||
|
label={o.label}
|
||||||
|
control={control}
|
||||||
|
register={register}
|
||||||
|
errors={errors}
|
||||||
|
defaultValue={formInitialData[o.fieldId] ? formInitialData[o.fieldId] : []}
|
||||||
|
accept={[]}
|
||||||
|
source="AMENDMENT"
|
||||||
|
sourceId={amendmentId}
|
||||||
|
multiple={true}
|
||||||
|
/>
|
||||||
|
})}
|
||||||
|
</form>
|
||||||
|
</div> : null}
|
||||||
|
|
||||||
|
<div className="appPageSection">
|
||||||
|
<h2>{__('Documenti aggiuntivi', 'gepafin')}</h2>
|
||||||
|
<div className="appPageSection">
|
||||||
|
<h3>{__('Notes', 'gepafin')}</h3>
|
||||||
|
<div style={{ marginBottom: '30px', width: '100%', position: 'relative' }}>
|
||||||
|
<BlockingOverlay shouldDisplay={['CLOSE', 'AWAITING', 'EXPIRED'].includes(data.status)}/>
|
||||||
|
<Editor
|
||||||
|
value={data.amendmentNotes}
|
||||||
|
readOnly={['CLOSE', 'AWAITING', 'EXPIRED'].includes(data.status)}
|
||||||
|
placeholder={__('Digita qui il messagio', 'gepafin')}
|
||||||
|
headerTemplate={header}
|
||||||
|
onTextChange={(e) => updateNewAmendmentData(
|
||||||
|
e.htmlValue,
|
||||||
|
'amendmentNotes'
|
||||||
|
)}
|
||||||
|
style={{ height: 80 * 3, width: '100%' }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<FormField
|
||||||
|
type="fileupload"
|
||||||
|
disabled={['CLOSE', 'AWAITING', 'EXPIRED'].includes(data.status)}
|
||||||
|
setDataFn={setValue}
|
||||||
|
saveFormCallback={doUpdateAmendment}
|
||||||
|
fieldName="amendmentDocuments"
|
||||||
|
label={__('I file', 'gepafin')}
|
||||||
|
control={control}
|
||||||
|
register={register}
|
||||||
|
errors={errors}
|
||||||
|
defaultValue={formInitialData.amendmentDocuments ? formInitialData.amendmentDocuments : []}
|
||||||
|
accept={[]}
|
||||||
|
source="amendment"
|
||||||
|
sourceId={amendmentId}
|
||||||
|
multiple={true}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
|
<div className="appPageSection__hr">
|
||||||
|
<span>{__('Azioni', 'gepafin')}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPageSection">
|
||||||
|
<div className="appPageSection__actions">
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
onClick={sendReminder}
|
||||||
|
disabled={isLoadingReminding || ['CLOSE', 'EXPIRED'].includes(data.status)}
|
||||||
|
outlined
|
||||||
|
label={__('Invia Sollecito', 'gepafin')}
|
||||||
|
icon="pi pi-send"
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
onClick={openExtendResponseTimeDialog}
|
||||||
|
disabled={isLoadingExtendingTime || ['CLOSE', 'EXPIRED'].includes(data.status)}
|
||||||
|
outlined
|
||||||
|
label={__('Estendi Scadenza', 'gepafin')}
|
||||||
|
icon="pi pi-stopwatch"
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
onClick={() => doUpdateAmendment()}
|
||||||
|
disabled={isAsyncRequest || ['CLOSE', 'AWAITING', 'EXPIRED'].includes(data.status)}
|
||||||
|
label={__('Salva bozza', 'gepafin')}
|
||||||
|
icon="pi pi-save" iconPos="right"/>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
onClick={openCloseAmendmentDialog}
|
||||||
|
disabled={isAsyncRequest || ['CLOSE', 'AWAITING'].includes(data.status)}
|
||||||
|
label={__('Chiudi Soccorso Istruttorio', 'gepafin')}
|
||||||
|
icon="pi pi-times" iconPos="right"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Dialog
|
||||||
|
visible={isVisibleExtendTimeDialog}
|
||||||
|
modal
|
||||||
|
header={headerExtendRespDialog}
|
||||||
|
footer={footerExtendRespDialog}
|
||||||
|
style={{ maxWidth: '600px', width: '100%' }}
|
||||||
|
onHide={hideExtendRespDialog}>
|
||||||
|
<div className="appForm__field">
|
||||||
|
<label
|
||||||
|
className={classNames({ 'p-error': isEmpty(extendedTime) })}>
|
||||||
|
{__('Giorni', 'gepafin')}*
|
||||||
|
</label>
|
||||||
|
<InputNumber
|
||||||
|
keyfilter="int"
|
||||||
|
disabled={['CLOSE', 'EXPIRED'].includes(data.status)}
|
||||||
|
value={extendedTime}
|
||||||
|
showButtons
|
||||||
|
onChange={(e) => setExtendedTime(e.value)}/>
|
||||||
|
</div>
|
||||||
|
</Dialog>
|
||||||
|
|
||||||
|
<Dialog
|
||||||
|
visible={isVisibleCloseAmendDialog}
|
||||||
|
modal
|
||||||
|
header={headerCloseAmendDialog}
|
||||||
|
footer={footerCloseAmendDialog}
|
||||||
|
style={{ maxWidth: '600px', width: '100%' }}
|
||||||
|
onHide={hideCloseAmendDialog}>
|
||||||
|
<div className="appForm__field">
|
||||||
|
<label>{__('Motivazioni', 'gepafin')}</label>
|
||||||
|
<div style={{ position: 'relative' }}>
|
||||||
|
<BlockingOverlay shouldDisplay={data.status === 'CLOSE'}/>
|
||||||
|
<Editor
|
||||||
|
value={internalNote}
|
||||||
|
readOnly={['CLOSE', 'EXPIRED'].includes(data.status)}
|
||||||
|
placeholder={__('Digita qui il messagio', 'gepafin')}
|
||||||
|
headerTemplate={header}
|
||||||
|
onTextChange={(e) => setInternalNote(e.htmlValue)}
|
||||||
|
style={{ height: 80 * 3, width: '100%' }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Dialog>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SoccorsoEditInstructorManager;
|
||||||
@@ -34,12 +34,6 @@ const SoccorsoIstruttorioPreInstructor = () => {
|
|||||||
|
|
||||||
<div className="appPage__spacer"></div>
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
<div className="appPageSection">
|
|
||||||
<PreInstructorSoccorsiTable/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="appPage__spacer"></div>
|
|
||||||
|
|
||||||
<div className="appPageSection statsBigBadges">
|
<div className="appPageSection statsBigBadges">
|
||||||
<h2>{__('Riepilogo', 'gepafin')}</h2>
|
<h2>{__('Riepilogo', 'gepafin')}</h2>
|
||||||
<div className="statsBigBadges__grid applStats">
|
<div className="statsBigBadges__grid applStats">
|
||||||
@@ -88,6 +82,12 @@ const SoccorsoIstruttorioPreInstructor = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
|
<div className="appPageSection">
|
||||||
|
<PreInstructorSoccorsiTable/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,13 @@ import DomandeInstructorManager from './pages/DomandeInstructorManager';
|
|||||||
import DomandaEditInstructorManager from './pages/DomandaEditInstructorManager';
|
import DomandaEditInstructorManager from './pages/DomandaEditInstructorManager';
|
||||||
import UserActivity from './pages/UserActivity';
|
import UserActivity from './pages/UserActivity';
|
||||||
import DomandeArchive from './pages/DomandeArchive';
|
import DomandeArchive from './pages/DomandeArchive';
|
||||||
|
import BandiPreInstructor from './pages/BandiPreInstructor';
|
||||||
|
import BandoViewPreInstructor from './pages/BandoViewPreInstructor';
|
||||||
|
import DomandeArchivePreInstructor from './pages/DomandeArchivePreInstructor';
|
||||||
|
import DashboardInstructorManager from './pages/DashboardInstructorManager';
|
||||||
|
import DomandeMieInstructorManager from './pages/DomandeMieInstructorManager';
|
||||||
|
import SoccorsoAddInstructorManager from './pages/SoccorsoAddInstructorManager';
|
||||||
|
import SoccorsoEditInstructorManager from './pages/SoccorsoEditInstructorManager';
|
||||||
|
|
||||||
const routes = ({ role, chosenCompanyId }) => {
|
const routes = ({ role, chosenCompanyId }) => {
|
||||||
|
|
||||||
@@ -51,19 +58,19 @@ 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}
|
{'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_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
|
{'ROLE_PRE_INSTRUCTOR' === role ? <BandiPreInstructor/> : null}
|
||||||
{'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : 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_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
|
{'ROLE_PRE_INSTRUCTOR' === role ? <BandoViewPreInstructor/> : null}
|
||||||
{'ROLE_INSTRUCTOR_MANAGER' === role ? <PageNotFound/> : 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}
|
||||||
@@ -117,7 +124,7 @@ const routes = ({ role, chosenCompanyId }) => {
|
|||||||
{'ROLE_SUPER_ADMIN' === role ? <BandoApplicationPreview/> : null}
|
{'ROLE_SUPER_ADMIN' === role ? <BandoApplicationPreview/> : null}
|
||||||
{'ROLE_BENEFICIARY' === role ? <SoccorsoEditBeneficiario/> : null}
|
{'ROLE_BENEFICIARY' === role ? <SoccorsoEditBeneficiario/> : null}
|
||||||
{'ROLE_PRE_INSTRUCTOR' === role ? <DomandaEditPreInstructor/> : null}
|
{'ROLE_PRE_INSTRUCTOR' === role ? <DomandaEditPreInstructor/> : null}
|
||||||
{'ROLE_INSTRUCTOR_MANAGER' === role ? <DomandaEditInstructorManager/> : 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}
|
||||||
@@ -128,7 +135,7 @@ const routes = ({ role, chosenCompanyId }) => {
|
|||||||
<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_PRE_INSTRUCTOR' === role ? <DomandeArchive/> : 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>
|
||||||
@@ -141,7 +148,7 @@ const routes = ({ role, chosenCompanyId }) => {
|
|||||||
{'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}
|
{'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}
|
||||||
@@ -155,6 +162,36 @@ const routes = ({ role, chosenCompanyId }) => {
|
|||||||
{'ROLE_PRE_INSTRUCTOR' === role ? <SoccorsoIstruttorioPreInstructor/> : null}
|
{'ROLE_PRE_INSTRUCTOR' === role ? <SoccorsoIstruttorioPreInstructor/> : null}
|
||||||
{'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoIstruttorioPreInstructor/> : null}
|
{'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoIstruttorioPreInstructor/> : null}
|
||||||
</DefaultLayout>}/>
|
</DefaultLayout>}/>
|
||||||
|
<Route path="/mie-domande" element={<DefaultLayout>
|
||||||
|
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
|
||||||
|
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
|
||||||
|
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
|
||||||
|
{'ROLE_INSTRUCTOR_MANAGER' === role ? <DomandeMieInstructorManager/> : null}
|
||||||
|
</DefaultLayout>}/>
|
||||||
|
<Route path="/mie-domande/:id/" element={<DefaultLayout>
|
||||||
|
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
|
||||||
|
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
|
||||||
|
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
|
||||||
|
{'ROLE_INSTRUCTOR_MANAGER' === role ? <DomandaEditInstructorManager/> : null}
|
||||||
|
</DefaultLayout>}/>
|
||||||
|
<Route path="/mie-domande/:id/aggiungi-soccorso" element={<DefaultLayout>
|
||||||
|
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
|
||||||
|
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
|
||||||
|
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
|
||||||
|
{'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoAddInstructorManager/> : null}
|
||||||
|
</DefaultLayout>}/>
|
||||||
|
<Route path="/mie-domande/:id/soccorso/:amendmentId" element={<DefaultLayout>
|
||||||
|
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
|
||||||
|
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
|
||||||
|
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
|
||||||
|
{'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoEditInstructorManager/> : null}
|
||||||
|
</DefaultLayout>}/>
|
||||||
|
<Route path="/mio-soccorso-istruttorio/" element={<DefaultLayout>
|
||||||
|
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
|
||||||
|
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
|
||||||
|
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
|
||||||
|
{'ROLE_INSTRUCTOR_MANAGER' === role ? <SoccorsoIstruttorioPreInstructor/> : null}
|
||||||
|
</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}
|
||||||
|
|||||||
Reference in New Issue
Block a user