mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-08 04:15:43 +00:00
export flow and fix intercity issue
This commit is contained in:
@@ -469,10 +469,18 @@ export const api = {
|
||||
),
|
||||
|
||||
getExportTrains: endpoint<
|
||||
{ bookingId: string; date: string },
|
||||
{
|
||||
bookingId: string;
|
||||
date: string;
|
||||
cargo?: {
|
||||
containerSizes?: string[];
|
||||
cargoTypeCode?: string;
|
||||
wagons?: number;
|
||||
};
|
||||
},
|
||||
Freight.ExportTrainOption[]
|
||||
>("train-scheduling", "exportTrains", ({ bookingId, date }) =>
|
||||
bookingsService.getExportTrains(bookingId, date),
|
||||
>("train-scheduling", "exportTrains", ({ bookingId, date, cargo }) =>
|
||||
bookingsService.getExportTrains(bookingId, date, cargo),
|
||||
),
|
||||
|
||||
getMyBookingWindows: endpoint<void, MyBookingWindow[]>(
|
||||
|
||||
@@ -510,13 +510,25 @@ export const bookingsService = {
|
||||
},
|
||||
|
||||
// Export train picker: the day's export trains with per-wagon-type free space.
|
||||
// The cargo params cover bare contract instances (nothing persisted yet) —
|
||||
// sizes/code/wagons come from what the customer is entering on the form.
|
||||
getExportTrains: async (
|
||||
bookingId: string,
|
||||
date: string,
|
||||
cargo?: { containerSizes?: string[]; cargoTypeCode?: string; wagons?: number },
|
||||
): Promise<Freight.ExportTrainOption[]> => {
|
||||
const { data } = await client.get(
|
||||
`/api/bookings/${bookingId}/export-trains`,
|
||||
{ params: { date } },
|
||||
{
|
||||
params: {
|
||||
date,
|
||||
...(cargo?.containerSizes?.length
|
||||
? { containerSizes: cargo.containerSizes.join(",") }
|
||||
: {}),
|
||||
...(cargo?.cargoTypeCode ? { cargoTypeCode: cargo.cargoTypeCode } : {}),
|
||||
...(cargo?.wagons ? { wagons: cargo.wagons } : {}),
|
||||
},
|
||||
},
|
||||
);
|
||||
return data.data as Freight.ExportTrainOption[];
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user