- re added tables with pagination;
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React, { useEffect, useState, useCallback } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { is, isEmpty, pathOr } from 'ramda';
|
||||
import { is } from 'ramda';
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
|
||||
import translationStrings from '../../../../translationStringsForComponents';
|
||||
@@ -12,6 +12,7 @@ import ApplicationService from '../../../../service/application-service';
|
||||
import getBandoLabel from '../../../../helpers/getBandoLabel';
|
||||
import getBandoSeverity from '../../../../helpers/getBandoSeverity';
|
||||
import getFormattedDateString from '../../../../helpers/getFormattedDateString';
|
||||
import getQueryParamsForPaginatedEndpoint from '../../../../helpers/getQueryParamsForPaginatedEndpoint';
|
||||
|
||||
// components
|
||||
import { DataTable } from 'primereact/datatable';
|
||||
@@ -34,43 +35,17 @@ const AllDomandeTableAsync = ({ openDialogFn, updaterString = '' }) => {
|
||||
sortField: null,
|
||||
sortOrder: null,
|
||||
filters: {
|
||||
id: { value: null, matchMode: 'contains' },
|
||||
id: { value: null, matchMode: 'equals' },
|
||||
callTitle: { value: null, matchMode: 'contains' },
|
||||
companyName: { value: null, matchMode: 'contains' },
|
||||
submissionDate: { value: null, matchMode: 'date_is' },
|
||||
assignedUserName: { value: null, matchMode: 'equals' },
|
||||
status: { value: null, matchMode: 'equals' }
|
||||
}
|
||||
});
|
||||
const statuses = ['SUBMIT', 'EVALUATION', 'SOCCORSO'];
|
||||
const statuses = ['SUBMIT', 'EVALUATION', 'SOCCORSO', 'APPOINTMENT', 'NDG', 'ADMISSIBLE', 'TECHNICAL_EVALUATION'];
|
||||
|
||||
const getPaginationQuery = useCallback(() => {
|
||||
let sortBy = {
|
||||
columnName: "ID",
|
||||
sortDesc: true
|
||||
};
|
||||
|
||||
if (lazyState.sortField) {
|
||||
sortBy = {
|
||||
columnName: lazyState.sortField,
|
||||
sortDesc: lazyState.sortOrder === -1
|
||||
}
|
||||
}
|
||||
return {
|
||||
globalFilters: {
|
||||
page: lazyState.page ? lazyState.page + 1 : 1,
|
||||
limit: lazyState.rows,
|
||||
sortBy
|
||||
},
|
||||
status: statuses,
|
||||
filters: Object.keys(lazyState.filters).reduce((acc, cur) => {
|
||||
const value = pathOr('', ['filters', cur, 'value'], lazyState);
|
||||
if (!isEmpty(value)) {
|
||||
acc[cur] = lazyState.filters[cur];
|
||||
}
|
||||
return acc;
|
||||
}, {}),
|
||||
}
|
||||
}, [lazyState]);
|
||||
const getPaginationQuery = useCallback(() => getQueryParamsForPaginatedEndpoint(lazyState, statuses, 'id'), [lazyState]);
|
||||
|
||||
const onPage = (event) => {
|
||||
setLazyState(event);
|
||||
@@ -182,7 +157,7 @@ const AllDomandeTableAsync = ({ openDialogFn, updaterString = '' }) => {
|
||||
<Column field="id" header={__('ID domanda', 'gepafin')}
|
||||
sortable
|
||||
filterField="id" filter
|
||||
filterMatchModeOptions={translationStrings.textFilterOptions}
|
||||
filterMatchModeOptions={translationStrings.numberFilterOptions}
|
||||
filterPlaceholder={__('Cerca', 'gepafin')}
|
||||
style={{ minWidth: '6rem' }}/>
|
||||
<Column field="protocolNumber" header={__('Protocollo', 'gepafin')}
|
||||
@@ -204,6 +179,8 @@ const AllDomandeTableAsync = ({ openDialogFn, updaterString = '' }) => {
|
||||
style={{ minWidth: '8rem' }}
|
||||
body={dateAppliedBodyTemplate}/>
|
||||
<Column field="assignedUserName" header={__('Assegnato', 'gepafin')}
|
||||
filterField="assignedUserName" filter
|
||||
filterMatchModeOptions={translationStrings.textFilterOptions}
|
||||
style={{ minWidth: '8rem' }}/>
|
||||
<Column field="status" header={__('Stato', 'gepafin')}
|
||||
filterElement={statusFilterTemplate} filter
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { isEmpty, pathOr } from 'ramda';
|
||||
import NumberFlow from '@number-flow/react';
|
||||
|
||||
// api
|
||||
import UserService from '../../service/user-service';
|
||||
@@ -19,11 +20,8 @@ import { Dialog } from 'primereact/dialog';
|
||||
import { Button } from 'primereact/button';
|
||||
import { classNames } from 'primereact/utils';
|
||||
import { Dropdown } from 'primereact/dropdown';
|
||||
import NumberFlow from '@number-flow/react';
|
||||
/*import DraftApplicationsTableAsync from '../Dashboard/components/DraftApplicationsTableAsync';
|
||||
import AllDomandeTableAsync from './components/AllDomandeTableAsync';*/
|
||||
import DraftApplicationsTable from '../Dashboard/components/DraftApplicationsTable';
|
||||
import AllDomandeTable from './components/AllDomandeTable';
|
||||
import DraftApplicationsTableAsync from '../Dashboard/components/DraftApplicationsTableAsync';
|
||||
import AllDomandeTableAsync from './components/AllDomandeTableAsync';
|
||||
|
||||
const Domande = () => {
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -168,8 +166,7 @@ const Domande = () => {
|
||||
|
||||
<div className="appPageSection">
|
||||
<h2>{__('Domande pubblicate', 'gepafin')}</h2>
|
||||
{/*<AllDomandeTableAsync openDialogFn={openAssignDialog} updaterString={updaterString}/>*/}
|
||||
<AllDomandeTable openDialogFn={openAssignDialog} updaterString={updaterString}/>
|
||||
<AllDomandeTableAsync openDialogFn={openAssignDialog} updaterString={updaterString}/>
|
||||
</div>
|
||||
|
||||
<div className="appPage__spacer"></div>
|
||||
@@ -227,8 +224,7 @@ const Domande = () => {
|
||||
|
||||
<div className="appPageSection">
|
||||
<h2>{__('Domande in bozza', 'gepafin')}</h2>
|
||||
{/*<DraftApplicationsTableAsync/>*/}
|
||||
<DraftApplicationsTable/>
|
||||
<DraftApplicationsTableAsync/>
|
||||
</div>
|
||||
|
||||
<Dialog
|
||||
|
||||
Reference in New Issue
Block a user