- updated pre instructor table async - fixed proper date for filter;

This commit is contained in:
Vitalii Kiiko
2025-03-25 10:30:35 +01:00
parent ee7a0ef681
commit 431b9f5b45
7 changed files with 53 additions and 41 deletions

View File

@@ -8,10 +8,11 @@ import translationStrings from '../../../../translationStringsForComponents';
// api
import AmendmentsService from '../../../../service/amendments-service';
//
// tools
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';
@@ -36,41 +37,14 @@ const SoccorsiPreInstructorTableAsync = ({ userId = null }) => {
applicationId: { value: null, matchMode: 'contains' },
callName: { value: null, matchMode: 'contains' },
companyName: { value: null, matchMode: 'contains' },
startDate: { value: null, matchMode: 'date_is' },
expirationDate: { value: null, matchMode: 'date_is' },
startDate: { value: null, matchMode: 'dateIs' },
expirationDate: { value: null, matchMode: 'dateIs' },
status: { value: null, matchMode: 'equals' }
}
});
const statuses = [];
const getPaginationQuery = useCallback(() => {
let sortBy = {
columnName: 'applicationId',
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), [lazyState]);
const onPage = (event) => {
setLazyState(event);