Merge pull request #15 from Kitzanos/master-sync/25-11-2024
Master sync/25 11 2024
This commit is contained in:
3
.env
3
.env
@@ -3,4 +3,5 @@ REACT_APP_API_EXECUTION_ADDRESS=https://api-dev-gepafin.memento.credit/v1
|
|||||||
REACT_APP_API_ADDRESS=https://api-dev-gepafin.memento.credit
|
REACT_APP_API_ADDRESS=https://api-dev-gepafin.memento.credit
|
||||||
REACT_APP_LOGO_FILENAME=gepafin-logo.svg
|
REACT_APP_LOGO_FILENAME=gepafin-logo.svg
|
||||||
REACT_APP_FAVICON_FILENAME=gepafin-favicon.ico
|
REACT_APP_FAVICON_FILENAME=gepafin-favicon.ico
|
||||||
REACT_APP_HUB_ID=p4lk3bcx1RStqTaIVVbXs
|
REACT_APP_HUB_ID=p4lk3bcx1RStqTaIVVbXs
|
||||||
|
REACT_APP_EVALUATION_FLOW_ID=1
|
||||||
@@ -3,4 +3,5 @@ REACT_APP_API_EXECUTION_ADDRESS=https://api-dev-gepafin.memento.credit/v1
|
|||||||
REACT_APP_API_ADDRESS=https://api-dev-gepafin.memento.credit
|
REACT_APP_API_ADDRESS=https://api-dev-gepafin.memento.credit
|
||||||
REACT_APP_LOGO_FILENAME=gepafin-logo.svg
|
REACT_APP_LOGO_FILENAME=gepafin-logo.svg
|
||||||
REACT_APP_FAVICON_FILENAME=gepafin-favicon.ico
|
REACT_APP_FAVICON_FILENAME=gepafin-favicon.ico
|
||||||
REACT_APP_HUB_ID=p4lk3bcx1RStqTaIVVbXs
|
REACT_APP_HUB_ID=p4lk3bcx1RStqTaIVVbXs
|
||||||
|
REACT_APP_EVALUATION_FLOW_ID=1
|
||||||
@@ -3,4 +3,5 @@ REACT_APP_API_EXECUTION_ADDRESS=https://bandi-api.gepafin.it/v1
|
|||||||
REACT_APP_API_ADDRESS=https://bandi-api.gepafin.it
|
REACT_APP_API_ADDRESS=https://bandi-api.gepafin.it
|
||||||
REACT_APP_LOGO_FILENAME=gepafin-logo.svg
|
REACT_APP_LOGO_FILENAME=gepafin-logo.svg
|
||||||
REACT_APP_FAVICON_FILENAME=gepafin-favicon.ico
|
REACT_APP_FAVICON_FILENAME=gepafin-favicon.ico
|
||||||
REACT_APP_HUB_ID=p4lk3bcx1RStqTaIVVbXs
|
REACT_APP_HUB_ID=p4lk3bcx1RStqTaIVVbXs
|
||||||
|
REACT_APP_EVALUATION_FLOW_ID=1
|
||||||
@@ -208,10 +208,18 @@
|
|||||||
column-count: 2;
|
column-count: 2;
|
||||||
column-width: 4em;
|
column-width: 4em;
|
||||||
display: block;
|
display: block;
|
||||||
padding-bottom: 0;
|
/*padding-bottom: 0;*/
|
||||||
|
|
||||||
.appPageSection__pMeta {
|
.appPageSection__pMeta {
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
|
|
||||||
|
span:nth-of-type(1) {
|
||||||
|
max-width: 30%;
|
||||||
|
}
|
||||||
|
span:nth-of-type(2) {
|
||||||
|
max-width: 60%;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -221,22 +229,31 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
list-style: inside;
|
||||||
|
}
|
||||||
|
|
||||||
> li {
|
.appPageSection__listItem {
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
border-bottom: 1px solid var(--button-secondary-borderColor);
|
border-bottom: 1px solid var(--button-secondary-borderColor);
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
|
|
||||||
&.row {
|
&.row {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.appPageSection__listItemRow {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 16px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.appPageSection__checklist {
|
.appPageSection__checklist {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@@ -23,6 +23,9 @@
|
|||||||
border-width: 0 0 1px 0;
|
border-width: 0 0 1px 0;
|
||||||
padding: 1rem 1rem;
|
padding: 1rem 1rem;
|
||||||
}
|
}
|
||||||
|
tr.outgoing {
|
||||||
|
background-color: #DAF0C3B2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.myTfoot {
|
.myTfoot {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { classNames } from 'primereact/utils';
|
import { classNames } from 'primereact/utils';
|
||||||
import { Controller } from 'react-hook-form';
|
import { Controller } from 'react-hook-form';
|
||||||
import { is } from 'ramda';
|
import { is, isEmpty } from 'ramda';
|
||||||
|
|
||||||
import { Calendar } from 'primereact/calendar';
|
import { Calendar } from 'primereact/calendar';
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ const Datepicker = ({
|
|||||||
rules={config}
|
rules={config}
|
||||||
render={({ field, fieldState }) => (<Calendar id={field.name}
|
render={({ field, fieldState }) => (<Calendar id={field.name}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
value={is(String, field.value) ? new Date(field.value) : field.value}
|
value={is(String, field.value) && !isEmpty(field.value) ? new Date(field.value) : field.value}
|
||||||
onChange={(e) => field.onChange(e.value)}
|
onChange={(e) => field.onChange(e.value)}
|
||||||
dateFormat="dd/mm/yy"
|
dateFormat="dd/mm/yy"
|
||||||
hourFormat="24"
|
hourFormat="24"
|
||||||
|
|||||||
@@ -100,8 +100,8 @@ const Fileupload = ({
|
|||||||
if (file.id) {
|
if (file.id) {
|
||||||
FileUploadService.deleteFile(
|
FileUploadService.deleteFile(
|
||||||
{},
|
{},
|
||||||
(data) => dCallback(data, file.id),
|
(data) => deleteCallback(data, file.id),
|
||||||
dErrorCallback,
|
deleteErrorCallback,
|
||||||
[['id', file.id]]
|
[['id', file.id]]
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@@ -111,7 +111,7 @@ const Fileupload = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const dCallback = (data, id) => {
|
const deleteCallback = (data, id) => {
|
||||||
if (data.status === 'SUCCESS') {
|
if (data.status === 'SUCCESS') {
|
||||||
setStateFieldData(prevState => {
|
setStateFieldData(prevState => {
|
||||||
const newFiles = prevState.filter(o => o.id !== id);
|
const newFiles = prevState.filter(o => o.id !== id);
|
||||||
@@ -122,7 +122,7 @@ const Fileupload = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const dErrorCallback = (err) => {
|
const deleteErrorCallback = (err) => {
|
||||||
console.log('err', err);
|
console.log('err', err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,13 @@ const AppSidebar = () => {
|
|||||||
id: 4,
|
id: 4,
|
||||||
enable: intersection(permissions, ['VIEW_CALLS']).length
|
enable: intersection(permissions, ['VIEW_CALLS']).length
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: __('Bandi osservati', 'gepafin'),
|
||||||
|
icon: 'pi pi-star',
|
||||||
|
href: '/bandi-osservati',
|
||||||
|
id: 13,
|
||||||
|
enable: intersection(permissions, ['VIEW_CALLS']).length
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: __('Gestione domande', 'gepafin'),
|
label: __('Gestione domande', 'gepafin'),
|
||||||
icon: 'pi pi-file',
|
icon: 'pi pi-file',
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import { Calendar } from 'primereact/calendar';
|
|||||||
import { Tag } from 'primereact/tag';
|
import { Tag } from 'primereact/tag';
|
||||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
import translationStrings from '../../../../translationStringsForComponents';
|
||||||
|
|
||||||
|
|
||||||
const AllBandiTable = () => {
|
const AllBandiTable = () => {
|
||||||
@@ -115,7 +116,7 @@ const AllBandiTable = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const statusFilterTemplate = (options) => {
|
const statusFilterTemplate = (options) => {
|
||||||
return <Dropdown value={options.value} options={statuses} onChange={(e) => options.filterCallback(e.value, options.index)} itemTemplate={statusItemTemplate} placeholder="Select One" className="p-column-filter" showClear />;
|
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) => {
|
const statusItemTemplate = (option) => {
|
||||||
@@ -136,7 +137,7 @@ const AllBandiTable = () => {
|
|||||||
filters={filters}
|
filters={filters}
|
||||||
globalFilterFields={['name', 'status']}
|
globalFilterFields={['name', 'status']}
|
||||||
header={header}
|
header={header}
|
||||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
emptyMessage={translationStrings.emptyMessage}
|
||||||
onFilter={(e) => setFilters(e.filters)}>
|
onFilter={(e) => setFilters(e.filters)}>
|
||||||
<Column field="name" header={__('Nome Bando', 'gepafin')}
|
<Column field="name" header={__('Nome Bando', 'gepafin')}
|
||||||
filter filterPlaceholder={__('Cerca', 'gepafin')}
|
filter filterPlaceholder={__('Cerca', 'gepafin')}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import renderHtmlContent from '../../../../helpers/renderHtmlContent';
|
|||||||
|
|
||||||
// api
|
// api
|
||||||
import BandoService from '../../../../service/bando-service';
|
import BandoService from '../../../../service/bando-service';
|
||||||
|
import PreferredBandoService from '../../../../service/preferred-bando-service';
|
||||||
|
|
||||||
// components
|
// components
|
||||||
import { DataTable } from 'primereact/datatable';
|
import { DataTable } from 'primereact/datatable';
|
||||||
@@ -25,10 +26,11 @@ import { Dropdown } from 'primereact/dropdown';
|
|||||||
import { Tag } from 'primereact/tag';
|
import { Tag } from 'primereact/tag';
|
||||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||||
import { Button } from 'primereact/button';
|
import { Button } from 'primereact/button';
|
||||||
import PreferredBandoService from '../../../../service/preferred-bando-service';
|
|
||||||
|
|
||||||
|
// i18n
|
||||||
|
import translationStrings from '../../../../translationStringsForComponents';
|
||||||
|
|
||||||
const AllBandiAccordion = () => {
|
const AllBandiAccordion = ({ showOnlyPreferred = false }) => {
|
||||||
const chosenCompanyId = useStore().main.chosenCompanyId();
|
const chosenCompanyId = useStore().main.chosenCompanyId();
|
||||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||||
const [items, setItems] = useState(null);
|
const [items, setItems] = useState(null);
|
||||||
@@ -40,7 +42,8 @@ const AllBandiAccordion = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
storeSet.main.setAsyncRequest();
|
storeSet.main.setAsyncRequest();
|
||||||
BandoService.getBandi(getCallback, errGetCallbacks, [
|
BandoService.getBandi(getCallback, errGetCallbacks, [
|
||||||
['companyId', chosenCompanyId]
|
['companyId', chosenCompanyId],
|
||||||
|
['onlyPreferredCall', showOnlyPreferred]
|
||||||
]);
|
]);
|
||||||
}, [chosenCompanyId]);
|
}, [chosenCompanyId]);
|
||||||
|
|
||||||
@@ -81,7 +84,19 @@ const AllBandiAccordion = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const amountBodyTemplate = (rowData) => {
|
const amountBodyTemplate = (rowData) => {
|
||||||
return getNumberWithCurrency(rowData.amount);
|
return <span
|
||||||
|
className="appPageSection__titleClickable"
|
||||||
|
onClick={() => {
|
||||||
|
let newExpandedRows;
|
||||||
|
if (isNil(expandedRows) || isNil(expandedRows[rowData.id])) {
|
||||||
|
newExpandedRows = isNil(expandedRows)
|
||||||
|
? wrap({}).set([rowData.id], true).value()
|
||||||
|
: wrap(expandedRows).set([rowData.id], true).value();
|
||||||
|
} else {
|
||||||
|
newExpandedRows = wrap(expandedRows).del([rowData.id]).value();
|
||||||
|
}
|
||||||
|
setExpandedRows(newExpandedRows);
|
||||||
|
}}>{getNumberWithCurrency(rowData.amount)}</span>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const statusBodyTemplate = (rowData) => {
|
const statusBodyTemplate = (rowData) => {
|
||||||
@@ -89,11 +104,14 @@ const AllBandiAccordion = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const statusFilterTemplate = (options) => {
|
const statusFilterTemplate = (options) => {
|
||||||
return <Dropdown value={options.value} options={statuses} onChange={(e) => options.filterCallback(e.value, options.index)} itemTemplate={statusItemTemplate} placeholder="Select One" className="p-column-filter" showClear />;
|
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) => {
|
const statusItemTemplate = (option) => {
|
||||||
return <Tag value={getBandoLabel(option)} severity={getBandoSeverity(option)} />;
|
return <Tag value={getBandoLabel(option)} severity={getBandoSeverity(option)}/>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const addToFavourites = (id, preferredId) => {
|
const addToFavourites = (id, preferredId) => {
|
||||||
@@ -188,7 +206,7 @@ const AllBandiAccordion = () => {
|
|||||||
loading={isAsyncRequest}
|
loading={isAsyncRequest}
|
||||||
dataKey="id"
|
dataKey="id"
|
||||||
filters={filters}
|
filters={filters}
|
||||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
emptyMessage={translationStrings.emptyMessage}
|
||||||
expandedRows={expandedRows}
|
expandedRows={expandedRows}
|
||||||
onRowToggle={(e) => setExpandedRows(e.data)}
|
onRowToggle={(e) => setExpandedRows(e.data)}
|
||||||
rowExpansionTemplate={rowExpansionTemplate}
|
rowExpansionTemplate={rowExpansionTemplate}
|
||||||
@@ -198,7 +216,7 @@ const AllBandiAccordion = () => {
|
|||||||
body={nameBodyTemplate}
|
body={nameBodyTemplate}
|
||||||
style={{ minWidth: '12rem' }}/>
|
style={{ minWidth: '12rem' }}/>
|
||||||
<Column header={__('Importo totale', 'gepafin')} filterField="amount"
|
<Column header={__('Importo totale', 'gepafin')} filterField="amount"
|
||||||
style={{ minWidth: '10rem' }} body={amountBodyTemplate} sortable/>
|
style={{ minWidth: '10rem' }} body={amountBodyTemplate}/>
|
||||||
<Column field="status" header={__('Stato', 'gepafin')} filterMenuStyle={{ width: '14rem' }}
|
<Column field="status" header={__('Stato', 'gepafin')} filterMenuStyle={{ width: '14rem' }}
|
||||||
style={{ width: '8rem' }} body={statusBodyTemplate} filter sortable
|
style={{ width: '8rem' }} body={statusBodyTemplate} filter sortable
|
||||||
filterElement={statusFilterTemplate}/>
|
filterElement={statusFilterTemplate}/>
|
||||||
|
|||||||
@@ -0,0 +1,216 @@
|
|||||||
|
import React, { useState, useEffect} from 'react';
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
import { is, uniq, isNil, isEmpty } from 'ramda';
|
||||||
|
import { wrap } from 'object-path-immutable';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
// store
|
||||||
|
import { storeGet, storeSet, useStore } from '../../../../store';
|
||||||
|
|
||||||
|
// tools
|
||||||
|
import getBandoSeverity from '../../../../helpers/getBandoSeverity';
|
||||||
|
import getBandoLabel from '../../../../helpers/getBandoLabel';
|
||||||
|
import getDateFromISOstring from '../../../../helpers/getDateFromISOstring';
|
||||||
|
import set404FromErrorResponse from '../../../../helpers/set404FromErrorResponse';
|
||||||
|
import getNumberWithCurrency from '../../../../helpers/getNumberWithCurrency';
|
||||||
|
import renderHtmlContent from '../../../../helpers/renderHtmlContent';
|
||||||
|
|
||||||
|
// api
|
||||||
|
import PreferredBandoService from '../../../../service/preferred-bando-service';
|
||||||
|
|
||||||
|
// components
|
||||||
|
import { DataTable } from 'primereact/datatable';
|
||||||
|
import { Column } from 'primereact/column';
|
||||||
|
import { Dropdown } from 'primereact/dropdown';
|
||||||
|
import { Tag } from 'primereact/tag';
|
||||||
|
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||||
|
import { Button } from 'primereact/button';
|
||||||
|
import translationStrings from '../../../../translationStringsForComponents';
|
||||||
|
|
||||||
|
|
||||||
|
const AllBandiPreferredAccordion = () => {
|
||||||
|
const chosenCompanyId = useStore().main.chosenCompanyId();
|
||||||
|
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||||
|
const [items, setItems] = useState(null);
|
||||||
|
const [filters, setFilters] = useState(null);
|
||||||
|
const [expandedRows, setExpandedRows] = useState(null);
|
||||||
|
const [statuses, setStatuses] = useState([]);
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
storeSet.main.setAsyncRequest();
|
||||||
|
const userData = storeGet.main.userData();
|
||||||
|
PreferredBandoService.getPreferredCalls(getCallback, errGetCallbacks, [
|
||||||
|
['companyId', chosenCompanyId],
|
||||||
|
['userId', userData.id]
|
||||||
|
]);
|
||||||
|
}, [chosenCompanyId]);
|
||||||
|
|
||||||
|
const getCallback = (data) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
setItems(getFormattedBandiData(data.data));
|
||||||
|
setStatuses(uniq(data.data.map(o => o.status)))
|
||||||
|
}
|
||||||
|
storeSet.main.unsetAsyncRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
const errGetCallbacks = (data) => {
|
||||||
|
set404FromErrorResponse(data);
|
||||||
|
storeSet.main.unsetAsyncRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
const getFormattedBandiData = (data) => {
|
||||||
|
return data.map((d) => {
|
||||||
|
d.dates = d.dates.map(v => is(String, v) ? new Date(v) : (v ? v : ''));
|
||||||
|
return d;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const nameBodyTemplate = (rowData) => {
|
||||||
|
return <span
|
||||||
|
className="appPageSection__titleClickable"
|
||||||
|
onClick={() => {
|
||||||
|
let newExpandedRows;
|
||||||
|
if (isNil(expandedRows) || isNil(expandedRows[rowData.id])) {
|
||||||
|
newExpandedRows = isNil(expandedRows)
|
||||||
|
? wrap({}).set([rowData.id], true).value()
|
||||||
|
: wrap(expandedRows).set([rowData.id], true).value();
|
||||||
|
} else {
|
||||||
|
newExpandedRows = wrap(expandedRows).del([rowData.id]).value();
|
||||||
|
}
|
||||||
|
setExpandedRows(newExpandedRows);
|
||||||
|
}}>{rowData.name}</span>
|
||||||
|
}
|
||||||
|
|
||||||
|
const amountBodyTemplate = (rowData) => {
|
||||||
|
return getNumberWithCurrency(rowData.amount);
|
||||||
|
};
|
||||||
|
|
||||||
|
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 addToFavourites = (id, preferredId) => {
|
||||||
|
const companyId = storeGet.main.chosenCompanyId()
|
||||||
|
const data = {
|
||||||
|
companyId,
|
||||||
|
callId: id
|
||||||
|
}
|
||||||
|
if (preferredId && preferredId !== 0) {
|
||||||
|
PreferredBandoService.deleteFromPreferred(preferredId, (data) => removeFavCallback(data, id), errToggleFavCallback);
|
||||||
|
} else {
|
||||||
|
PreferredBandoService.addToPreferred(data, addFavCallback, errToggleFavCallback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const removeFavCallback = (data, id) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
const newItems = items.map((o) => {
|
||||||
|
if (o.id === id) {
|
||||||
|
return {
|
||||||
|
...o,
|
||||||
|
preferredCallId: null
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setItems(newItems)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const addFavCallback = (data) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
const newItems = items.map((o) => {
|
||||||
|
if (o.id === data.data.callId) {
|
||||||
|
return {
|
||||||
|
...o,
|
||||||
|
preferredCallId: data.data.id
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setItems(newItems)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const errToggleFavCallback = (data) => {
|
||||||
|
set404FromErrorResponse(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
const goToBandoPage = (id) => {
|
||||||
|
navigate(`/bandi/${id}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
const actionsBodyTemplate = (rowData) => {
|
||||||
|
return <div className="appPageSection__tableActions">
|
||||||
|
<button type="button"
|
||||||
|
className="appPageSection__addToFavourites"
|
||||||
|
data-active={!isNil(rowData.preferredCallId)}
|
||||||
|
onClick={() => addToFavourites(rowData.id, rowData.preferredCallId)}>
|
||||||
|
<i className="pi pi-heart" style={{ fontSize: '1rem' }}></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
const rowExpansionTemplate = (data) => {
|
||||||
|
return (
|
||||||
|
<div className="p-3">
|
||||||
|
{renderHtmlContent(data.descriptionShort)}
|
||||||
|
<p>{__('Scadenza', 'gepafin')}: {getDateFromISOstring(data.dates[1])}</p>
|
||||||
|
{!isEmpty(chosenCompanyId) && chosenCompanyId !== 0 && !data.confidi
|
||||||
|
? <Button onClick={() => goToBandoPage(data.id)} severity="info">
|
||||||
|
{__('Partecipa', 'gepafin')}
|
||||||
|
</Button> : null}
|
||||||
|
{!isEmpty(chosenCompanyId) && chosenCompanyId !== 0 && data.confidi
|
||||||
|
? <Button onClick={() => goToBandoPage(data.id)} severity="info">
|
||||||
|
{__('Mostra', 'gepafin')}
|
||||||
|
</Button> : null}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const allowExpansion = (rowData) => {
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
return(
|
||||||
|
<div className="appPageSection__table">
|
||||||
|
<DataTable value={items}
|
||||||
|
paginator
|
||||||
|
rows={10}
|
||||||
|
loading={isAsyncRequest}
|
||||||
|
dataKey="id"
|
||||||
|
filters={filters}
|
||||||
|
emptyMessage={translationStrings.emptyMessage}
|
||||||
|
expandedRows={expandedRows}
|
||||||
|
onRowToggle={(e) => setExpandedRows(e.data)}
|
||||||
|
rowExpansionTemplate={rowExpansionTemplate}
|
||||||
|
onFilter={(e) => setFilters(e.filters)}>
|
||||||
|
<Column expander={allowExpansion} style={{ width: '5rem' }} />
|
||||||
|
<Column field="name" header={__('Bando', 'gepafin')}
|
||||||
|
body={nameBodyTemplate}
|
||||||
|
style={{ minWidth: '12rem' }}/>
|
||||||
|
<Column header={__('Importo totale', 'gepafin')} filterField="amount"
|
||||||
|
style={{ minWidth: '10rem' }} body={amountBodyTemplate} sortable/>
|
||||||
|
<Column field="status" header={__('Stato', 'gepafin')} filterMenuStyle={{ width: '14rem' }}
|
||||||
|
style={{ width: '8rem' }} body={statusBodyTemplate} filter sortable
|
||||||
|
filterElement={statusFilterTemplate}/>
|
||||||
|
{!isEmpty(chosenCompanyId) && chosenCompanyId !== 0
|
||||||
|
? <Column header={__('Azioni', 'gepafin')}
|
||||||
|
style={{ width: '8rem' }}
|
||||||
|
body={actionsBodyTemplate}/> : null}
|
||||||
|
</DataTable>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AllBandiPreferredAccordion;
|
||||||
43
src/pages/BandiPreferredBeneficiario/index.js
Normal file
43
src/pages/BandiPreferredBeneficiario/index.js
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
import { isEmpty } from 'ramda';
|
||||||
|
|
||||||
|
// store
|
||||||
|
import { useStore } from '../../store';
|
||||||
|
|
||||||
|
// components
|
||||||
|
import AllBandiAccordion from '../BandiBeneficiario/components/AllBandiAccordion';
|
||||||
|
|
||||||
|
const BandiPreferredBeneficiario = () => {
|
||||||
|
const chosenCompanyId = useStore().main.chosenCompanyId();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="appPage">
|
||||||
|
<div className="appPage__pageHeader">
|
||||||
|
<h1>{__('Bandi osservati', 'gepafin')}</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="appPage__spacer"></div>
|
||||||
|
|
||||||
|
{isEmpty(chosenCompanyId) || chosenCompanyId === 0
|
||||||
|
? <>
|
||||||
|
<div className="appPageSection__message warning">
|
||||||
|
<i className="pi pi-exclamation-triangle"></i>
|
||||||
|
<span className="summary">{__('Attenzione', 'gepafin')}</span>
|
||||||
|
<span>
|
||||||
|
{__('Per applicare ai bandi devi Registare un Azienda clicca', 'gepafin')}
|
||||||
|
<Link to={`/agguingi-azienda`} style={{marginLeft: '0.5ch'}}>{__('qua', 'gepafin')}</Link>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div className="appPage__spacer"></div>
|
||||||
|
</> : null}
|
||||||
|
|
||||||
|
<div className="appPageSection">
|
||||||
|
<AllBandiAccordion showOnlyPreferred={true}/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default BandiPreferredBeneficiario;
|
||||||
@@ -284,7 +284,7 @@ const BandoEditFormStep2 = forwardRef(function ({ initialData, setInitialData, g
|
|||||||
options={checklistOptions}
|
options={checklistOptions}
|
||||||
errors={errors}
|
errors={errors}
|
||||||
register={register}
|
register={register}
|
||||||
label={<>{__('Checklist valutazione Pre-Istruttoria', 'gepafin')}*
|
label={<>{__('Checklist valutazione Istruttoria', 'gepafin')}*
|
||||||
<span>{__('(almeno 1 elemento)', 'gepafin')}</span></>}
|
<span>{__('(almeno 1 elemento)', 'gepafin')}</span></>}
|
||||||
config={{
|
config={{
|
||||||
validate: {
|
validate: {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import { Button } from 'primereact/button';
|
|||||||
import { Tag } from 'primereact/tag';
|
import { Tag } from 'primereact/tag';
|
||||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
import translationStrings from '../../../../translationStringsForComponents';
|
||||||
|
|
||||||
const DraftApplicationsTable = () => {
|
const DraftApplicationsTable = () => {
|
||||||
const chosenCompanyId = useStore().main.chosenCompanyId();
|
const chosenCompanyId = useStore().main.chosenCompanyId();
|
||||||
@@ -142,7 +143,7 @@ const DraftApplicationsTable = () => {
|
|||||||
const statusFilterTemplate = (options) => {
|
const statusFilterTemplate = (options) => {
|
||||||
return <Dropdown value={options.value} options={statuses}
|
return <Dropdown value={options.value} options={statuses}
|
||||||
onChange={(e) => options.filterCallback(e.value, options.index)}
|
onChange={(e) => options.filterCallback(e.value, options.index)}
|
||||||
itemTemplate={statusItemTemplate} placeholder="Select One" className="p-column-filter"
|
itemTemplate={statusItemTemplate} placeholder={translationStrings.selectOneLabel} className="p-column-filter"
|
||||||
showClear/>;
|
showClear/>;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -169,12 +170,18 @@ const DraftApplicationsTable = () => {
|
|||||||
filters={filters}
|
filters={filters}
|
||||||
globalFilterFields={['name', 'status']}
|
globalFilterFields={['name', 'status']}
|
||||||
header={header}
|
header={header}
|
||||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
emptyMessage={translationStrings.emptyMessage}
|
||||||
onFilter={(e) => setFilters(e.filters)}>
|
onFilter={(e) => setFilters(e.filters)}>
|
||||||
<Column field="id" header={__('ID domanda', 'gepafin')}
|
<Column field="id" header={__('ID domanda', 'gepafin')}
|
||||||
filter filterPlaceholder={__('Cerca', 'gepafin')}
|
sortable
|
||||||
|
filterPlaceholder={__('Cerca', 'gepafin')}
|
||||||
style={{ minWidth: '8rem' }}/>
|
style={{ minWidth: '8rem' }}/>
|
||||||
<Column field="callTitle" header={__('Bando', 'gepafin')} filter
|
<Column field="callTitle" header={__('Bando', 'gepafin')}
|
||||||
|
filter sortable
|
||||||
|
filterPlaceholder={__('Cerca il nome', 'gepafin')}
|
||||||
|
style={{ minWidth: '8rem' }}/>
|
||||||
|
<Column field="companyName" header={__('Azienda', 'gepafin')}
|
||||||
|
filter sortable
|
||||||
filterPlaceholder={__('Cerca il nome', 'gepafin')}
|
filterPlaceholder={__('Cerca il nome', 'gepafin')}
|
||||||
style={{ minWidth: '8rem' }}/>
|
style={{ minWidth: '8rem' }}/>
|
||||||
{/*<Column header={__('Scadenza', 'gepafin')} filterField="callEndDate" dataType="date"
|
{/*<Column header={__('Scadenza', 'gepafin')} filterField="callEndDate" dataType="date"
|
||||||
@@ -184,7 +191,8 @@ const DraftApplicationsTable = () => {
|
|||||||
style={{ minWidth: '8rem' }}
|
style={{ minWidth: '8rem' }}
|
||||||
body={dateModifyBodyTemplate} filter filterElement={dateFilterTemplate}/>*/}
|
body={dateModifyBodyTemplate} filter filterElement={dateFilterTemplate}/>*/}
|
||||||
<Column field="status" header={__('Stato', 'gepafin')} filterMenuStyle={{ width: '14rem' }}
|
<Column field="status" header={__('Stato', 'gepafin')} filterMenuStyle={{ width: '14rem' }}
|
||||||
style={{ minWidth: '7rem' }} body={statusBodyTemplate} filter
|
style={{ minWidth: '7rem' }} body={statusBodyTemplate}
|
||||||
|
filter
|
||||||
filterElement={statusFilterTemplate}/>
|
filterElement={statusFilterTemplate}/>
|
||||||
<Column header={__('Progressi', 'gepafin')}
|
<Column header={__('Progressi', 'gepafin')}
|
||||||
style={{ minWidth: '10rem' }} field="progress" body={progressBodyTemplate}/>
|
style={{ minWidth: '10rem' }} field="progress" body={progressBodyTemplate}/>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import { Button } from 'primereact/button';
|
|||||||
import { Calendar } from 'primereact/calendar';
|
import { Calendar } from 'primereact/calendar';
|
||||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
import translationStrings from '../../../../translationStringsForComponents';
|
||||||
|
|
||||||
|
|
||||||
const LatestBandiTable = () => {
|
const LatestBandiTable = () => {
|
||||||
@@ -23,7 +24,7 @@ const LatestBandiTable = () => {
|
|||||||
const [filters, setFilters] = useState(null);
|
const [filters, setFilters] = useState(null);
|
||||||
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
||||||
const [globalFilterValue, setGlobalFilterValue] = useState('');
|
const [globalFilterValue, setGlobalFilterValue] = useState('');
|
||||||
const [statuses, setStatuses] = useState([]);
|
const [, setStatuses] = useState([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setLocalAsyncRequest(true);
|
setLocalAsyncRequest(true);
|
||||||
@@ -128,7 +129,7 @@ const LatestBandiTable = () => {
|
|||||||
filters={filters}
|
filters={filters}
|
||||||
globalFilterFields={['name', 'status']}
|
globalFilterFields={['name', 'status']}
|
||||||
header={header}
|
header={header}
|
||||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
emptyMessage={translationStrings.emptyMessage}
|
||||||
onFilter={(e) => setFilters(e.filters)}>
|
onFilter={(e) => setFilters(e.filters)}>
|
||||||
<Column field="name" header={__('Nome Bando', 'gepafin')} filter filterPlaceholder={__('Cerca il nome', 'gepafin')}
|
<Column field="name" header={__('Nome Bando', 'gepafin')} filter filterPlaceholder={__('Cerca il nome', 'gepafin')}
|
||||||
style={{ minWidth: '8rem' }}/>
|
style={{ minWidth: '8rem' }}/>
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ const LatestUsersActivityTable = () => {
|
|||||||
filters={filters}
|
filters={filters}
|
||||||
globalFilterFields={['name', 'status']}
|
globalFilterFields={['name', 'status']}
|
||||||
header={header}
|
header={header}
|
||||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
emptyMessage={translationStrings.emptyMessage}{__('Nessun dato disponibile', 'gepafin')}
|
||||||
onFilter={(e) => setFilters(e.filters)}>
|
onFilter={(e) => setFilters(e.filters)}>
|
||||||
<Column header={__('Timestamp', 'gepafin')} filterField="date" dataType="date"
|
<Column header={__('Timestamp', 'gepafin')} filterField="date" dataType="date"
|
||||||
style={{ minWidth: '8rem' }}
|
style={{ minWidth: '8rem' }}
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ import { storeGet, useStore } from '../../../../store';
|
|||||||
|
|
||||||
// api
|
// api
|
||||||
import BandoService from '../../../../service/bando-service';
|
import BandoService from '../../../../service/bando-service';
|
||||||
|
import PreferredBandoService from '../../../../service/preferred-bando-service';
|
||||||
|
|
||||||
|
// tools
|
||||||
|
import set404FromErrorResponse from '../../../../helpers/set404FromErrorResponse';
|
||||||
|
|
||||||
// components
|
// components
|
||||||
import { FilterMatchMode, FilterOperator } from 'primereact/api';
|
import { FilterMatchMode, FilterOperator } from 'primereact/api';
|
||||||
@@ -19,8 +23,8 @@ import { InputIcon } from 'primereact/inputicon';
|
|||||||
import { Button } from 'primereact/button';
|
import { Button } from 'primereact/button';
|
||||||
import { Calendar } from 'primereact/calendar';
|
import { Calendar } from 'primereact/calendar';
|
||||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||||
import PreferredBandoService from '../../../../service/preferred-bando-service';
|
|
||||||
import set404FromErrorResponse from '../../../../helpers/set404FromErrorResponse';
|
import translationStrings from '../../../../translationStringsForComponents';
|
||||||
|
|
||||||
|
|
||||||
const LatestBandiTable = () => {
|
const LatestBandiTable = () => {
|
||||||
@@ -29,7 +33,7 @@ const LatestBandiTable = () => {
|
|||||||
const [filters, setFilters] = useState(null);
|
const [filters, setFilters] = useState(null);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [globalFilterValue, setGlobalFilterValue] = useState('');
|
const [globalFilterValue, setGlobalFilterValue] = useState('');
|
||||||
const [statuses, setStatuses] = useState([]);
|
const [, setStatuses] = useState([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
@@ -209,7 +213,7 @@ const LatestBandiTable = () => {
|
|||||||
filters={filters}
|
filters={filters}
|
||||||
globalFilterFields={['name', 'status']}
|
globalFilterFields={['name', 'status']}
|
||||||
header={header}
|
header={header}
|
||||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
emptyMessage={translationStrings.emptyMessage}
|
||||||
onFilter={(e) => setFilters(e.filters)}>
|
onFilter={(e) => setFilters(e.filters)}>
|
||||||
<Column field="name" header={__('Nome Bando', 'gepafin')} filter
|
<Column field="name" header={__('Nome Bando', 'gepafin')} filter
|
||||||
filterPlaceholder={__('Cerca il nome', 'gepafin')}
|
filterPlaceholder={__('Cerca il nome', 'gepafin')}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import { Calendar } from 'primereact/calendar';
|
|||||||
import { Tag } from 'primereact/tag';
|
import { Tag } from 'primereact/tag';
|
||||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
import translationStrings from '../../../../translationStringsForComponents';
|
||||||
|
|
||||||
const MyLatestSubmissionsTable = () => {
|
const MyLatestSubmissionsTable = () => {
|
||||||
const chosenCompanyId = useStore().main.chosenCompanyId();
|
const chosenCompanyId = useStore().main.chosenCompanyId();
|
||||||
@@ -145,7 +146,7 @@ const MyLatestSubmissionsTable = () => {
|
|||||||
const statusFilterTemplate = (options) => {
|
const statusFilterTemplate = (options) => {
|
||||||
return <Dropdown value={options.value} options={statuses}
|
return <Dropdown value={options.value} options={statuses}
|
||||||
onChange={(e) => options.filterCallback(e.value, options.index)}
|
onChange={(e) => options.filterCallback(e.value, options.index)}
|
||||||
itemTemplate={statusItemTemplate} placeholder="Select One" className="p-column-filter"
|
itemTemplate={statusItemTemplate} placeholder={translationStrings.selectOneLabel} className="p-column-filter"
|
||||||
showClear/>;
|
showClear/>;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -175,18 +176,28 @@ const MyLatestSubmissionsTable = () => {
|
|||||||
filters={filters}
|
filters={filters}
|
||||||
globalFilterFields={['name', 'status']}
|
globalFilterFields={['name', 'status']}
|
||||||
header={header}
|
header={header}
|
||||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
emptyMessage={translationStrings.emptyMessage}
|
||||||
onFilter={(e) => setFilters(e.filters)}>
|
onFilter={(e) => setFilters(e.filters)}>
|
||||||
<Column field="callTitle" header={__('Bando', 'gepafin')} filter filterPlaceholder={__('Cerca il nome', 'gepafin')}
|
<Column field="callTitle" header={__('Bando', 'gepafin')}
|
||||||
|
sortable
|
||||||
|
filterPlaceholder={__('Cerca il nome', 'gepafin')}
|
||||||
|
style={{ minWidth: '8rem' }}/>
|
||||||
|
<Column field="companyName" header={__('Azienda', 'gepafin')}
|
||||||
|
filter sortable
|
||||||
|
filterPlaceholder={__('Cerca il nome', 'gepafin')}
|
||||||
style={{ minWidth: '8rem' }}/>
|
style={{ minWidth: '8rem' }}/>
|
||||||
<Column header={__('Scadenza', 'gepafin')} filterField="callEndDate" dataType="date"
|
<Column header={__('Scadenza', 'gepafin')} filterField="callEndDate" dataType="date"
|
||||||
style={{ minWidth: '8rem' }}
|
style={{ minWidth: '8rem' }}
|
||||||
body={dateEndBodyTemplate} filter filterElement={dateFilterTemplate}/>
|
body={dateEndBodyTemplate}
|
||||||
|
filter
|
||||||
|
filterElement={dateFilterTemplate}/>
|
||||||
<Column header={__('Ultima modifica', 'gepafin')} filterField="modifiedDate" dataType="date"
|
<Column header={__('Ultima modifica', 'gepafin')} filterField="modifiedDate" dataType="date"
|
||||||
style={{ minWidth: '8rem' }}
|
style={{ minWidth: '8rem' }}
|
||||||
body={dateModifyBodyTemplate} filter filterElement={dateFilterTemplate}/>
|
body={dateModifyBodyTemplate}
|
||||||
|
filter
|
||||||
|
filterElement={dateFilterTemplate}/>
|
||||||
<Column field="status" header={__('Stato', 'gepafin')} filterMenuStyle={{ width: '14rem' }}
|
<Column field="status" header={__('Stato', 'gepafin')} filterMenuStyle={{ width: '14rem' }}
|
||||||
style={{ minWidth: '7rem' }} body={statusBodyTemplate} filter
|
style={{ minWidth: '7rem' }} body={statusBodyTemplate}
|
||||||
filterElement={statusFilterTemplate}/>
|
filterElement={statusFilterTemplate}/>
|
||||||
<Column header={__('Progressi', 'gepafin')}
|
<Column header={__('Progressi', 'gepafin')}
|
||||||
style={{ minWidth: '10rem' }} field="progress" body={progressBodyTemplate}/>
|
style={{ minWidth: '10rem' }} field="progress" body={progressBodyTemplate}/>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { __, sprintf } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
import { Link, useNavigate } from 'react-router-dom';
|
import { Link, useNavigate } from 'react-router-dom';
|
||||||
import { head, isEmpty, pathOr } from 'ramda';
|
import { head, isEmpty, pathOr } from 'ramda';
|
||||||
import NumberFlow from '@number-flow/react';
|
import NumberFlow from '@number-flow/react';
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ import { useStore } from '../../../../store';
|
|||||||
// api
|
// api
|
||||||
import AssignedApplicationService from '../../../../service/assigned-application-service';
|
import AssignedApplicationService from '../../../../service/assigned-application-service';
|
||||||
|
|
||||||
|
// tools
|
||||||
|
import getBandoLabel from '../../../../helpers/getBandoLabel';
|
||||||
|
import getBandoSeverity from '../../../../helpers/getBandoSeverity';
|
||||||
|
|
||||||
// components
|
// components
|
||||||
import { FilterMatchMode, FilterOperator } from 'primereact/api';
|
import { FilterMatchMode, FilterOperator } from 'primereact/api';
|
||||||
import { DataTable } from 'primereact/datatable';
|
import { DataTable } from 'primereact/datatable';
|
||||||
@@ -19,7 +23,10 @@ import { InputIcon } from 'primereact/inputicon';
|
|||||||
import { Button } from 'primereact/button';
|
import { Button } from 'primereact/button';
|
||||||
import { Calendar } from 'primereact/calendar';
|
import { Calendar } from 'primereact/calendar';
|
||||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||||
|
import { Dropdown } from 'primereact/dropdown';
|
||||||
|
import { Tag } from 'primereact/tag';
|
||||||
|
|
||||||
|
import translationStrings from '../../../../translationStringsForComponents';
|
||||||
|
|
||||||
const PreInstructorDomandeTable = () => {
|
const PreInstructorDomandeTable = () => {
|
||||||
const userData = useStore().main.userData();
|
const userData = useStore().main.userData();
|
||||||
@@ -126,6 +133,14 @@ const PreInstructorDomandeTable = () => {
|
|||||||
return <ProperBandoLabel status={rowData.status}/>;
|
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) => {
|
const actionsBodyTemplate = (rowData) => {
|
||||||
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={__('Valuta', 'gepafin')} icon="pi pi-eye" size="small" iconPos="right"/>
|
||||||
@@ -140,13 +155,18 @@ const PreInstructorDomandeTable = () => {
|
|||||||
filters={filters}
|
filters={filters}
|
||||||
globalFilterFields={['name', 'status']}
|
globalFilterFields={['name', 'status']}
|
||||||
header={header}
|
header={header}
|
||||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
emptyMessage={translationStrings.emptyMessage}
|
||||||
onFilter={(e) => setFilters(e.filters)}>
|
onFilter={(e) => setFilters(e.filters)}>
|
||||||
<Column field="applicationId" header={__('ID domanda', 'gepafin')}
|
<Column field="applicationId" header={__('ID domanda', 'gepafin')}
|
||||||
filter filterPlaceholder={__('Cerca', 'gepafin')}
|
sortable filterPlaceholder={__('Cerca', 'gepafin')}
|
||||||
style={{ minWidth: '6rem' }}/>
|
style={{ minWidth: '6rem' }}/>
|
||||||
<Column field="callName" header={__('Bando', 'gepafin')}
|
<Column field="callName" header={__('Bando', 'gepafin')}
|
||||||
filter filterPlaceholder={__('Cerca', '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' }}/>
|
style={{ minWidth: '8rem' }}/>
|
||||||
<Column header={__('Data ricezione', 'gepafin')} filterField="submissionDate" dataType="date"
|
<Column header={__('Data ricezione', 'gepafin')} filterField="submissionDate" dataType="date"
|
||||||
style={{ minWidth: '8rem' }}
|
style={{ minWidth: '8rem' }}
|
||||||
@@ -155,7 +175,8 @@ const PreInstructorDomandeTable = () => {
|
|||||||
style={{ minWidth: '8rem' }}
|
style={{ minWidth: '8rem' }}
|
||||||
body={dateEndBodyTemplate} filter filterElement={dateFilterTemplate}/>
|
body={dateEndBodyTemplate} filter filterElement={dateFilterTemplate}/>
|
||||||
<Column field="status" header={__('Stato', 'gepafin')}
|
<Column field="status" header={__('Stato', 'gepafin')}
|
||||||
style={{ minWidth: '7rem' }} body={statusBodyTemplate} />
|
style={{ minWidth: '7rem' }} body={statusBodyTemplate} filter
|
||||||
|
filterElement={statusFilterTemplate} />
|
||||||
<Column header={__('Azioni', 'gepafin')}
|
<Column header={__('Azioni', 'gepafin')}
|
||||||
body={actionsBodyTemplate}/>
|
body={actionsBodyTemplate}/>
|
||||||
</DataTable>
|
</DataTable>
|
||||||
|
|||||||
@@ -1,32 +1,30 @@
|
|||||||
import React, { useState, useEffect, useRef } from 'react';
|
import React, { useState, useEffect, useRef, useMemo } from 'react';
|
||||||
import { __, sprintf } from '@wordpress/i18n';
|
import { __, sprintf } from '@wordpress/i18n';
|
||||||
import { useNavigate, useParams } from 'react-router-dom';
|
import { useNavigate, useParams } from 'react-router-dom';
|
||||||
import { is, isEmpty, isNil } from 'ramda';
|
import { is, isEmpty } from 'ramda';
|
||||||
import { wrap } from 'object-path-immutable';
|
import { useForm } from 'react-hook-form';
|
||||||
|
import { klona } from 'klona';
|
||||||
|
|
||||||
// store
|
// store
|
||||||
import { storeSet, useStore } from '../../store';
|
import { storeSet, useStore } from '../../store';
|
||||||
|
|
||||||
// api
|
// api
|
||||||
import AmendmentsService from '../../service/amendments-service';
|
import AmendmentsService from '../../service/amendments-service';
|
||||||
import CommunicationService from '../../service/communication-service';
|
import ApplicationService from '../../service/application-service';
|
||||||
|
|
||||||
// tools
|
// tools
|
||||||
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
||||||
import getBandoLabel from '../../helpers/getBandoLabel';
|
import getBandoLabel from '../../helpers/getBandoLabel';
|
||||||
import getDateFromISOstring from '../../helpers/getDateFromISOstring';
|
import getDateFromISOstring from '../../helpers/getDateFromISOstring';
|
||||||
import renderHtmlContent from '../../helpers/renderHtmlContent';
|
import renderHtmlContent from '../../helpers/renderHtmlContent';
|
||||||
import uniqid from '../../helpers/uniqid';
|
|
||||||
|
|
||||||
// components
|
// components
|
||||||
import { Button } from 'primereact/button';
|
import { Button } from 'primereact/button';
|
||||||
import BlockingOverlay from '../../components/BlockingOverlay';
|
import BlockingOverlay from '../../components/BlockingOverlay';
|
||||||
import { Toast } from 'primereact/toast';
|
import { Toast } from 'primereact/toast';
|
||||||
import { classNames } from 'primereact/utils';
|
|
||||||
import { Dialog } from 'primereact/dialog';
|
import { Dialog } from 'primereact/dialog';
|
||||||
import { InputText } from 'primereact/inputtext';
|
import FormField from '../../components/FormField';
|
||||||
import { InputTextarea } from 'primereact/inputtextarea';
|
import SoccorsoComunications from '../SoccorsoEditPreInstructor/components/SoccorsoComunications';
|
||||||
import ApplicationService from '../../service/application-service';
|
|
||||||
|
|
||||||
const DomandaBeneficiario = () => {
|
const DomandaBeneficiario = () => {
|
||||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||||
@@ -34,12 +32,22 @@ const DomandaBeneficiario = () => {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [data, setData] = useState({});
|
const [data, setData] = useState({});
|
||||||
const [dataAppl, setDataAppl] = useState({});
|
const [dataAppl, setDataAppl] = useState({});
|
||||||
const [comms, setComms] = useState([]);
|
|
||||||
const [isVisibleNewCommDialog, setIsVisibleNewCommDialog] = useState(false);
|
|
||||||
const [newCommData, setNewCommData] = useState({});
|
|
||||||
const [isLoadingCommunication, setIsLoadingCommunication] = useState(false);
|
|
||||||
const [isVisibleEmailDialog, setIsVisibleEmailDialog] = useState(false);
|
const [isVisibleEmailDialog, setIsVisibleEmailDialog] = useState(false);
|
||||||
const toast = useRef(null);
|
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 goToArchivePage = () => {
|
const goToArchivePage = () => {
|
||||||
navigate(`/domande`);
|
navigate(`/domande`);
|
||||||
@@ -57,8 +65,15 @@ const DomandaBeneficiario = () => {
|
|||||||
const getCallback = (data) => {
|
const getCallback = (data) => {
|
||||||
if (data.status === 'SUCCESS') {
|
if (data.status === 'SUCCESS') {
|
||||||
if (data.data.length) {
|
if (data.data.length) {
|
||||||
setData(getFormattedData(data.data[0]));
|
const amendmentObj = data.data[0];
|
||||||
CommunicationService.getCommsByAmendmentId(data.data[0].id, getCommsCallback, errGetCommsCallback);
|
setData(getFormattedData(amendmentObj));
|
||||||
|
const formDataInitial = amendmentObj.applicationFormFields.reduce((acc, cur) => {
|
||||||
|
if (cur.fieldValue) {
|
||||||
|
acc[cur.fieldId] = cur.fieldValue;
|
||||||
|
}
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
setFormInitialData(formDataInitial);
|
||||||
storeSet.main.unsetAsyncRequest();
|
storeSet.main.unsetAsyncRequest();
|
||||||
} else {
|
} else {
|
||||||
ApplicationService.getApplication(id, getApplCallback, errGetCallback)
|
ApplicationService.getApplication(id, getApplCallback, errGetCallback)
|
||||||
@@ -85,25 +100,6 @@ const DomandaBeneficiario = () => {
|
|||||||
storeSet.main.unsetAsyncRequest();
|
storeSet.main.unsetAsyncRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
const getCommsCallback = (data) => {
|
|
||||||
if (data.status === 'SUCCESS') {
|
|
||||||
setComms(data.data.commentsList.map(o => getFormattedCommsData(o)));
|
|
||||||
}
|
|
||||||
storeSet.main.unsetAsyncRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
const errGetCommsCallback = (data) => {
|
|
||||||
if (toast.current && data.message) {
|
|
||||||
toast.current.show({
|
|
||||||
severity: 'error',
|
|
||||||
summary: '',
|
|
||||||
detail: data.message
|
|
||||||
});
|
|
||||||
}
|
|
||||||
set404FromErrorResponse(data);
|
|
||||||
storeSet.main.unsetAsyncRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
const getFormattedData = (data) => {
|
const getFormattedData = (data) => {
|
||||||
data.submissionDate = is(String, data.submissionDate) ? new Date(data.submissionDate) : (data.submissionDate ? data.submissionDate : '');
|
data.submissionDate = is(String, data.submissionDate) ? new Date(data.submissionDate) : (data.submissionDate ? data.submissionDate : '');
|
||||||
data.startDate = is(String, data.startDate) ? new Date(data.startDate) : (data.startDate ? data.startDate : '');
|
data.startDate = is(String, data.startDate) ? new Date(data.startDate) : (data.startDate ? data.startDate : '');
|
||||||
@@ -111,55 +107,36 @@ const DomandaBeneficiario = () => {
|
|||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getFormattedCommsData = (data) => {
|
const onSubmit = () => {
|
||||||
data.id = isNil(data.id) ? uniqid('id') : data.id;
|
|
||||||
data.commentedDate = is(String, data.commentedDate) ? new Date(data.commentedDate) : (data.commentedDate ? data.commentedDate : '');
|
|
||||||
data.createdDate = is(String, data.createdDate) ? new Date(data.createdDate) : (data.createdDate ? data.createdDate : '');
|
|
||||||
data.updatedDate = is(String, data.updatedDate) ? new Date(data.updatedDate) : (data.updatedDate ? data.updatedDate : '');
|
|
||||||
return data;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const headerNewComDialog = () => {
|
const doUpdateAmendment = () => {
|
||||||
return <span>{__('Aggiungi comunicazione', 'gepafin')}</span>
|
trigger();
|
||||||
|
let formValues = klona(getValues());
|
||||||
|
const newFormValues = Object.keys(formValues)
|
||||||
|
.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 submitData = {
|
||||||
|
applicationFormFields: newFormValues,
|
||||||
|
}
|
||||||
|
const amendmentId = data.id;
|
||||||
|
|
||||||
|
storeSet.main.setAsyncRequest();
|
||||||
|
AmendmentsService.updateSoccorso(amendmentId, submitData, updateAmendmentCallback, errUpdateAmendmentCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
const hideNewComDialog = () => {
|
const updateAmendmentCallback = (data) => {
|
||||||
setIsVisibleNewCommDialog(false);
|
|
||||||
setNewCommData({
|
|
||||||
title: '',
|
|
||||||
comment: ''
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const footerNewComDialog = () => {
|
|
||||||
return <div>
|
|
||||||
<Button type="button" label={__('Anulla', 'gepafin')} onClick={hideNewComDialog} outlined/>
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
disabled={isLoadingCommunication || isEmpty(newCommData.title) || isEmpty(newCommData.comment)}
|
|
||||||
label={__('Invia', 'gepafin')} onClick={createCommunication}/>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
const openNewCommDialog = () => {
|
|
||||||
setIsVisibleNewCommDialog(true);
|
|
||||||
setNewCommData({
|
|
||||||
title: '',
|
|
||||||
comment: ''
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const updateNewCommData = (value, path) => {
|
|
||||||
const newData = wrap(newCommData).set(path.split('.'), value).value();
|
|
||||||
setNewCommData(newData);
|
|
||||||
}
|
|
||||||
|
|
||||||
const createCommunication = () => {
|
|
||||||
setIsLoadingCommunication(true);
|
|
||||||
CommunicationService.createCommunication(data.id, newCommData, createCommunicationCallback, errCreateCommunicationCallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
const createCommunicationCallback = (data) => {
|
|
||||||
if (data.status === 'SUCCESS') {
|
if (data.status === 'SUCCESS') {
|
||||||
if (toast.current) {
|
if (toast.current) {
|
||||||
toast.current.show({
|
toast.current.show({
|
||||||
@@ -168,13 +145,18 @@ const DomandaBeneficiario = () => {
|
|||||||
detail: data.message
|
detail: data.message
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setComms([...comms, getFormattedCommsData(data.data)])
|
const newFormDataInitial = data.data.applicationFormFields.reduce((acc, cur) => {
|
||||||
setIsVisibleNewCommDialog(false);
|
if (cur.fieldValue) {
|
||||||
|
acc[cur.fieldId] = cur.fieldValue;
|
||||||
|
}
|
||||||
|
return acc;
|
||||||
|
}, formInitialData);
|
||||||
|
setFormInitialData(newFormDataInitial);
|
||||||
}
|
}
|
||||||
setIsLoadingCommunication(false);
|
storeSet.main.unsetAsyncRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
const errCreateCommunicationCallback = (data) => {
|
const errUpdateAmendmentCallback = (data) => {
|
||||||
if (toast.current && data.message) {
|
if (toast.current && data.message) {
|
||||||
toast.current.show({
|
toast.current.show({
|
||||||
severity: 'error',
|
severity: 'error',
|
||||||
@@ -182,10 +164,18 @@ const DomandaBeneficiario = () => {
|
|||||||
detail: data.message
|
detail: data.message
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
set404FromErrorResponse(data);
|
//set404FromErrorResponse(data);
|
||||||
setIsLoadingCommunication(false);
|
storeSet.main.unsetAsyncRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (formInitialData) {
|
||||||
|
//reset();
|
||||||
|
Object.keys(formInitialData).map(k => setValue(k, formInitialData[k]));
|
||||||
|
trigger();
|
||||||
|
}
|
||||||
|
}, [formInitialData]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="appPage">
|
<div className="appPage">
|
||||||
<div className="appPage__pageHeader">
|
<div className="appPage__pageHeader">
|
||||||
@@ -272,61 +262,51 @@ const DomandaBeneficiario = () => {
|
|||||||
|
|
||||||
{data.id
|
{data.id
|
||||||
? <div className="appPageSection">
|
? <div className="appPageSection">
|
||||||
<h2>{__('Dettagli Richiesta', 'gepafin')}</h2>
|
<h2>{__('Dettagli Richiesta', 'gepafin')}</h2>
|
||||||
<h3>{__('Documenti Richiesti', 'gepafin')}</h3>
|
<h3>{__('Note e spiegazioni', 'gepafin')}</h3>
|
||||||
<ol className="appPageSection__list">
|
<div className="appPageSection__withBorder grey ql-editor"
|
||||||
|
style={{ minHeight: '100px' }}>
|
||||||
|
{renderHtmlContent(data.note)}
|
||||||
|
</div>
|
||||||
|
</div> : null}
|
||||||
|
|
||||||
|
{data.id
|
||||||
|
? <div className="appPageSection">
|
||||||
|
<h3>{__('Documenti Richiesti', 'gepafin')}</h3>
|
||||||
|
<form className="appForm" onSubmit={handleSubmit(onSubmit)}>
|
||||||
|
{data.formFields
|
||||||
|
? data.formFields.map((o, i) => {
|
||||||
|
return <FormField
|
||||||
|
key={o.fieldId}
|
||||||
|
disabled={data.status === 'CLOSE'}
|
||||||
|
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={[]}
|
||||||
|
sourceId={data.applicationId}
|
||||||
|
multiple={true}
|
||||||
|
/>
|
||||||
|
}) : null}
|
||||||
|
</form>
|
||||||
|
{/*<ol className="appPageSection__list">
|
||||||
{data.formFields
|
{data.formFields
|
||||||
? data.formFields.map((o, i) => <li key={o.fieldId}
|
? data.formFields.map((o, i) => <li key={o.fieldId}
|
||||||
style={{ flexDirection: 'row' }}>
|
style={{ flexDirection: 'row' }}>
|
||||||
<span>{o.label}</span>
|
<span>{o.label}</span>
|
||||||
</li>) : null}
|
</li>) : null}
|
||||||
</ol>
|
</ol>*/}
|
||||||
</div> : null}
|
</div> : null}
|
||||||
|
|
||||||
{data.id
|
{data.id
|
||||||
? <div className="appPageSection">
|
? <div className="appPageSection">
|
||||||
<h3>{__('Note e spiegazioni', 'gepafin')}</h3>
|
<h2>{__('Comunicazioni', 'gepafin')}</h2>
|
||||||
<div className="appPageSection__withBorder grey ql-editor"
|
<SoccorsoComunications amendmentId={data.id} soccorsoStatus={data.status}/>
|
||||||
style={{ minHeight: '200px' }}>
|
|
||||||
{renderHtmlContent(data.note)}
|
|
||||||
</div>
|
|
||||||
</div> : null}
|
|
||||||
|
|
||||||
{data.id
|
|
||||||
? <div className="appPageSection">
|
|
||||||
<h2>{__('Comunicazioni', 'gepafin')}</h2>
|
|
||||||
<table className="myTable">
|
|
||||||
<thead className="myThead">
|
|
||||||
<tr>
|
|
||||||
<th style={{ width: 250 }}>{__('Data', 'gepafin')}</th>
|
|
||||||
<th>{__('Comunicazione', 'gepafin')}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody className="myTbody">
|
|
||||||
{!isNil(comms) && !isEmpty(comms)
|
|
||||||
? comms.map((o, i) => <tr key={o.id}>
|
|
||||||
<td valign="top">
|
|
||||||
{getDateFromISOstring(o.commentedDate)}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<h3>{o.title}</h3>
|
|
||||||
<p>{o.comment}</p>
|
|
||||||
</td>
|
|
||||||
</tr>)
|
|
||||||
: <tr>
|
|
||||||
<td>-</td>
|
|
||||||
<td>-</td>
|
|
||||||
</tr>}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
style={{ marginTop: 30 }}
|
|
||||||
onClick={openNewCommDialog}
|
|
||||||
disabled={data.status === 'CLOSE'}
|
|
||||||
type="button"
|
|
||||||
label={__('Aggiungi Comunicazione', 'gepafin')}
|
|
||||||
icon="pi pi-plus" iconPos="right"/>
|
|
||||||
</div> : null}
|
</div> : null}
|
||||||
|
|
||||||
{data.id
|
{data.id
|
||||||
@@ -354,40 +334,8 @@ const DomandaBeneficiario = () => {
|
|||||||
icon="pi pi-times" iconPos="right"/>
|
icon="pi pi-times" iconPos="right"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Dialog
|
|
||||||
visible={isVisibleNewCommDialog}
|
|
||||||
modal
|
|
||||||
header={headerNewComDialog}
|
|
||||||
footer={footerNewComDialog}
|
|
||||||
style={{ maxWidth: '600px', width: '100%' }}
|
|
||||||
onHide={hideNewComDialog}>
|
|
||||||
<div className="appForm__field">
|
|
||||||
<label
|
|
||||||
className={classNames({ 'p-error': isEmpty(newCommData.title) })}>
|
|
||||||
{__('Titolo', 'gepafin')}*
|
|
||||||
</label>
|
|
||||||
<InputText value={newCommData.title}
|
|
||||||
disabled={data.status === 'CLOSE'}
|
|
||||||
invalid={isEmpty(newCommData.title)}
|
|
||||||
onChange={(e) => updateNewCommData(e.target.value, 'title')}/>
|
|
||||||
|
|
||||||
<label
|
|
||||||
className={classNames({ 'p-error': isEmpty(newCommData.comment) })}>
|
|
||||||
{__('Contenuto', 'gepafin')}*
|
|
||||||
</label>
|
|
||||||
<InputTextarea
|
|
||||||
value={newCommData.comment}
|
|
||||||
disabled={data.status === 'CLOSE'}
|
|
||||||
rows={5} cols={30}
|
|
||||||
invalid={isEmpty(newCommData.comment)}
|
|
||||||
onChange={(e) => updateNewCommData(e.target.value, 'comment')}/>
|
|
||||||
</div>
|
|
||||||
</Dialog>
|
|
||||||
|
|
||||||
<Dialog
|
<Dialog
|
||||||
header={__('Invia documenti via PEC', 'gepafin')}
|
header={__('Invia documenti via PEC', 'gepafin')}
|
||||||
visible={isVisibleEmailDialog}
|
visible={isVisibleEmailDialog}
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ import { Toast } from 'primereact/toast';
|
|||||||
import HelpIcon from '../../icons/HelpIcon';
|
import HelpIcon from '../../icons/HelpIcon';
|
||||||
import { Dialog } from 'primereact/dialog';
|
import { Dialog } from 'primereact/dialog';
|
||||||
|
|
||||||
|
const APP_EVALUATION_FLOW_ID = process.env.REACT_APP_EVALUATION_FLOW_ID;
|
||||||
|
|
||||||
const DomandaEditPreInstructor = () => {
|
const DomandaEditPreInstructor = () => {
|
||||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
@@ -40,6 +42,10 @@ const DomandaEditPreInstructor = () => {
|
|||||||
const [isAdmissible, setIsAdmissible] = useState(false);
|
const [isAdmissible, setIsAdmissible] = useState(false);
|
||||||
const [connectedSoccorsoId, setConnectedSoccorsoId] = useState(0);
|
const [connectedSoccorsoId, setConnectedSoccorsoId] = useState(0);
|
||||||
const toast = useRef(null);
|
const toast = useRef(null);
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
const [isVisibleCompleteDialog, setIsVisibleCompleteDialog] = useState(false);
|
||||||
|
const [operationType, setOperationType] = useState('');
|
||||||
|
const [motivation, setMotivation] = useState('');
|
||||||
|
|
||||||
const goToEvaluationsPage = () => {
|
const goToEvaluationsPage = () => {
|
||||||
navigate('/domande');
|
navigate('/domande');
|
||||||
@@ -47,16 +53,16 @@ const DomandaEditPreInstructor = () => {
|
|||||||
|
|
||||||
const doNewSoccorso = () => {
|
const doNewSoccorso = () => {
|
||||||
if (connectedSoccorsoId !== 0) {
|
if (connectedSoccorsoId !== 0) {
|
||||||
navigate(`/domande/${id}/soccorso/${connectedSoccorsoId}`);
|
doSaveDraft(`/domande/${id}/soccorso/${connectedSoccorsoId}`)
|
||||||
} else {
|
} else {
|
||||||
|
doSaveDraft(`/domande/${id}/aggiungi-soccorso/`)
|
||||||
navigate(`/domande/${id}/aggiungi-soccorso/`);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getCallback = (data) => {
|
const getCallback = (data) => {
|
||||||
if (data.status === 'SUCCESS') {
|
if (data.status === 'SUCCESS') {
|
||||||
setData(getFormattedData(data.data));
|
setData(getFormattedData(data.data));
|
||||||
|
setMotivation(data.data.motivation);
|
||||||
}
|
}
|
||||||
storeSet.main.unsetAsyncRequest();
|
storeSet.main.unsetAsyncRequest();
|
||||||
}
|
}
|
||||||
@@ -102,7 +108,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
const updateEvaluationValue = (value, path, maxValue) => {
|
const updateEvaluationValue = (value, path, maxValue) => {
|
||||||
let finalValue = value;
|
let finalValue = value;
|
||||||
|
|
||||||
if (maxValue) {
|
if (maxValue || maxValue === 0) {
|
||||||
finalValue = value > maxValue ? maxValue : value;
|
finalValue = value > maxValue ? maxValue : value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,17 +116,22 @@ const DomandaEditPreInstructor = () => {
|
|||||||
setData(newData);
|
setData(newData);
|
||||||
}
|
}
|
||||||
|
|
||||||
const doSaveDraft = () => {
|
const doSaveDraft = (doRedirect = '') => {
|
||||||
const formData = {
|
const formData = {
|
||||||
criteria: klona(data.criteria),
|
criteria: klona(data.criteria),
|
||||||
checklist: klona(data.checklist),
|
checklist: klona(data.checklist),
|
||||||
files: klona(data.files),
|
files: klona(data.files),
|
||||||
note: data.note
|
note: data.note
|
||||||
}
|
}
|
||||||
ApplicationEvaluationService.updateEvaluation(data.assignedApplicationId, formData, updateCallback, errUpdateCallback);
|
ApplicationEvaluationService.updateEvaluation(
|
||||||
|
data.assignedApplicationId,
|
||||||
|
formData,
|
||||||
|
(data) => updateCallback(data, doRedirect),
|
||||||
|
errUpdateCallback
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateCallback = (data) => {
|
const updateCallback = (data, doRedirect = '') => {
|
||||||
if (data.status === 'SUCCESS') {
|
if (data.status === 'SUCCESS') {
|
||||||
setData(getFormattedData(data.data));
|
setData(getFormattedData(data.data));
|
||||||
if (toast.current) {
|
if (toast.current) {
|
||||||
@@ -130,6 +141,9 @@ const DomandaEditPreInstructor = () => {
|
|||||||
detail: data.message
|
detail: data.message
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (!isEmpty(doRedirect)) {
|
||||||
|
navigate(doRedirect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
storeSet.main.unsetAsyncRequest();
|
storeSet.main.unsetAsyncRequest();
|
||||||
}
|
}
|
||||||
@@ -152,8 +166,10 @@ const DomandaEditPreInstructor = () => {
|
|||||||
criteria: klona(data.criteria),
|
criteria: klona(data.criteria),
|
||||||
checklist: klona(data.checklist),
|
checklist: klona(data.checklist),
|
||||||
files: klona(data.files),
|
files: klona(data.files),
|
||||||
note: data.note
|
note: data.note,
|
||||||
|
motivation
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplicationEvaluationService.updateEvaluation(data.assignedApplicationId, formData, updateStatusCallback, errUpdateStatusCallback);
|
ApplicationEvaluationService.updateEvaluation(data.assignedApplicationId, formData, updateStatusCallback, errUpdateStatusCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,8 +179,10 @@ const DomandaEditPreInstructor = () => {
|
|||||||
criteria: klona(data.criteria),
|
criteria: klona(data.criteria),
|
||||||
checklist: klona(data.checklist),
|
checklist: klona(data.checklist),
|
||||||
files: klona(data.files),
|
files: klona(data.files),
|
||||||
note: data.note
|
note: data.note,
|
||||||
|
motivation
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplicationEvaluationService.updateEvaluation(data.assignedApplicationId, formData, updateStatusCallback, errUpdateStatusCallback);
|
ApplicationEvaluationService.updateEvaluation(data.assignedApplicationId, formData, updateStatusCallback, errUpdateStatusCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,6 +274,60 @@ const DomandaEditPreInstructor = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const errGetAmendmentsCallback = () => {
|
const errGetAmendmentsCallback = () => {
|
||||||
|
if (toast.current && data.message) {
|
||||||
|
toast.current.show({
|
||||||
|
severity: 'error',
|
||||||
|
summary: '',
|
||||||
|
detail: data.message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
set404FromErrorResponse(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
const shouldDisableField = (fieldName) => {
|
||||||
|
return !['EVALUATION'].includes(data.applicationStatus)
|
||||||
|
|| (['ADMISSIBLE'].includes(data.applicationStatus) && fieldName !== 'criteria')
|
||||||
|
}
|
||||||
|
|
||||||
|
const headerCompleteDialog = () => {
|
||||||
|
return 'approve' === operationType
|
||||||
|
? <span>{__('Confermare l\'approvazione', 'gepafin')}</span>
|
||||||
|
: <span>{__('Confermare il rifiuto', 'gepafin')}</span>;
|
||||||
|
}
|
||||||
|
|
||||||
|
const hideCompleteDialog = () => {
|
||||||
|
setIsVisibleCompleteDialog(false);
|
||||||
|
setOperationType('');
|
||||||
|
setMotivation('');
|
||||||
|
}
|
||||||
|
|
||||||
|
const footerCompleteDialog = () => {
|
||||||
|
return <div>
|
||||||
|
<Button type="button" label={__('Anulla', 'gepafin')} onClick={hideCompleteDialog} outlined/>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
disabled={loading}
|
||||||
|
label={__('Invia', 'gepafin')} onClick={'approve' === operationType ? doApprove : doReject}/>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
const initiateApproving = () => {
|
||||||
|
setOperationType('approve');
|
||||||
|
setIsVisibleCompleteDialog(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const initiateRejecting = () => {
|
||||||
|
setOperationType('reject');
|
||||||
|
setIsVisibleCompleteDialog(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
const doCreateAppointment = () => {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
const doMakeAdmisible = () => {
|
||||||
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -325,13 +397,11 @@ const DomandaEditPreInstructor = () => {
|
|||||||
</p>
|
</p>
|
||||||
<p className="appPageSection__pMeta">
|
<p className="appPageSection__pMeta">
|
||||||
<span>{__('Stato', 'gepafin')}</span>
|
<span>{__('Stato', 'gepafin')}</span>
|
||||||
<span>{getBandoLabel(data.status)}</span>
|
<span>{getBandoLabel(data.applicationStatus)}</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="appPageSection">
|
<div className="appPageSection"></div>
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="appPageSection">
|
<div className="appPageSection">
|
||||||
<h2>{__('Punteggi di valutazione', 'gepafin')}</h2>
|
<h2>{__('Punteggi di valutazione', 'gepafin')}</h2>
|
||||||
@@ -350,7 +420,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
<td>
|
<td>
|
||||||
<div className="p-inputgroup">
|
<div className="p-inputgroup">
|
||||||
<InputNumber
|
<InputNumber
|
||||||
disabled={data.status === 'CLOSE'}
|
disabled={shouldDisableField('criteria')}
|
||||||
placeholder={__('Punteggio', 'gepafin')}
|
placeholder={__('Punteggio', 'gepafin')}
|
||||||
keyfilter="int"
|
keyfilter="int"
|
||||||
value={o.score}
|
value={o.score}
|
||||||
@@ -373,7 +443,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
onClick={() => displayCriterionData(o.id)}
|
onClick={() => displayCriterionData(o.id)}
|
||||||
aria-label={__('Mostra', 'gepafin')}/> : null}
|
aria-label={__('Mostra', 'gepafin')}/> : null}
|
||||||
<Button icon="pi pi-thumbs-up" rounded outlined
|
<Button icon="pi pi-thumbs-up" rounded outlined
|
||||||
disabled={data.status === 'CLOSE'}
|
disabled={shouldDisableField('criteria')}
|
||||||
severity={!isNil(o.valid) && o.valid ? 'success' : 'secondary'}
|
severity={!isNil(o.valid) && o.valid ? 'success' : 'secondary'}
|
||||||
onClick={() => updateEvaluationValue(
|
onClick={() => updateEvaluationValue(
|
||||||
true,
|
true,
|
||||||
@@ -381,7 +451,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
)}
|
)}
|
||||||
aria-label={__('Su', 'gepafin')}/>
|
aria-label={__('Su', 'gepafin')}/>
|
||||||
<Button icon="pi pi-thumbs-down" rounded outlined
|
<Button icon="pi pi-thumbs-down" rounded outlined
|
||||||
disabled={data.status === 'CLOSE'}
|
disabled={shouldDisableField('criteria')}
|
||||||
severity={!isNil(o.valid) && !o.valid ? 'danger' : 'secondary'}
|
severity={!isNil(o.valid) && !o.valid ? 'danger' : 'secondary'}
|
||||||
onClick={() => updateEvaluationValue(
|
onClick={() => updateEvaluationValue(
|
||||||
false,
|
false,
|
||||||
@@ -422,7 +492,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
<div className="appPageSection__checklist">
|
<div className="appPageSection__checklist">
|
||||||
{data.checklist.map((o, i) => <div key={o.id}>
|
{data.checklist.map((o, i) => <div key={o.id}>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
disabled={data.status === 'CLOSE'}
|
disabled={shouldDisableField('checklist')}
|
||||||
inputId={`checklist_${o.id}`}
|
inputId={`checklist_${o.id}`}
|
||||||
onChange={(e) => updateEvaluationValue(
|
onChange={(e) => updateEvaluationValue(
|
||||||
e.checked,
|
e.checked,
|
||||||
@@ -438,7 +508,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
<div>
|
<div>
|
||||||
<Editor
|
<Editor
|
||||||
value={data.note}
|
value={data.note}
|
||||||
readOnly={data.status === 'CLOSE'}
|
readOnly={shouldDisableField('note')}
|
||||||
placeholder={__('Digita qui il messagio', 'gepafin')}
|
placeholder={__('Digita qui il messagio', 'gepafin')}
|
||||||
headerTemplate={header}
|
headerTemplate={header}
|
||||||
onTextChange={(e) => updateEvaluationValue(
|
onTextChange={(e) => updateEvaluationValue(
|
||||||
@@ -452,12 +522,8 @@ const DomandaEditPreInstructor = () => {
|
|||||||
<div>
|
<div>
|
||||||
<h3>{__('Documenti allegati', 'gepafin')}</h3>
|
<h3>{__('Documenti allegati', 'gepafin')}</h3>
|
||||||
<ol className="appPageSection__list">
|
<ol className="appPageSection__list">
|
||||||
{data.files.map((o, i) => <li key={o.id}>
|
{data.files.map((o, i) => <li key={o.id} className="appPageSection__listItem">
|
||||||
<div className="appPageSection" style={{
|
<div className="appPageSection__listItemRow">
|
||||||
flexDirection: 'row',
|
|
||||||
alignItems: 'center',
|
|
||||||
justifyContent: 'space-between'
|
|
||||||
}}>
|
|
||||||
<span>{o.label}</span>
|
<span>{o.label}</span>
|
||||||
<div className="appPageSection__iconActions">
|
<div className="appPageSection__iconActions">
|
||||||
{o.fileDetail && o.fileDetail.length === 1
|
{o.fileDetail && o.fileDetail.length === 1
|
||||||
@@ -466,7 +532,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
outlined severity="info"
|
outlined severity="info"
|
||||||
aria-label={__('Mostra', 'gepafin')}/> : null}
|
aria-label={__('Mostra', 'gepafin')}/> : null}
|
||||||
<Button icon="pi pi-thumbs-up" rounded outlined
|
<Button icon="pi pi-thumbs-up" rounded outlined
|
||||||
disabled={data.status === 'CLOSE'}
|
disabled={shouldDisableField('files')}
|
||||||
severity={!isNil(o.valid) && o.valid ? 'success' : 'secondary'}
|
severity={!isNil(o.valid) && o.valid ? 'success' : 'secondary'}
|
||||||
onClick={() => updateEvaluationValue(
|
onClick={() => updateEvaluationValue(
|
||||||
true,
|
true,
|
||||||
@@ -474,7 +540,7 @@ const DomandaEditPreInstructor = () => {
|
|||||||
)}
|
)}
|
||||||
aria-label={__('Su', 'gepafin')}/>
|
aria-label={__('Su', 'gepafin')}/>
|
||||||
<Button icon="pi pi-thumbs-down" rounded outlined
|
<Button icon="pi pi-thumbs-down" rounded outlined
|
||||||
disabled={data.status === 'CLOSE'}
|
disabled={shouldDisableField('files')}
|
||||||
severity={!isNil(o.valid) && !o.valid ? 'danger' : 'secondary'}
|
severity={!isNil(o.valid) && !o.valid ? 'danger' : 'secondary'}
|
||||||
onClick={() => updateEvaluationValue(
|
onClick={() => updateEvaluationValue(
|
||||||
false,
|
false,
|
||||||
@@ -521,18 +587,21 @@ const DomandaEditPreInstructor = () => {
|
|||||||
|
|
||||||
<div className="appPageSection">
|
<div className="appPageSection">
|
||||||
<div className="appPageSection__actions">
|
<div className="appPageSection__actions">
|
||||||
<Button
|
{['EVALUATION', 'SOCCORSO', 'CLOSE'].includes(data.applicationStatus)
|
||||||
|
? <Button
|
||||||
type="button"
|
type="button"
|
||||||
disabled={!data.id || data.status === 'CLOSE'}
|
disabled={!data.id || data.status === 'CLOSE'}
|
||||||
onClick={doNewSoccorso}
|
onClick={doNewSoccorso}
|
||||||
outlined
|
outlined
|
||||||
label={<>
|
label={<>
|
||||||
{__('Richiedi Soccorso Istruttorio', 'gepafin')}
|
{data.applicationStatus === 'EVALUATION'
|
||||||
|
? __('Richiedi Soccorso Istruttorio', 'gepafin')
|
||||||
|
: __('Apri Soccorso Istruttorio', 'gepafin')}
|
||||||
<i style={{ marginLeft: 7 }}>
|
<i style={{ marginLeft: 7 }}>
|
||||||
<HelpIcon/>
|
<HelpIcon/>
|
||||||
</i>
|
</i>
|
||||||
</>}
|
</>}
|
||||||
/>
|
/> : null}
|
||||||
{data.id
|
{data.id
|
||||||
? <Button
|
? <Button
|
||||||
type="button"
|
type="button"
|
||||||
@@ -546,18 +615,33 @@ const DomandaEditPreInstructor = () => {
|
|||||||
onClick={doSaveDraft}
|
onClick={doSaveDraft}
|
||||||
label={__('Crea valutazione', 'gepafin')}
|
label={__('Crea valutazione', 'gepafin')}
|
||||||
icon="pi pi-save" iconPos="right"/>}
|
icon="pi pi-save" iconPos="right"/>}
|
||||||
|
{APP_EVALUATION_FLOW_ID === '1' && ['EVALUATION'].includes(data.applicationStatus)
|
||||||
|
? <Button
|
||||||
|
type="button"
|
||||||
|
disabled={!data.id}
|
||||||
|
onClick={doCreateAppointment}
|
||||||
|
label={__('Crea l\'appuntamento', 'gepafin')}
|
||||||
|
/> : null}
|
||||||
|
{APP_EVALUATION_FLOW_ID === '1' && ['APPOINTMENT'].includes(data.applicationStatus)
|
||||||
|
? <Button
|
||||||
|
type="button"
|
||||||
|
disabled={!data.id}
|
||||||
|
onClick={doMakeAdmisible}
|
||||||
|
label={__('Ammissibile', 'gepafin')}
|
||||||
|
/> : null}
|
||||||
{data.id
|
{data.id
|
||||||
? <Button
|
? <Button
|
||||||
type="button"
|
type="button"
|
||||||
disabled={!isAdmissible || ['CLOSE', 'SOCCORSO'].includes(data.status)}
|
disabled={!isAdmissible
|
||||||
onClick={doApprove}
|
|| (APP_EVALUATION_FLOW_ID === '1' && !['ADMISSIBLE', 'APPOINTMENT'].includes(data.applicationStatus))}
|
||||||
|
onClick={initiateApproving}
|
||||||
label={__('Approva Domanda', 'gepafin')}
|
label={__('Approva Domanda', 'gepafin')}
|
||||||
icon="pi pi-check" iconPos="right"/> : null}
|
icon="pi pi-check" iconPos="right"/> : null}
|
||||||
{data.id
|
{data.id
|
||||||
? <Button
|
? <Button
|
||||||
type="button"
|
type="button"
|
||||||
disabled={['CLOSE', 'SOCCORSO'].includes(data.status)}
|
disabled={APP_EVALUATION_FLOW_ID === '1' && !['ADMISSIBLE', 'APPOINTMENT'].includes(data.applicationStatus)}
|
||||||
onClick={doReject}
|
onClick={initiateRejecting}
|
||||||
label={__('Respingi Domanda', 'gepafin')}
|
label={__('Respingi Domanda', 'gepafin')}
|
||||||
icon="pi pi-times" iconPos="right"/> : null}
|
icon="pi pi-times" iconPos="right"/> : null}
|
||||||
</div>
|
</div>
|
||||||
@@ -571,6 +655,26 @@ const DomandaEditPreInstructor = () => {
|
|||||||
{criterionDataContent}
|
{criterionDataContent}
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
||||||
|
<Dialog
|
||||||
|
visible={isVisibleCompleteDialog}
|
||||||
|
modal
|
||||||
|
header={headerCompleteDialog}
|
||||||
|
footer={footerCompleteDialog}
|
||||||
|
style={{ maxWidth: '600px', width: '100%' }}
|
||||||
|
onHide={hideCompleteDialog}>
|
||||||
|
<div className="appForm__field">
|
||||||
|
<label>{__('Motivazione', 'gepafin')}</label>
|
||||||
|
<Editor
|
||||||
|
value={motivation}
|
||||||
|
readOnly={loading}
|
||||||
|
placeholder={__('Digita qui il messagio', 'gepafin')}
|
||||||
|
headerTemplate={header}
|
||||||
|
onTextChange={(e) => setMotivation(e.htmlValue)}
|
||||||
|
style={{ height: 80 * 3, width: '100%' }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</Dialog>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
: <>
|
: <>
|
||||||
<Skeleton width="20%" height="1rem" className="mb-2"></Skeleton>
|
<Skeleton width="20%" height="1rem" className="mb-2"></Skeleton>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import { InputIcon } from 'primereact/inputicon';
|
|||||||
import { Button } from 'primereact/button';
|
import { Button } from 'primereact/button';
|
||||||
import { Calendar } from 'primereact/calendar';
|
import { Calendar } from 'primereact/calendar';
|
||||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||||
|
import translationStrings from '../../../../translationStringsForComponents';
|
||||||
|
|
||||||
|
|
||||||
const AllDomandeTable = ({ openDialogFn, updaterString = '' }) => {
|
const AllDomandeTable = ({ openDialogFn, updaterString = '' }) => {
|
||||||
@@ -26,7 +27,7 @@ const AllDomandeTable = ({ openDialogFn, updaterString = '' }) => {
|
|||||||
const [filters, setFilters] = useState(null);
|
const [filters, setFilters] = useState(null);
|
||||||
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
||||||
const [globalFilterValue, setGlobalFilterValue] = useState('');
|
const [globalFilterValue, setGlobalFilterValue] = useState('');
|
||||||
const [statuses, setStatuses] = useState([]);
|
const [, setStatuses] = useState([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setLocalAsyncRequest(true);
|
setLocalAsyncRequest(true);
|
||||||
@@ -154,14 +155,20 @@ const AllDomandeTable = ({ openDialogFn, updaterString = '' }) => {
|
|||||||
filters={filters}
|
filters={filters}
|
||||||
globalFilterFields={['name', 'status']}
|
globalFilterFields={['name', 'status']}
|
||||||
header={header}
|
header={header}
|
||||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
emptyMessage={translationStrings.emptyMessage}
|
||||||
onFilter={(e) => setFilters(e.filters)}>
|
onFilter={(e) => setFilters(e.filters)}>
|
||||||
<Column field="id" header={__('ID domanda', 'gepafin')}
|
<Column field="id" header={__('ID domanda', 'gepafin')}
|
||||||
filter filterPlaceholder={__('Cerca', 'gepafin')}
|
sortable
|
||||||
|
filterPlaceholder={__('Cerca', 'gepafin')}
|
||||||
style={{ minWidth: '8rem' }}/>
|
style={{ minWidth: '8rem' }}/>
|
||||||
<Column field="callTitle" header={__('Bando', 'gepafin')}
|
<Column field="callTitle" header={__('Bando', 'gepafin')}
|
||||||
filter filterPlaceholder={__('Cerca', 'gepafin')}
|
filter sortable
|
||||||
|
filterPlaceholder={__('Cerca', 'gepafin')}
|
||||||
style={{ minWidth: '10rem' }}/>
|
style={{ minWidth: '10rem' }}/>
|
||||||
|
<Column field="companyName" header={__('Azienda', 'gepafin')}
|
||||||
|
filter sortable
|
||||||
|
filterPlaceholder={__('Cerca il nome', 'gepafin')}
|
||||||
|
style={{ minWidth: '8rem' }}/>
|
||||||
<Column header={__('Data Ricezione', 'gepafin')}
|
<Column header={__('Data Ricezione', 'gepafin')}
|
||||||
filterField="submissionDate" dataType="date"
|
filterField="submissionDate" dataType="date"
|
||||||
style={{ minWidth: '8rem' }}
|
style={{ minWidth: '8rem' }}
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ const Domande = () => {
|
|||||||
<div className="appForm__field">
|
<div className="appForm__field">
|
||||||
<label
|
<label
|
||||||
className={classNames({ 'p-error': isEmpty(chosenUser) || chosenUser === 0 || chosenApplication === 0 })}>
|
className={classNames({ 'p-error': isEmpty(chosenUser) || chosenUser === 0 || chosenApplication === 0 })}>
|
||||||
{__('Pre-istruttore', 'gepafin')}*
|
{__('Istruttore', 'gepafin')}*
|
||||||
</label>
|
</label>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
value={chosenUser}
|
value={chosenUser}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import { Calendar } from 'primereact/calendar';
|
|||||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||||
import { Dropdown } from 'primereact/dropdown';
|
import { Dropdown } from 'primereact/dropdown';
|
||||||
import { Tag } from 'primereact/tag';
|
import { Tag } from 'primereact/tag';
|
||||||
|
import translationStrings from '../../../../translationStringsForComponents';
|
||||||
|
|
||||||
|
|
||||||
const BeneficiarioDomandeTable = () => {
|
const BeneficiarioDomandeTable = () => {
|
||||||
@@ -141,7 +142,7 @@ const BeneficiarioDomandeTable = () => {
|
|||||||
const statusFilterTemplate = (options) => {
|
const statusFilterTemplate = (options) => {
|
||||||
return <Dropdown value={options.value} options={statuses}
|
return <Dropdown value={options.value} options={statuses}
|
||||||
onChange={(e) => options.filterCallback(e.value, options.index)}
|
onChange={(e) => options.filterCallback(e.value, options.index)}
|
||||||
itemTemplate={statusItemTemplate} placeholder="Select One" className="p-column-filter"
|
itemTemplate={statusItemTemplate} placeholder={translationStrings.selectOneLabel} className="p-column-filter"
|
||||||
showClear/>;
|
showClear/>;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -169,19 +170,25 @@ const BeneficiarioDomandeTable = () => {
|
|||||||
filters={filters}
|
filters={filters}
|
||||||
globalFilterFields={['name', 'status']}
|
globalFilterFields={['name', 'status']}
|
||||||
header={header}
|
header={header}
|
||||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
emptyMessage={translationStrings.emptyMessage}
|
||||||
onFilter={(e) => setFilters(e.filters)}>
|
onFilter={(e) => setFilters(e.filters)}>
|
||||||
<Column field="id" header={__('ID domanda', 'gepafin')} filter
|
<Column field="id" header={__('ID domanda', 'gepafin')}
|
||||||
|
sortable
|
||||||
filterPlaceholder={__('Cerca il nome', 'gepafin')}
|
filterPlaceholder={__('Cerca il nome', 'gepafin')}
|
||||||
style={{ minWidth: '6rem' }}/>
|
style={{ minWidth: '6rem' }}/>
|
||||||
<Column field="callTitle" header={__('Titolo bando', 'gepafin')} filter
|
<Column field="callTitle" header={__('Titolo bando', 'gepafin')}
|
||||||
|
filter sortable
|
||||||
|
filterPlaceholder={__('Cerca il nome', 'gepafin')}
|
||||||
|
style={{ minWidth: '8rem' }}/>
|
||||||
|
<Column field="companyName" header={__('Azienda', 'gepafin')}
|
||||||
|
filter sortable
|
||||||
filterPlaceholder={__('Cerca il nome', 'gepafin')}
|
filterPlaceholder={__('Cerca il nome', 'gepafin')}
|
||||||
style={{ minWidth: '8rem' }}/>
|
style={{ minWidth: '8rem' }}/>
|
||||||
<Column header={__('Data di invio', 'gepafin')} filterField="submissionDate" dataType="date"
|
<Column header={__('Data di invio', 'gepafin')} filterField="submissionDate" dataType="date"
|
||||||
style={{ minWidth: '8rem' }}
|
style={{ minWidth: '8rem' }}
|
||||||
body={dateSubmissionBodyTemplate} filter filterElement={dateFilterTemplate}/>
|
body={dateSubmissionBodyTemplate} filter filterElement={dateFilterTemplate}/>
|
||||||
<Column field="status" header={__('Stato', 'gepafin')} filterMenuStyle={{ width: '14rem' }}
|
<Column field="status" header={__('Stato', 'gepafin')} filterMenuStyle={{ width: '14rem' }}
|
||||||
style={{ minWidth: '7rem' }} body={statusBodyTemplate} filter
|
style={{ minWidth: '7rem' }} body={statusBodyTemplate}
|
||||||
filterElement={statusFilterTemplate}/>
|
filterElement={statusFilterTemplate}/>
|
||||||
<Column header={__('Esito', 'gepafin')}
|
<Column header={__('Esito', 'gepafin')}
|
||||||
style={{ minWidth: '7rem' }} field="progress" body={progressBodyTemplate}/>
|
style={{ minWidth: '7rem' }} field="progress" body={progressBodyTemplate}/>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { klona } from 'klona';
|
|||||||
import { wrap } from 'object-path-immutable';
|
import { wrap } from 'object-path-immutable';
|
||||||
import { useForm } from 'react-hook-form';
|
import { useForm } from 'react-hook-form';
|
||||||
import emailjs from '@emailjs/browser';
|
import emailjs from '@emailjs/browser';
|
||||||
|
//import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
// store
|
// store
|
||||||
import { storeSet, useStore, storeGet } from '../../store';
|
import { storeSet, useStore, storeGet } from '../../store';
|
||||||
@@ -40,6 +41,7 @@ const ProfileCompany = () => {
|
|||||||
const [isVisibleRemoveDialog, setIsVisibleRemoveDialog] = useState(false);
|
const [isVisibleRemoveDialog, setIsVisibleRemoveDialog] = useState(false);
|
||||||
const { delegaFirstName = '', delegaLastName = '', delegaCodiceFiscale = '' } = delegaData;
|
const { delegaFirstName = '', delegaLastName = '', delegaCodiceFiscale = '' } = delegaData;
|
||||||
const toast = useRef(null);
|
const toast = useRef(null);
|
||||||
|
//const navigate = useNavigate();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
control,
|
control,
|
||||||
@@ -268,9 +270,35 @@ const ProfileCompany = () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO delete company functionality by API, ready to be shipped
|
||||||
|
/*const doRemoveCompanyAPI = () => {
|
||||||
|
storeSet.main.setAsyncRequest();
|
||||||
|
CompanyService.deleteCompany(formInitialData.id, deleteCompanyCallback, errDeleteCompanyCallback)
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteCompanyCallback = (data) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
const userData = storeGet.main.userData();
|
||||||
|
const newCompanies = companies.filter(o => o.id !== chosenCompanyId);
|
||||||
|
const newUserData = wrap(userData).set('company', newCompanies).value();
|
||||||
|
storeSet.main.companies(newUserData.companies);
|
||||||
|
storeSet.main.userData(newUserData);
|
||||||
|
|
||||||
|
if (!isEmpty(newCompanies)) {
|
||||||
|
const newChosenCompanyId = newCompanies[0].id;
|
||||||
|
storeSet.main.chosenCompanyId(newChosenCompanyId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
storeSet.main.unsetAsyncRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
const errDeleteCompanyCallback = (data) => {
|
||||||
|
set404FromErrorResponse(data);
|
||||||
|
storeSet.main.unsetAsyncRequest();
|
||||||
|
}*/
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const newFormData = klona(formInitialData);
|
const newFormData = klona(formInitialData);
|
||||||
Object.keys(newFormData).map(v => setValue(v, newFormData[v]));
|
Object.keys(newFormData).map(v => setValue(v, newFormData[v]));
|
||||||
|
|||||||
@@ -0,0 +1,218 @@
|
|||||||
|
import React, { useEffect, useRef, useState } from 'react';
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
import { is, isEmpty, isNil } from 'ramda';
|
||||||
|
import { wrap } from 'object-path-immutable';
|
||||||
|
|
||||||
|
// tools
|
||||||
|
import getDateFromISOstring from '../../../../helpers/getDateFromISOstring';
|
||||||
|
import set404FromErrorResponse from '../../../../helpers/set404FromErrorResponse';
|
||||||
|
import uniqid from '../../../../helpers/uniqid';
|
||||||
|
|
||||||
|
// store
|
||||||
|
import { storeGet } from '../../../../store';
|
||||||
|
|
||||||
|
// api
|
||||||
|
import CommunicationService from '../../../../service/communication-service';
|
||||||
|
|
||||||
|
// components
|
||||||
|
import { Button } from 'primereact/button';
|
||||||
|
import { classNames } from 'primereact/utils';
|
||||||
|
import { InputText } from 'primereact/inputtext';
|
||||||
|
import { InputTextarea } from 'primereact/inputtextarea';
|
||||||
|
import { Dialog } from 'primereact/dialog';
|
||||||
|
import { Toast } from 'primereact/toast';
|
||||||
|
|
||||||
|
const SoccorsoComunications = ({ amendmentId, soccorsoStatus }) => {
|
||||||
|
const [comms, setComms] = useState([]);
|
||||||
|
const [isVisibleNewCommDialog, setIsVisibleNewCommDialog] = useState(false);
|
||||||
|
const [newCommData, setNewCommData] = useState({});
|
||||||
|
const [isLoadingCommunication, setIsLoadingCommunication] = useState(false);
|
||||||
|
const toast = useRef(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (amendmentId && amendmentId !== 0) {
|
||||||
|
setIsLoadingCommunication(true);
|
||||||
|
CommunicationService.getCommsByAmendmentId(amendmentId, getCommsCallback, errGetCommsCallback);
|
||||||
|
}
|
||||||
|
}, [amendmentId]);
|
||||||
|
|
||||||
|
const getCommsCallback = (data) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
setComms(data.data.commentsList.map(o => getFormattedCommsData(o)));
|
||||||
|
}
|
||||||
|
setIsLoadingCommunication(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
const errGetCommsCallback = (data) => {
|
||||||
|
if (toast.current && data.message) {
|
||||||
|
toast.current.show({
|
||||||
|
severity: 'error',
|
||||||
|
summary: '',
|
||||||
|
detail: data.message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
setIsLoadingCommunication(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
const getFormattedCommsData = (data) => {
|
||||||
|
data.id = isNil(data.id) ? uniqid('id') : data.id;
|
||||||
|
data.commentedDate = is(String, data.commentedDate) ? new Date(data.commentedDate) : (data.commentedDate ? data.commentedDate : '');
|
||||||
|
data.createdDate = is(String, data.createdDate) ? new Date(data.createdDate) : (data.createdDate ? data.createdDate : '');
|
||||||
|
data.updatedDate = is(String, data.updatedDate) ? new Date(data.updatedDate) : (data.updatedDate ? data.updatedDate : '');
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
const headerNewComDialog = () => {
|
||||||
|
return <span>{__('Aggiungi comunicazione', 'gepafin')}</span>
|
||||||
|
}
|
||||||
|
|
||||||
|
const hideNewComDialog = () => {
|
||||||
|
setIsVisibleNewCommDialog(false);
|
||||||
|
setNewCommData({
|
||||||
|
title: '',
|
||||||
|
comment: ''
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const footerNewComDialog = () => {
|
||||||
|
return <div>
|
||||||
|
<Button type="button" label={__('Anulla', 'gepafin')} onClick={hideNewComDialog} outlined/>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
disabled={isLoadingCommunication || isEmpty(newCommData.title) || isEmpty(newCommData.comment)}
|
||||||
|
label={__('Invia', 'gepafin')} onClick={createCommunication}/>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
const openNewCommDialog = () => {
|
||||||
|
setIsVisibleNewCommDialog(true);
|
||||||
|
setNewCommData({
|
||||||
|
title: '',
|
||||||
|
comment: ''
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateNewCommData = (value, path) => {
|
||||||
|
const newData = wrap(newCommData).set(path.split('.'), value).value();
|
||||||
|
setNewCommData(newData);
|
||||||
|
}
|
||||||
|
|
||||||
|
const createCommunication = () => {
|
||||||
|
setIsLoadingCommunication(true);
|
||||||
|
CommunicationService.createCommunication(amendmentId, newCommData, createCommunicationCallback, errCreateCommunicationCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
const createCommunicationCallback = (data) => {
|
||||||
|
if (data.status === 'SUCCESS') {
|
||||||
|
if (toast.current) {
|
||||||
|
toast.current.show({
|
||||||
|
severity: 'success',
|
||||||
|
summary: '',
|
||||||
|
detail: data.message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
setComms([...comms, getFormattedCommsData(data.data)])
|
||||||
|
setIsVisibleNewCommDialog(false);
|
||||||
|
}
|
||||||
|
setIsLoadingCommunication(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
const errCreateCommunicationCallback = (data) => {
|
||||||
|
if (toast.current && data.message) {
|
||||||
|
toast.current.show({
|
||||||
|
severity: 'error',
|
||||||
|
summary: '',
|
||||||
|
detail: data.message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
set404FromErrorResponse(data);
|
||||||
|
setIsLoadingCommunication(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
const displayCommIcon = (comm) => {
|
||||||
|
const userData = storeGet.main.userData();
|
||||||
|
return userData.id === comm.senderUserId
|
||||||
|
? <i className="pi pi-upload"></i>
|
||||||
|
: <i className="pi pi-download"></i>;
|
||||||
|
}
|
||||||
|
|
||||||
|
const getCommRowClass = (comm) => {
|
||||||
|
const userData = storeGet.main.userData();
|
||||||
|
return userData.id === comm.senderUserId ? 'outgoing' : 'incoming';
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Toast ref={toast}/>
|
||||||
|
<table className="myTable">
|
||||||
|
<thead className="myThead">
|
||||||
|
<tr>
|
||||||
|
<th style={{ width: 50 }}></th>
|
||||||
|
<th style={{ width: 250 }}>{__('Data', 'gepafin')}</th>
|
||||||
|
<th style={{ width: '100%' }}>{__('Comunicazione', 'gepafin')}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody className="myTbody">
|
||||||
|
{!isNil(comms) && !isEmpty(comms)
|
||||||
|
? comms.map((o, i) => <tr key={o.id} className={getCommRowClass(o)}>
|
||||||
|
<td valign="top">
|
||||||
|
{displayCommIcon(o)}
|
||||||
|
</td>
|
||||||
|
<td valign="top">
|
||||||
|
{getDateFromISOstring(o.commentedDate)}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<h3>{o.title}</h3>
|
||||||
|
<p>{o.comment}</p>
|
||||||
|
</td>
|
||||||
|
</tr>)
|
||||||
|
: <tr>
|
||||||
|
<td></td>
|
||||||
|
<td>-</td>
|
||||||
|
<td>-</td>
|
||||||
|
</tr>}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
style={{ marginTop: 30 }}
|
||||||
|
onClick={openNewCommDialog}
|
||||||
|
disabled={soccorsoStatus === 'CLOSE'}
|
||||||
|
type="button"
|
||||||
|
label={__('Aggiungi Comunicazione', 'gepafin')}
|
||||||
|
icon="pi pi-plus" iconPos="right"/>
|
||||||
|
|
||||||
|
<Dialog
|
||||||
|
visible={isVisibleNewCommDialog}
|
||||||
|
modal
|
||||||
|
header={headerNewComDialog}
|
||||||
|
footer={footerNewComDialog}
|
||||||
|
style={{ maxWidth: '600px', width: '100%' }}
|
||||||
|
onHide={hideNewComDialog}>
|
||||||
|
<div className="appForm__field">
|
||||||
|
<label
|
||||||
|
className={classNames({ 'p-error': isEmpty(newCommData.title) })}>
|
||||||
|
{__('Titolo', 'gepafin')}*
|
||||||
|
</label>
|
||||||
|
<InputText value={newCommData.title}
|
||||||
|
disabled={soccorsoStatus === 'CLOSE'}
|
||||||
|
invalid={isEmpty(newCommData.title)}
|
||||||
|
onChange={(e) => updateNewCommData(e.target.value, 'title')}/>
|
||||||
|
|
||||||
|
<label
|
||||||
|
className={classNames({ 'p-error': isEmpty(newCommData.comment) })}>
|
||||||
|
{__('Contenuto', 'gepafin')}*
|
||||||
|
</label>
|
||||||
|
<InputTextarea
|
||||||
|
value={newCommData.comment}
|
||||||
|
disabled={soccorsoStatus === 'CLOSE'}
|
||||||
|
rows={5} cols={30}
|
||||||
|
invalid={isEmpty(newCommData.comment)}
|
||||||
|
onChange={(e) => updateNewCommData(e.target.value, 'comment')}/>
|
||||||
|
</div>
|
||||||
|
</Dialog>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SoccorsoComunications;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { useState, useEffect, useRef, useMemo } from 'react';
|
import React, { useState, useEffect, useRef, useMemo } from 'react';
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
import { useNavigate, useParams } from 'react-router-dom';
|
import { useNavigate, useParams } from 'react-router-dom';
|
||||||
import { is, isEmpty, isNil } from 'ramda';
|
import { is, isEmpty } from 'ramda';
|
||||||
import { wrap } from 'object-path-immutable';
|
import { wrap } from 'object-path-immutable';
|
||||||
import { klona } from 'klona';
|
import { klona } from 'klona';
|
||||||
import { useForm } from 'react-hook-form';
|
import { useForm } from 'react-hook-form';
|
||||||
@@ -11,14 +11,12 @@ import { storeSet, useStore } from '../../store';
|
|||||||
|
|
||||||
// api
|
// api
|
||||||
import AmendmentsService from '../../service/amendments-service';
|
import AmendmentsService from '../../service/amendments-service';
|
||||||
import CommunicationService from '../../service/communication-service';
|
|
||||||
|
|
||||||
// tools
|
// tools
|
||||||
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
||||||
import getBandoLabel from '../../helpers/getBandoLabel';
|
import getBandoLabel from '../../helpers/getBandoLabel';
|
||||||
import getDateFromISOstring from '../../helpers/getDateFromISOstring';
|
import getDateFromISOstring from '../../helpers/getDateFromISOstring';
|
||||||
import renderHtmlContent from '../../helpers/renderHtmlContent';
|
import renderHtmlContent from '../../helpers/renderHtmlContent';
|
||||||
import uniqid from '../../helpers/uniqid';
|
|
||||||
|
|
||||||
// components
|
// components
|
||||||
import { Button } from 'primereact/button';
|
import { Button } from 'primereact/button';
|
||||||
@@ -26,21 +24,17 @@ import BlockingOverlay from '../../components/BlockingOverlay';
|
|||||||
import { Toast } from 'primereact/toast';
|
import { Toast } from 'primereact/toast';
|
||||||
import { classNames } from 'primereact/utils';
|
import { classNames } from 'primereact/utils';
|
||||||
import { Dialog } from 'primereact/dialog';
|
import { Dialog } from 'primereact/dialog';
|
||||||
import { InputText } from 'primereact/inputtext';
|
|
||||||
import { InputTextarea } from 'primereact/inputtextarea';
|
|
||||||
import FormField from '../../components/FormField';
|
import FormField from '../../components/FormField';
|
||||||
import { Editor } from 'primereact/editor';
|
import { Editor } from 'primereact/editor';
|
||||||
import { InputNumber } from 'primereact/inputnumber';
|
import { InputNumber } from 'primereact/inputnumber';
|
||||||
|
import SoccorsoComunications from './components/SoccorsoComunications';
|
||||||
|
|
||||||
|
|
||||||
const SoccorsoEditPreInstructor = () => {
|
const SoccorsoEditPreInstructor = () => {
|
||||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||||
const { id, amendmentId } = useParams();
|
const { id, amendmentId } = useParams();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [data, setData] = useState({});
|
const [data, setData] = useState({});
|
||||||
const [comms, setComms] = useState([]);
|
|
||||||
const [isVisibleNewCommDialog, setIsVisibleNewCommDialog] = useState(false);
|
|
||||||
const [newCommData, setNewCommData] = useState({});
|
|
||||||
const [isLoadingCommunication, setIsLoadingCommunication] = useState(false);
|
|
||||||
const [isVisibleExtendTimeDialog, setIsVisibleExtendTimeDialog] = useState(false);
|
const [isVisibleExtendTimeDialog, setIsVisibleExtendTimeDialog] = useState(false);
|
||||||
const [extendedTime, setExtendedTime] = useState(3);
|
const [extendedTime, setExtendedTime] = useState(3);
|
||||||
const [isLoadingExtendingTime, setIsLoadingExtendingTime] = useState(false);
|
const [isLoadingExtendingTime, setIsLoadingExtendingTime] = useState(false);
|
||||||
@@ -75,9 +69,8 @@ const SoccorsoEditPreInstructor = () => {
|
|||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
setFormInitialData(formDataInitial);
|
setFormInitialData(formDataInitial);
|
||||||
CommunicationService.getCommsByAmendmentId(data.data.id, getCommsCallback, errGetCommsCallback);
|
|
||||||
}
|
}
|
||||||
//storeSet.main.unsetAsyncRequest();
|
storeSet.main.unsetAsyncRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
const errGetCallback = (data) => {
|
const errGetCallback = (data) => {
|
||||||
@@ -92,74 +85,12 @@ const SoccorsoEditPreInstructor = () => {
|
|||||||
storeSet.main.unsetAsyncRequest();
|
storeSet.main.unsetAsyncRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
const getCommsCallback = (data) => {
|
|
||||||
if (data.status === 'SUCCESS') {
|
|
||||||
setComms(data.data.commentsList.map(o => getFormattedCommsData(o)));
|
|
||||||
}
|
|
||||||
storeSet.main.unsetAsyncRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
const errGetCommsCallback = (data) => {
|
|
||||||
if (toast.current && data.message) {
|
|
||||||
toast.current.show({
|
|
||||||
severity: 'error',
|
|
||||||
summary: '',
|
|
||||||
detail: data.message
|
|
||||||
});
|
|
||||||
}
|
|
||||||
set404FromErrorResponse(data);
|
|
||||||
storeSet.main.unsetAsyncRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
const getFormattedData = (data) => {
|
const getFormattedData = (data) => {
|
||||||
data.startDate = is(String, data.startDate) ? new Date(data.startDate) : (data.startDate ? data.startDate : '');
|
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 : '');
|
data.expirationDate = is(String, data.expirationDate) ? new Date(data.expirationDate) : (data.expirationDate ? data.expirationDate : '');
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getFormattedCommsData = (data) => {
|
|
||||||
data.id = isNil(data.id) ? uniqid('id') : data.id;
|
|
||||||
data.commentedDate = is(String, data.commentedDate) ? new Date(data.commentedDate) : (data.commentedDate ? data.commentedDate : '');
|
|
||||||
data.createdDate = is(String, data.createdDate) ? new Date(data.createdDate) : (data.createdDate ? data.createdDate : '');
|
|
||||||
data.updatedDate = is(String, data.updatedDate) ? new Date(data.updatedDate) : (data.updatedDate ? data.updatedDate : '');
|
|
||||||
return data;
|
|
||||||
};
|
|
||||||
|
|
||||||
const headerNewComDialog = () => {
|
|
||||||
return <span>{__('Aggiungi comunicazione', 'gepafin')}</span>
|
|
||||||
}
|
|
||||||
|
|
||||||
const hideNewComDialog = () => {
|
|
||||||
setIsVisibleNewCommDialog(false);
|
|
||||||
setNewCommData({
|
|
||||||
title: '',
|
|
||||||
comment: ''
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const footerNewComDialog = () => {
|
|
||||||
return <div>
|
|
||||||
<Button type="button" label={__('Anulla', 'gepafin')} onClick={hideNewComDialog} outlined/>
|
|
||||||
<Button
|
|
||||||
type="button"
|
|
||||||
disabled={isLoadingCommunication || isEmpty(newCommData.title) || isEmpty(newCommData.comment)}
|
|
||||||
label={__('Invia', 'gepafin')} onClick={createCommunication}/>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
const openNewCommDialog = () => {
|
|
||||||
setIsVisibleNewCommDialog(true);
|
|
||||||
setNewCommData({
|
|
||||||
title: '',
|
|
||||||
comment: ''
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const updateNewCommData = (value, path) => {
|
|
||||||
const newData = wrap(newCommData).set(path.split('.'), value).value();
|
|
||||||
setNewCommData(newData);
|
|
||||||
}
|
|
||||||
|
|
||||||
const renderHeader = () => {
|
const renderHeader = () => {
|
||||||
return (
|
return (
|
||||||
<span className="ql-formats">
|
<span className="ql-formats">
|
||||||
@@ -185,38 +116,6 @@ const SoccorsoEditPreInstructor = () => {
|
|||||||
setData(newData);
|
setData(newData);
|
||||||
}
|
}
|
||||||
|
|
||||||
const createCommunication = () => {
|
|
||||||
setIsLoadingCommunication(true);
|
|
||||||
CommunicationService.createCommunication(amendmentId, newCommData, createCommunicationCallback, errCreateCommunicationCallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
const createCommunicationCallback = (data) => {
|
|
||||||
if (data.status === 'SUCCESS') {
|
|
||||||
if (toast.current) {
|
|
||||||
toast.current.show({
|
|
||||||
severity: 'success',
|
|
||||||
summary: '',
|
|
||||||
detail: data.message
|
|
||||||
});
|
|
||||||
}
|
|
||||||
setComms([...comms, getFormattedCommsData(data.data)])
|
|
||||||
setIsVisibleNewCommDialog(false);
|
|
||||||
}
|
|
||||||
setIsLoadingCommunication(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
const errCreateCommunicationCallback = (data) => {
|
|
||||||
if (toast.current && data.message) {
|
|
||||||
toast.current.show({
|
|
||||||
severity: 'error',
|
|
||||||
summary: '',
|
|
||||||
detail: data.message
|
|
||||||
});
|
|
||||||
}
|
|
||||||
set404FromErrorResponse(data);
|
|
||||||
setIsLoadingCommunication(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
const onSubmit = () => {
|
const onSubmit = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -238,9 +137,8 @@ const SoccorsoEditPreInstructor = () => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const submitData = {
|
const submitData = {
|
||||||
updatedFormFields: newFormValues,
|
applicationFormFields: newFormValues
|
||||||
}
|
}
|
||||||
|
|
||||||
storeSet.main.setAsyncRequest();
|
storeSet.main.setAsyncRequest();
|
||||||
AmendmentsService.updateSoccorso(amendmentId, submitData, updateAmendmentCallback, errUpdateAmendmentCallback);
|
AmendmentsService.updateSoccorso(amendmentId, submitData, updateAmendmentCallback, errUpdateAmendmentCallback);
|
||||||
}
|
}
|
||||||
@@ -254,6 +152,13 @@ const SoccorsoEditPreInstructor = () => {
|
|||||||
detail: data.message
|
detail: data.message
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
const newFormDataInitial = data.data.applicationFormFields.reduce((acc, cur) => {
|
||||||
|
if (cur.fieldValue) {
|
||||||
|
acc[cur.fieldId] = cur.fieldValue;
|
||||||
|
}
|
||||||
|
return acc;
|
||||||
|
}, formInitialData);
|
||||||
|
setFormInitialData(newFormDataInitial);
|
||||||
}
|
}
|
||||||
storeSet.main.unsetAsyncRequest();
|
storeSet.main.unsetAsyncRequest();
|
||||||
}
|
}
|
||||||
@@ -390,6 +295,14 @@ const SoccorsoEditPreInstructor = () => {
|
|||||||
setIsLoadingReminding(false);
|
setIsLoadingReminding(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (formInitialData) {
|
||||||
|
//reset();
|
||||||
|
Object.keys(formInitialData).map(k => setValue(k, formInitialData[k]));
|
||||||
|
trigger();
|
||||||
|
}
|
||||||
|
}, [formInitialData]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const parsedSoccorsoId = parseInt(amendmentId);
|
const parsedSoccorsoId = parseInt(amendmentId);
|
||||||
const soccorsoEntityId = !isNaN(parsedSoccorsoId) ? parsedSoccorsoId : 0;
|
const soccorsoEntityId = !isNaN(parsedSoccorsoId) ? parsedSoccorsoId : 0;
|
||||||
@@ -453,9 +366,10 @@ const SoccorsoEditPreInstructor = () => {
|
|||||||
<h3>{__('Documenti Richiesti', 'gepafin')}</h3>
|
<h3>{__('Documenti Richiesti', 'gepafin')}</h3>
|
||||||
<ol className="appPageSection__list">
|
<ol className="appPageSection__list">
|
||||||
{data.formFields
|
{data.formFields
|
||||||
? data.formFields.map((o, i) => <li key={o.fieldId} style={{ flexDirection: 'row' }}>
|
? data.formFields.map((o, i) => <li key={o.fieldId}
|
||||||
<span>{o.label}</span>
|
style={{ flexDirection: 'row' }}>
|
||||||
</li>) : null}
|
<span>{o.label}</span>
|
||||||
|
</li>) : null}
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -471,38 +385,7 @@ const SoccorsoEditPreInstructor = () => {
|
|||||||
|
|
||||||
<div className="appPageSection">
|
<div className="appPageSection">
|
||||||
<h2>{__('Comunicazioni', 'gepafin')}</h2>
|
<h2>{__('Comunicazioni', 'gepafin')}</h2>
|
||||||
<table className="myTable">
|
<SoccorsoComunications amendmentId={amendmentId} soccorsoStatus={data.status}/>
|
||||||
<thead className="myThead">
|
|
||||||
<tr>
|
|
||||||
<th style={{ width: 250 }}>{__('Data', 'gepafin')}</th>
|
|
||||||
<th>{__('Comunicazione', 'gepafin')}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody className="myTbody">
|
|
||||||
{!isNil(comms) && !isEmpty(comms)
|
|
||||||
? comms.map((o, i) => <tr key={o.id}>
|
|
||||||
<td valign="top">
|
|
||||||
{getDateFromISOstring(o.commentedDate)}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<h3>{o.title}</h3>
|
|
||||||
<p>{o.comment}</p>
|
|
||||||
</td>
|
|
||||||
</tr>)
|
|
||||||
: <tr>
|
|
||||||
<td>-</td>
|
|
||||||
<td>-</td>
|
|
||||||
</tr>}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
style={{ marginTop: 30 }}
|
|
||||||
onClick={openNewCommDialog}
|
|
||||||
disabled={data.status === 'CLOSE'}
|
|
||||||
type="button"
|
|
||||||
label={__('Aggiungi Comunicazione', 'gepafin')}
|
|
||||||
icon="pi pi-plus" iconPos="right"/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="appPageSection">
|
<div className="appPageSection">
|
||||||
@@ -511,35 +394,42 @@ const SoccorsoEditPreInstructor = () => {
|
|||||||
<form className="appForm" onSubmit={handleSubmit(onSubmit)}>
|
<form className="appForm" onSubmit={handleSubmit(onSubmit)}>
|
||||||
{data.formFields
|
{data.formFields
|
||||||
? data.formFields.map((o, i) => {
|
? data.formFields.map((o, i) => {
|
||||||
/*const thisField = head(test.updatedFormFields.filter(j => j.fieldId === o.fieldId));
|
return <FormField
|
||||||
const value = pathOr({}, ['fieldValue'], thisField);
|
key={o.fieldId}
|
||||||
console.log('value', value, o.fieldId);*/
|
disabled={data.status === 'CLOSE'}
|
||||||
return <FormField
|
type="fileupload"
|
||||||
key={o.fieldId}
|
setDataFn={setValue}
|
||||||
disabled={data.status === 'CLOSE'}
|
saveFormCallback={doUpdateAmendment}
|
||||||
type="fileupload"
|
fieldName={o.fieldId}
|
||||||
setDataFn={setValue}
|
label={o.label}
|
||||||
fieldName={o.fieldId}
|
control={control}
|
||||||
label={o.label}
|
register={register}
|
||||||
control={control}
|
errors={errors}
|
||||||
errors={errors}
|
defaultValue={formInitialData[o.fieldId] ? formInitialData[o.fieldId] : []}
|
||||||
defaultValue={formInitialData[o.fieldId] ? formInitialData[o.fieldId] : []}
|
accept={[]}
|
||||||
accept={[]}
|
sourceId={data.applicationId}
|
||||||
doctype="document"
|
multiple={true}
|
||||||
register={register}
|
/>
|
||||||
sourceId={data.applicationId}
|
}) : null}
|
||||||
source="application"
|
|
||||||
multiple={true}
|
|
||||||
/>
|
|
||||||
}) : null}
|
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
<Button
|
<div className="appForm__field">
|
||||||
style={{ marginTop: 30 }}
|
<label>{__('Motivazioni / Note Interne', 'gepafin')}</label>
|
||||||
type="button"
|
<div style={{ position: 'relative' }}>
|
||||||
disabled={data.status === 'CLOSE'}
|
<BlockingOverlay shouldDisplay={data.status === 'CLOSE'}/>
|
||||||
onClick={doUpdateAmendment}
|
<Editor
|
||||||
label={__('Aggiorna', 'gepafin')}/>
|
value={data.internalNote}
|
||||||
|
readOnly={data.status === 'CLOSE'}
|
||||||
|
placeholder={__('Digita qui il messagio', 'gepafin')}
|
||||||
|
headerTemplate={header}
|
||||||
|
onTextChange={(e) => updateNewAmendmentData(
|
||||||
|
e.htmlValue,
|
||||||
|
'internalNote'
|
||||||
|
)}
|
||||||
|
style={{ height: 80 * 3, width: '100%' }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="appPage__spacer"></div>
|
<div className="appPage__spacer"></div>
|
||||||
@@ -566,6 +456,12 @@ const SoccorsoEditPreInstructor = () => {
|
|||||||
label={__('Estendi Scadenza', 'gepafin')}
|
label={__('Estendi Scadenza', 'gepafin')}
|
||||||
icon="pi pi-stopwatch"
|
icon="pi pi-stopwatch"
|
||||||
/>
|
/>
|
||||||
|
{/*<Button
|
||||||
|
type="button"
|
||||||
|
onClick={doUpdateAmendment}
|
||||||
|
disabled={isAsyncRequest || data.status === 'CLOSE'}
|
||||||
|
label={__('Salva bozza', 'gepafin')}
|
||||||
|
icon="pi pi-save" iconPos="right"/>*/}
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={doCloseAmendment}
|
onClick={doCloseAmendment}
|
||||||
@@ -575,56 +471,8 @@ const SoccorsoEditPreInstructor = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="appForm__field" style={{ marginTop: '-40px' }}>
|
|
||||||
<label>{__('Note Interne', 'gepafin')}</label>
|
|
||||||
<div style={{position: 'relative'}}>
|
|
||||||
<BlockingOverlay shouldDisplay={data.status === 'CLOSE'}/>
|
|
||||||
<Editor
|
|
||||||
value={data.internalNote}
|
|
||||||
readOnly={data.status === 'CLOSE'}
|
|
||||||
placeholder={__('Digita qui il messagio', 'gepafin')}
|
|
||||||
headerTemplate={header}
|
|
||||||
onTextChange={(e) => updateNewAmendmentData(
|
|
||||||
e.htmlValue,
|
|
||||||
'internalNote'
|
|
||||||
)}
|
|
||||||
style={{ height: 80 * 3, width: '100%' }}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Dialog
|
|
||||||
visible={isVisibleNewCommDialog}
|
|
||||||
modal
|
|
||||||
header={headerNewComDialog}
|
|
||||||
footer={footerNewComDialog}
|
|
||||||
style={{ maxWidth: '600px', width: '100%' }}
|
|
||||||
onHide={hideNewComDialog}>
|
|
||||||
<div className="appForm__field">
|
|
||||||
<label
|
|
||||||
className={classNames({ 'p-error': isEmpty(newCommData.title) })}>
|
|
||||||
{__('Titolo', 'gepafin')}*
|
|
||||||
</label>
|
|
||||||
<InputText value={newCommData.title}
|
|
||||||
disabled={data.status === 'CLOSE'}
|
|
||||||
invalid={isEmpty(newCommData.title)}
|
|
||||||
onChange={(e) => updateNewCommData(e.target.value, 'title')}/>
|
|
||||||
|
|
||||||
<label
|
|
||||||
className={classNames({ 'p-error': isEmpty(newCommData.comment) })}>
|
|
||||||
{__('Contenuto', 'gepafin')}*
|
|
||||||
</label>
|
|
||||||
<InputTextarea
|
|
||||||
value={newCommData.comment}
|
|
||||||
disabled={data.status === 'CLOSE'}
|
|
||||||
rows={5} cols={30}
|
|
||||||
invalid={isEmpty(newCommData.comment)}
|
|
||||||
onChange={(e) => updateNewCommData(e.target.value, 'comment')}/>
|
|
||||||
</div>
|
|
||||||
</Dialog>
|
|
||||||
|
|
||||||
<Dialog
|
<Dialog
|
||||||
visible={isVisibleExtendTimeDialog}
|
visible={isVisibleExtendTimeDialog}
|
||||||
modal
|
modal
|
||||||
|
|||||||
@@ -7,7 +7,11 @@ import { Link } from 'react-router-dom';
|
|||||||
import { storeGet } from '../../../../store';
|
import { storeGet } from '../../../../store';
|
||||||
|
|
||||||
// api
|
// api
|
||||||
|
import AmendmentsService from '../../../../service/amendments-service';
|
||||||
|
|
||||||
|
// tools
|
||||||
|
import getBandoLabel from '../../../../helpers/getBandoLabel';
|
||||||
|
import getBandoSeverity from '../../../../helpers/getBandoSeverity';
|
||||||
|
|
||||||
// components
|
// components
|
||||||
import { FilterMatchMode, FilterOperator } from 'primereact/api';
|
import { FilterMatchMode, FilterOperator } from 'primereact/api';
|
||||||
@@ -19,7 +23,10 @@ import { InputIcon } from 'primereact/inputicon';
|
|||||||
import { Button } from 'primereact/button';
|
import { Button } from 'primereact/button';
|
||||||
import { Calendar } from 'primereact/calendar';
|
import { Calendar } from 'primereact/calendar';
|
||||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||||
import AmendmentsService from '../../../../service/amendments-service';
|
import { Dropdown } from 'primereact/dropdown';
|
||||||
|
import { Tag } from 'primereact/tag';
|
||||||
|
|
||||||
|
import translationStrings from '../../../../translationStringsForComponents';
|
||||||
|
|
||||||
|
|
||||||
const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
|
const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
|
||||||
@@ -129,6 +136,14 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
|
|||||||
return <ProperBandoLabel status={rowData.status}/>;
|
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) => {
|
const actionsBodyTemplate = (rowData) => {
|
||||||
return <Link to={`/domande/${rowData.applicationId}/soccorso/${rowData.id}`}>
|
return <Link to={`/domande/${rowData.applicationId}/soccorso/${rowData.id}`}>
|
||||||
<Button severity="info" label={__('Dettagli', 'gepafin')} size="small" />
|
<Button severity="info" label={__('Dettagli', 'gepafin')} size="small" />
|
||||||
@@ -143,7 +158,7 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
|
|||||||
filters={filters}
|
filters={filters}
|
||||||
globalFilterFields={['name', 'status']}
|
globalFilterFields={['name', 'status']}
|
||||||
header={header}
|
header={header}
|
||||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
emptyMessage={translationStrings.emptyMessage}
|
||||||
onFilter={(e) => setFilters(e.filters)}>
|
onFilter={(e) => setFilters(e.filters)}>
|
||||||
<Column field="applicationId" header={__('ID domanda', 'gepafin')}
|
<Column field="applicationId" header={__('ID domanda', 'gepafin')}
|
||||||
filter filterPlaceholder={__('Cerca', 'gepafin')}
|
filter filterPlaceholder={__('Cerca', 'gepafin')}
|
||||||
@@ -163,7 +178,8 @@ const PreInstructorSoccorsiTable = ({ openDialogFn }) => {
|
|||||||
style={{ minWidth: '8rem' }}
|
style={{ minWidth: '8rem' }}
|
||||||
body={dateExpirationBodyTemplate} filter filterElement={dateFilterTemplate}/>
|
body={dateExpirationBodyTemplate} filter filterElement={dateFilterTemplate}/>
|
||||||
<Column field="status" header={__('Stato', 'gepafin')}
|
<Column field="status" header={__('Stato', 'gepafin')}
|
||||||
style={{ minWidth: '7rem' }} body={statusBodyTemplate} />
|
style={{ minWidth: '7rem' }} body={statusBodyTemplate} filter
|
||||||
|
filterElement={statusFilterTemplate} />
|
||||||
<Column header={__('Azioni', 'gepafin')}
|
<Column header={__('Azioni', 'gepafin')}
|
||||||
body={actionsBodyTemplate}/>
|
body={actionsBodyTemplate}/>
|
||||||
</DataTable>
|
</DataTable>
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import { Button } from 'primereact/button';
|
|||||||
import { Calendar } from 'primereact/calendar';
|
import { Calendar } from 'primereact/calendar';
|
||||||
import { Tag } from 'primereact/tag';
|
import { Tag } from 'primereact/tag';
|
||||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||||
|
import translationStrings from '../../../../translationStringsForComponents';
|
||||||
|
|
||||||
const AllUsersTable = () => {
|
const AllUsersTable = () => {
|
||||||
const users = useStore().main.users();
|
const users = useStore().main.users();
|
||||||
@@ -150,7 +151,7 @@ const AllUsersTable = () => {
|
|||||||
filters={filters}
|
filters={filters}
|
||||||
globalFilterFields={['name', 'status']}
|
globalFilterFields={['name', 'status']}
|
||||||
header={header}
|
header={header}
|
||||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
emptyMessage={translationStrings.emptyMessage}
|
||||||
onFilter={(e) => setFilters(e.filters)}>
|
onFilter={(e) => setFilters(e.filters)}>
|
||||||
<Column body={nameBodyTemplate}
|
<Column body={nameBodyTemplate}
|
||||||
header={__('Nome utente', 'gepafin')}
|
header={__('Nome utente', 'gepafin')}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import SoccorsoAddPreInstructor from './pages/SoccorsoAddPreInstructor';
|
|||||||
import DomandeBeneficiario from './pages/DomandeBeneficiario';
|
import DomandeBeneficiario from './pages/DomandeBeneficiario';
|
||||||
import DomandaBeneficiario from './pages/DomandaBeneficiario';
|
import DomandaBeneficiario from './pages/DomandaBeneficiario';
|
||||||
import BandoApplicationPreview from './pages/BandoApplicationPreview';
|
import BandoApplicationPreview from './pages/BandoApplicationPreview';
|
||||||
|
import BandiPreferredBeneficiario from './pages/BandiPreferredBeneficiario';
|
||||||
|
|
||||||
const routes = ({ role, chosenCompanyId }) => {
|
const routes = ({ role, chosenCompanyId }) => {
|
||||||
|
|
||||||
@@ -87,6 +88,11 @@ const routes = ({ role, chosenCompanyId }) => {
|
|||||||
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
|
{'ROLE_BENEFICIARY' === role ? <PageNotFound/> : null}
|
||||||
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
|
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
|
||||||
</DefaultLayout>}/>
|
</DefaultLayout>}/>
|
||||||
|
<Route path="/bandi-osservati" element={<DefaultLayout>
|
||||||
|
{'ROLE_SUPER_ADMIN' === role ? <PageNotFound/> : null}
|
||||||
|
{'ROLE_BENEFICIARY' === role ? <BandiPreferredBeneficiario/> : null}
|
||||||
|
{'ROLE_PRE_INSTRUCTOR' === role ? <PageNotFound/> : null}
|
||||||
|
</DefaultLayout>}/>
|
||||||
<Route path="/domande" element={<DefaultLayout>
|
<Route path="/domande" element={<DefaultLayout>
|
||||||
{'ROLE_SUPER_ADMIN' === role ? <Domande/> : null}
|
{'ROLE_SUPER_ADMIN' === role ? <Domande/> : null}
|
||||||
{'ROLE_BENEFICIARY' === role ? <DomandeBeneficiario/> : null}
|
{'ROLE_BENEFICIARY' === role ? <DomandeBeneficiario/> : null}
|
||||||
|
|||||||
@@ -35,4 +35,8 @@ export default class CompanyService {
|
|||||||
static deleteDelega = (id, callback, errCallback) => {
|
static deleteDelega = (id, callback, errCallback) => {
|
||||||
NetworkService.delete(`${API_BASE_URL}/company/${id}/delegation`, {}, callback, errCallback);
|
NetworkService.delete(`${API_BASE_URL}/company/${id}/delegation`, {}, callback, errCallback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static deleteCompany = (id, callback, errCallback) => {
|
||||||
|
NetworkService.delete(`${API_BASE_URL}/company/${id}`, {}, callback, errCallback);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,4 +11,8 @@ export default class PreferredBandoService {
|
|||||||
static deleteFromPreferred = (id, callback, errCallback) => {
|
static deleteFromPreferred = (id, callback, errCallback) => {
|
||||||
NetworkService.delete(`${API_BASE_URL}/beneficiaryPreferredCall/${id}`, {}, callback, errCallback);
|
NetworkService.delete(`${API_BASE_URL}/beneficiaryPreferredCall/${id}`, {}, callback, errCallback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static getPreferredCalls = (callback, errCallback, queryParams) => {
|
||||||
|
NetworkService.get(`${API_BASE_URL}/beneficiaryPreferredCall/user`, callback, errCallback, queryParams);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
16
src/translationStringsForComponents.js
Normal file
16
src/translationStringsForComponents.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
/* data table related */
|
||||||
|
import { __ } from '@wordpress/i18n';
|
||||||
|
|
||||||
|
const currentPageReportTemplate = '';
|
||||||
|
|
||||||
|
const emptyMessage = __('Nessun dato disponibile', 'gepafin');
|
||||||
|
|
||||||
|
const selectOneLabel = __('Seleziona', 'gepafin');
|
||||||
|
|
||||||
|
const translationStrings = {
|
||||||
|
currentPageReportTemplate,
|
||||||
|
emptyMessage,
|
||||||
|
selectOneLabel
|
||||||
|
}
|
||||||
|
|
||||||
|
export default translationStrings;
|
||||||
Reference in New Issue
Block a user