mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-08 15:58:18 +00:00
- Introduced multi-route functionality in the booking process, allowing users to add additional routes for general contracts. - Updated the StepDocuments component to display onboarding documents automatically attached to bookings. - Refactored Step4Route to manage extra routes and quantities dynamically. - Improved Step8Review to reflect the new onboarding document handling and updated submission readiness checks. - Added new API endpoints and services for managing contract route lines and rejecting bookings. - Removed the allowConsolidation field from the booking model as it is now managed by the system. - Created migrations for the new contract route lines table and updated related entities.
45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
import type { Freight } from "@edr/types";
|
|
import { client } from "../utils/api";
|
|
|
|
export type CreateBookingOrderPayload = Freight.CreateBookingOrderDto;
|
|
|
|
export const bookingOrdersService = {
|
|
/** Orders placed against a general contract. */
|
|
listByContract: async (
|
|
contractBookingId: string,
|
|
): Promise<Freight.IBookingOrder[]> => {
|
|
const { data } = await client.get("/api/booking-orders", {
|
|
params: { contractBookingId },
|
|
});
|
|
return data.data ?? data;
|
|
},
|
|
|
|
/** Contracted / ordered / remaining quantities for a general contract. */
|
|
pool: async (
|
|
contractBookingId: string,
|
|
): Promise<Freight.ContractQuantityLine[]> => {
|
|
const { data } = await client.get(
|
|
`/api/booking-orders/contract/${contractBookingId}/pool`,
|
|
);
|
|
return data.data ?? data;
|
|
},
|
|
|
|
/** Per-route contracted / ordered / remaining quantities (multi-route contracts). */
|
|
routes: async (
|
|
contractBookingId: string,
|
|
): Promise<Freight.ContractRouteLine[]> => {
|
|
const { data } = await client.get(
|
|
`/api/booking-orders/contract/${contractBookingId}/routes`,
|
|
);
|
|
return data.data ?? data;
|
|
},
|
|
|
|
/** Place a drawdown order against a contract. */
|
|
create: async (
|
|
payload: CreateBookingOrderPayload,
|
|
): Promise<Freight.IBookingOrder> => {
|
|
const { data } = await client.post("/api/booking-orders", payload);
|
|
return data.data ?? data;
|
|
},
|
|
};
|