- updated table of appl's ready to be evaluated;
This commit is contained in:
@@ -37,49 +37,49 @@ const AppSidebar = () => {
|
||||
label: __('Gestione Domande', 'gepafin'),
|
||||
icon: 'pi pi-file',
|
||||
href: '/domande',
|
||||
id: 5,
|
||||
id: 4,
|
||||
enable: intersection(permissions, ['VIEW_USERS', 'MANAGE_USERS']).length
|
||||
},
|
||||
{
|
||||
label: __('Bandi disponibili', 'gepafin'),
|
||||
icon: 'pi pi-bookmark',
|
||||
href: '/bandi',
|
||||
id: 4,
|
||||
id: 5,
|
||||
enable: intersection(permissions, ['VIEW_CALLS']).length
|
||||
},
|
||||
{
|
||||
label: __('Domande da valutare', 'gepafin'),
|
||||
icon: 'pi pi-calendar-clock',
|
||||
href: '/valutazioni',
|
||||
id: 4,
|
||||
id: 6,
|
||||
enable: intersection(permissions, ['EVALUATE_APPLICATIONS']).length
|
||||
},
|
||||
{
|
||||
label: __('Gestione Utenti', 'gepafin'),
|
||||
icon: 'pi pi-users',
|
||||
href: '/utenti',
|
||||
id: 5,
|
||||
id: 7,
|
||||
enable: intersection(permissions, ['VIEW_USERS', 'MANAGE_USERS']).length
|
||||
},
|
||||
{
|
||||
label: __('Configurazione', 'gepafin'),
|
||||
icon: 'pi pi-cog',
|
||||
//href: '/configurazione',
|
||||
id: 6,
|
||||
id: 8,
|
||||
enable: false
|
||||
},
|
||||
{
|
||||
label: __('Report e Analisi', 'gepafin'),
|
||||
icon: 'pi pi-chart-bar',
|
||||
//href: '/stats',
|
||||
id: 7,
|
||||
id: 9,
|
||||
enable: false
|
||||
},
|
||||
{
|
||||
label: __('Log di Sistema', 'gepafin'),
|
||||
icon: 'pi pi-receipt',
|
||||
clickFn: () => {},
|
||||
id: 8,
|
||||
id: 10,
|
||||
enable: false
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
import React, { useState, useEffect} from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { is, uniq } from 'ramda';
|
||||
|
||||
// store
|
||||
import { useStore } from '../../../../store';
|
||||
|
||||
// tools
|
||||
//import set404FromErrorResponse from '../../../../helpers/set404FromErrorResponse';
|
||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||
//import { storeSet, storeGet } from '../../../../store';
|
||||
|
||||
// api
|
||||
//import ApplicationService from '../../../../service/application-service';
|
||||
import ApplicationService from '../../../../service/application-service';
|
||||
|
||||
// components
|
||||
import { FilterMatchMode, FilterOperator } from 'primereact/api';
|
||||
@@ -21,57 +17,39 @@ import { IconField } from 'primereact/iconfield';
|
||||
import { InputIcon } from 'primereact/inputicon';
|
||||
import { Button } from 'primereact/button';
|
||||
import { Calendar } from 'primereact/calendar';
|
||||
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
|
||||
|
||||
|
||||
const MyEvaluationsTable = () => {
|
||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||
const [items, setItems] = useState(null);
|
||||
const [filters, setFilters] = useState(null);
|
||||
const [localAsyncRequest, setLocalAsyncRequest] = useState(false);
|
||||
const [globalFilterValue, setGlobalFilterValue] = useState('');
|
||||
const [statuses, setStatuses] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
const demoItems = [
|
||||
{
|
||||
id: 1,
|
||||
callTitle: 'Bando 1',
|
||||
appliedDate: '2024-10-01',
|
||||
callEndDate: '2025-11-25',
|
||||
status: 'AWAITING'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
callTitle: 'Bando 2',
|
||||
appliedDate: '2024-08-11',
|
||||
callEndDate: '2027-09-23',
|
||||
status: 'AWAITING'
|
||||
}
|
||||
];
|
||||
setItems(getFormattedData(demoItems));
|
||||
/*storeSet.main.setAsyncRequest();
|
||||
ApplicationService.getApplications(getApplCallback, errGetApplCallback)*/
|
||||
setLocalAsyncRequest(true);
|
||||
ApplicationService.getApplications(getCallback, errGetCallbacks, [['status', 'ASSIGNED']]);
|
||||
}, []);
|
||||
|
||||
/*const getApplCallback = (data) => {
|
||||
const getCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
if (data.data.length) {
|
||||
setItems(getFormattedBandiData(data.data));
|
||||
setStatuses(uniq(items.map(o => o.status)))
|
||||
setItems(getFormattedData(data.data));
|
||||
setStatuses(uniq(data.data.map(o => o.status)))
|
||||
initFilters();
|
||||
}
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
setLocalAsyncRequest(false);
|
||||
}
|
||||
|
||||
const errGetApplCallback = (data) => {
|
||||
set404FromErrorResponse(data);
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
}*/
|
||||
const errGetCallbacks = (data) => {
|
||||
setLocalAsyncRequest(false);
|
||||
}
|
||||
|
||||
const getFormattedData = (data) => {
|
||||
return [...(data || [])].map((d) => {
|
||||
d.appliedDate = new Date(d.appliedDate);
|
||||
d.callEndDate = new Date(d.callEndDate);
|
||||
|
||||
return data.map((d) => {
|
||||
d.callEndDate = is(String, d.callEndDate) ? new Date(d.callEndDate) : (d.callEndDate ? d.callEndDate : '');
|
||||
d.modifiedDate = is(String, d.modifiedDate) ? new Date(d.modifiedDate) : (d.modifiedDate ? d.modifiedDate : '');
|
||||
d.submissionDate = is(String, d.submissionDate) ? new Date(d.submissionDate) : (d.submissionDate ? d.submissionDate : '');
|
||||
return d;
|
||||
});
|
||||
};
|
||||
@@ -120,19 +98,17 @@ const MyEvaluationsTable = () => {
|
||||
const renderHeader = () => {
|
||||
return (
|
||||
<div className="appTableHeader">
|
||||
<Button type="button" icon="pi pi-filter-slash" label={__('Pulisci', 'gepafin')} outlined
|
||||
onClick={clearFilter}/>
|
||||
<Button type="button" icon="pi pi-filter-slash" label={__('Pulisci', 'gepafin')} outlined onClick={clearFilter} />
|
||||
<IconField iconPosition="left">
|
||||
<InputIcon className="pi pi-search" />
|
||||
<InputText value={globalFilterValue} onChange={onGlobalFilterChange}
|
||||
placeholder={__('Cerca', 'gepafin')}/>
|
||||
<InputText value={globalFilterValue} onChange={onGlobalFilterChange} placeholder={__('Cerca', 'gepafin')} />
|
||||
</IconField>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const dateAppliedBodyTemplate = (rowData) => {
|
||||
return formatDate(rowData.appliedDate);
|
||||
return formatDate(rowData.submissionDate);
|
||||
};
|
||||
|
||||
const dateEndBodyTemplate = (rowData) => {
|
||||
@@ -140,8 +116,7 @@ const MyEvaluationsTable = () => {
|
||||
};
|
||||
|
||||
const dateFilterTemplate = (options) => {
|
||||
return <Calendar value={options.value} onChange={(e) => options.filterCallback(e.value, options.index)}
|
||||
dateFormat="mm/dd/yy" placeholder="mm/dd/yyyy" mask="99/99/9999"/>;
|
||||
return <Calendar value={options.value} onChange={(e) => options.filterCallback(e.value, options.index)} dateFormat="mm/dd/yy" placeholder="mm/dd/yyyy" mask="99/99/9999" />;
|
||||
};
|
||||
|
||||
const statusBodyTemplate = (rowData) => {
|
||||
@@ -149,28 +124,31 @@ const MyEvaluationsTable = () => {
|
||||
};
|
||||
|
||||
const actionsBodyTemplate = (rowData) => {
|
||||
return <Link to={`/valutazioni/${rowData.id}`}>
|
||||
<Button type="button"
|
||||
severity="info"
|
||||
return <Button severity="info"
|
||||
onClick={() => createEvaluation(rowData.id)}
|
||||
label={__('Valuta', 'gepafin')}
|
||||
size="small"/>
|
||||
</Link>
|
||||
icon="pi pi-pencil" size="small" iconPos="right" />
|
||||
}
|
||||
|
||||
const header = renderHeader();
|
||||
|
||||
const createEvaluation = (id) => {
|
||||
console.log('createEvaluation:', id)
|
||||
}
|
||||
|
||||
return(
|
||||
<div className="appPageSection__table">
|
||||
<DataTable value={items} paginator showGridlines rows={10} loading={isAsyncRequest} dataKey="id"
|
||||
<DataTable value={items} paginator showGridlines rows={10} loading={localAsyncRequest} dataKey="id"
|
||||
filters={filters}
|
||||
globalFilterFields={['name', 'status']}
|
||||
header={header}
|
||||
emptyMessage={__('Nessun dato disponibile', 'gepafin')}
|
||||
onFilter={(e) => setFilters(e.filters)}>
|
||||
<Column field="id" header={__('ID domanda', 'gepafin')}
|
||||
style={{ minWidth: '2rem' }}/>
|
||||
filter filterPlaceholder={__('Cerca', 'gepafin')}
|
||||
style={{ minWidth: '12rem' }}/>
|
||||
<Column field="callTitle" header={__('Bando', 'gepafin')}
|
||||
filter filterPlaceholder={__('Cerca il nome', 'gepafin')}
|
||||
filter filterPlaceholder={__('Cerca', 'gepafin')}
|
||||
style={{ minWidth: '12rem' }}/>
|
||||
<Column header={__('Data Ricezione', 'gepafin')} filterField="modifiedDate" dataType="date"
|
||||
style={{ minWidth: '10rem' }}
|
||||
|
||||
@@ -127,7 +127,7 @@ const AllDomandeTable = ({ openDialogFn }) => {
|
||||
const actionsBodyTemplate = (rowData) => {
|
||||
return <Button severity="info"
|
||||
onClick={() => openDialogFn(rowData.id)}
|
||||
label={__('Assign', 'gepafin')}
|
||||
label={__('Assegnare', 'gepafin')}
|
||||
icon="pi pi-pencil" size="small" iconPos="right" />
|
||||
}
|
||||
|
||||
@@ -147,10 +147,12 @@ const AllDomandeTable = ({ openDialogFn }) => {
|
||||
<Column field="callTitle" header={__('Bando', 'gepafin')}
|
||||
filter filterPlaceholder={__('Cerca', 'gepafin')}
|
||||
style={{ minWidth: '12rem' }}/>
|
||||
<Column header={__('Data Ricezione', 'gepafin')} filterField="modifiedDate" dataType="date"
|
||||
<Column header={__('Data Ricezione', 'gepafin')}
|
||||
filterField="modifiedDate" dataType="date"
|
||||
style={{ minWidth: '10rem' }}
|
||||
body={dateAppliedBodyTemplate} filter filterElement={dateFilterTemplate}/>
|
||||
<Column header={__('Scadenza', 'gepafin')} filterField="callEndDate" dataType="date"
|
||||
<Column header={__('Scadenza', 'gepafin')}
|
||||
filterField="callEndDate" dataType="date"
|
||||
style={{ minWidth: '10rem' }}
|
||||
body={dateEndBodyTemplate} filter filterElement={dateFilterTemplate}/>
|
||||
<Column field="status" header={__('Stato', 'gepafin')}
|
||||
|
||||
Reference in New Issue
Block a user