- added new role;

- added logic of statuses for amendment;
This commit is contained in:
Vitalii Kiiko
2024-12-20 17:09:49 +01:00
parent d38616fc48
commit 9c92d95a0e
17 changed files with 385 additions and 130 deletions

View File

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