- re added tables with pagination;
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import React, { useEffect, useState, useCallback } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { isEmpty, pathOr } from 'ramda';
|
||||
|
||||
import translationStrings from '../../../../translationStringsForComponents';
|
||||
|
||||
@@ -13,6 +12,7 @@ import getTimeFromISOstring from '../../../../helpers/getTimeFromISOstring';
|
||||
import getFormattedDateString from '../../../../helpers/getFormattedDateString';
|
||||
import getBandoLabel from '../../../../helpers/getBandoLabel';
|
||||
import getBandoSeverity from '../../../../helpers/getBandoSeverity';
|
||||
import getQueryParamsForPaginatedEndpoint from '../../../../helpers/getQueryParamsForPaginatedEndpoint';
|
||||
|
||||
// components
|
||||
import { DataTable } from 'primereact/datatable';
|
||||
@@ -41,34 +41,7 @@ const LatestBandiTableInstructorManagerAsync = () => {
|
||||
});
|
||||
const statuses = ['PUBLISH'];
|
||||
|
||||
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);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useEffect, useState, useCallback } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { head, is, isEmpty, pathOr } from 'ramda';
|
||||
import { head, is } from 'ramda';
|
||||
import { klona } from 'klona';
|
||||
|
||||
import translationStrings from '../../../../translationStringsForComponents';
|
||||
@@ -25,6 +25,7 @@ import { Tag } from 'primereact/tag';
|
||||
import { Calendar } from 'primereact/calendar';
|
||||
import { Button } from 'primereact/button';
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
import getQueryParamsForPaginatedEndpoint from '../../../../helpers/getQueryParamsForPaginatedEndpoint';
|
||||
|
||||
|
||||
const APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
||||
@@ -48,38 +49,11 @@ const MieDomandeTableInstructorManagerAsync = ({ userId = null, statuses = [] })
|
||||
companyName: { value: null, matchMode: 'contains' },
|
||||
submissionDate: { value: null, matchMode: 'date_is' },
|
||||
evaluationEndDate: { value: null, matchMode: 'date_is' },
|
||||
status: { value: null, matchMode: 'equals' }
|
||||
applicationStatus: { value: null, matchMode: 'equals' }
|
||||
}
|
||||
});
|
||||
|
||||
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, 'applicationId'), [lazyState]);
|
||||
|
||||
const onPage = (event) => {
|
||||
setLazyState(event);
|
||||
@@ -121,7 +95,7 @@ const MieDomandeTableInstructorManagerAsync = ({ userId = null, statuses = [] })
|
||||
};
|
||||
|
||||
const statusBodyTemplate = (rowData) => {
|
||||
return <ProperBandoLabel status={rowData.status}/>;
|
||||
return <ProperBandoLabel status={rowData.applicationStatus}/>;
|
||||
};
|
||||
|
||||
const statusItemTemplate = (option) => {
|
||||
|
||||
Reference in New Issue
Block a user