- re added tables with pagination;

This commit is contained in:
Vitalii Kiiko
2025-03-31 16:14:27 +02:00
parent 16602129f9
commit 713af3ac32
34 changed files with 1225 additions and 420 deletions

View File

@@ -1,6 +1,6 @@
import React, { useState, useEffect, useCallback } from 'react';
import { __ } from '@wordpress/i18n';
import { is, pathOr, isEmpty } from 'ramda';
import { is } from 'ramda';
// store
import { useStore } from '../../../../store';
@@ -8,18 +8,22 @@ import { useStore } from '../../../../store';
// api
import ApplicationService from '../../../../service/application-service';
// tools
import getBandoLabel from '../../../../helpers/getBandoLabel';
import getBandoSeverity from '../../../../helpers/getBandoSeverity';
import getQueryParamsForPaginatedEndpoint from '../../../../helpers/getQueryParamsForPaginatedEndpoint';
// components
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
import { DataTable } from 'primereact/datatable';
import { Column } from 'primereact/column';
import { ProgressBar } from 'primereact/progressbar';
import { Button } from 'primereact/button';
import ProperBandoLabel from '../../../../components/ProperBandoLabel';
import { Link } from 'react-router-dom';
import translationStrings from '../../../../translationStringsForComponents';
import { Dropdown } from 'primereact/dropdown';
import { Tag } from 'primereact/tag';
import getBandoLabel from '../../../../helpers/getBandoLabel';
import getBandoSeverity from '../../../../helpers/getBandoSeverity';
import translationStrings from '../../../../translationStringsForComponents';
const DraftApplicationsTableAsync = () => {
const chosenCompanyId = useStore().main.chosenCompanyId();
@@ -41,34 +45,7 @@ const DraftApplicationsTableAsync = () => {
});
const statuses = ['DRAFT', 'AWAITING', 'READY'];
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);