Files
edr-platform/apps/edr-freight-web/portal/src/services/warehouse.service.ts
Hagernesh ed503f1e6b feat(portal): show warehouse location for arrived cargo
Display cargo warehouse location (warehouse, yard, zone, arrival time) on
the portal booking detail page once the cargo has been received and
assigned to a warehouse location.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-21 11:55:18 +00:00

57 lines
1.3 KiB
TypeScript

import { client } from "@/utils/api";
export interface InventoryFilter {
bookingId?: string;
}
export interface WarehouseInventoryItem {
id: string;
bookingId: string | null;
warehouseId: string;
yardId: string;
zoneId: string;
status: string;
arrivedAt: string | null;
warehouse?: {
id: string;
name: string;
code: string;
} | null;
yard?: {
id: string;
name: string;
code: string;
} | null;
zone?: {
id: string;
name: string;
code: string;
} | null;
}
export interface BookingScheduleView {
schedule: {
status: string;
scheduledDepartureDate: string | null;
scheduledArrivalDate: string | null;
} | null;
wagon?: {
wagonNumber: string | null;
sequenceNo: number | null;
} | null;
}
export const warehouseService = {
listInventory: async (filter?: InventoryFilter): Promise<WarehouseInventoryItem[]> => {
const { data } = await client.get("/warehouse-inventory", {
params: filter,
});
return data?.data ?? data ?? [];
},
bookingSchedule: async (bookingId: string): Promise<BookingScheduleView> => {
const { data } = await client.get(`/warehouse-inventory/booking-schedule/${bookingId}`);
return data?.data ?? data ?? { schedule: null, wagon: null };
},
};