mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-08 01:55:41 +00:00
feat: add pagination to schedule history and consolidation approvals
- Implemented pagination in ScheduleHistoryPanel to manage large history entries. - Updated API to support pagination parameters for schedule history. - Enhanced ConsolidationApprovalsPage with tabbed navigation and pagination for approval rows. - Introduced new types for paginated responses in bookings and train scheduling services. - Added a database migration to create an index on wagon_booking_allocations for performance improvements.
This commit is contained in:
@@ -583,6 +583,8 @@ export const bookingsService = {
|
||||
currency: string;
|
||||
action: "draft" | "send";
|
||||
file?: File | null;
|
||||
/** ISO date (YYYY-MM-DD); omit to fall back to the invoice's default 14-day term. */
|
||||
dueDate?: string | null;
|
||||
},
|
||||
): Promise<Freight.AdditionalCharge[]> => {
|
||||
const form = new FormData();
|
||||
@@ -590,6 +592,7 @@ export const bookingsService = {
|
||||
form.append("amount", String(payload.amount));
|
||||
form.append("currency", payload.currency);
|
||||
form.append("action", payload.action);
|
||||
if (payload.dueDate) form.append("dueDate", payload.dueDate);
|
||||
if (payload.file) form.append("file", payload.file);
|
||||
const response = await client.post(
|
||||
`/bookings/${id}/additional-charges`,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { api as client } from "../auth/http";
|
||||
import { unwrap } from "@/utils/endpoint";
|
||||
import { URL_CONSTANTS } from "@/constants/URLS";
|
||||
import type { OverviewLayoutKey } from "@/components/overview/role-dashboards.config";
|
||||
import type {
|
||||
IOverviewBillingTab,
|
||||
IOverviewBookingsTab,
|
||||
@@ -16,7 +17,19 @@ import type {
|
||||
|
||||
const O = URL_CONSTANTS.OVERVIEW;
|
||||
|
||||
/** Mirrors the API's OverviewLayoutDto — one entry per GET /overview/layouts item. */
|
||||
export interface IOverviewLayoutOption {
|
||||
key: OverviewLayoutKey;
|
||||
label: string;
|
||||
}
|
||||
|
||||
export const overviewService = {
|
||||
/** Layouts the caller has permission to render, in server priority order. */
|
||||
getLayouts: async (): Promise<IOverviewLayoutOption[]> => {
|
||||
const response = await client.get<IOverviewLayoutOption[]>(O.LAYOUTS);
|
||||
return unwrap(response);
|
||||
},
|
||||
|
||||
getDashboard: async (range?: OverviewRange): Promise<IOverviewDashboard> => {
|
||||
const response = await client.get<IOverviewDashboard>(O.BASE, {
|
||||
params: range ? { range } : undefined,
|
||||
|
||||
@@ -51,6 +51,10 @@ export interface WagonListFilters {
|
||||
/** Registration day range (YYYY-MM-DD), both ends inclusive. */
|
||||
createdFrom?: string;
|
||||
createdTo?: string;
|
||||
/** Last-maintenance day range (YYYY-MM-DD), both ends inclusive — matches
|
||||
* the latest status-log flip to MAINTENANCE, not a stored column. */
|
||||
maintenanceFrom?: string;
|
||||
maintenanceTo?: string;
|
||||
/** Only read by `getPaged`. */
|
||||
page?: number;
|
||||
pageSize?: number;
|
||||
@@ -67,6 +71,8 @@ const wagonListQuery = (filters: WagonListFilters): string => {
|
||||
if (filters.trainNumber) params.set('trainNumber', filters.trainNumber);
|
||||
if (filters.createdFrom) params.set('createdFrom', filters.createdFrom);
|
||||
if (filters.createdTo) params.set('createdTo', filters.createdTo);
|
||||
if (filters.maintenanceFrom) params.set('maintenanceFrom', filters.maintenanceFrom);
|
||||
if (filters.maintenanceTo) params.set('maintenanceTo', filters.maintenanceTo);
|
||||
if (filters.page) params.set('page', String(filters.page));
|
||||
if (filters.pageSize) params.set('pageSize', String(filters.pageSize));
|
||||
const qs = params.toString();
|
||||
|
||||
Reference in New Issue
Block a user