mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 22:18:12 +00:00
feat(warehouse,last-mile): truck load size rule, dedup last-mile, driver-required + arrival prefill
Truck loading: - loadTruck enforces max 2 containers / one 40ft (two 20ft) and auto-marks an assigned truck arrived on load; container-items payload + modal expose container size with a client-side selection cap. - Show "#x containers pending assignment" in the portal truck card and the backoffice container modal. Last-mile: - create() is idempotent — return the existing record for a booking instead of inserting a duplicate delivery row (fixed the same booking showing twice in Assign-Mile). - setVehicles/update reject a truck with no assigned driver; the Assign toast now surfaces the reason. - New GET /last-mile/booking/:id/arrival-trucks returns assigned EDR trucks with driver details; ReleaseOrderModal fetches and auto-fills them so an assigned EDR truck no longer reads as "not assigned yet". Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -71,6 +71,8 @@ export type ContainerItemStage = 'PENDING' | 'RECEIVED' | 'GRN' | 'ASSIGNED' | '
|
||||
export interface ContainerItem {
|
||||
containerNumber: string;
|
||||
goods: string | null;
|
||||
/** Container size, e.g. "20ft" / "40ft"; null for bulk. */
|
||||
containerSize: string | null;
|
||||
stage: ContainerItemStage;
|
||||
grnNumber: string | null;
|
||||
truckAssignmentId: string | null;
|
||||
@@ -126,6 +128,18 @@ const cleanParams = (params: object) =>
|
||||
Object.entries(params).filter(([, value]) => value !== undefined && value !== '' && value !== null),
|
||||
);
|
||||
|
||||
/** An assigned EDR last-mile truck, shaped for the arrival/exit weighing prefill. */
|
||||
export interface LastMileArrivalTruck {
|
||||
vehicleId: string;
|
||||
truckPlateNumber: string | null;
|
||||
trailerPlateNumber: string | null;
|
||||
driverName: string | null;
|
||||
driverLicense: string | null;
|
||||
driverPhone: string | null;
|
||||
truckType: string | null;
|
||||
containerNumber: string | null;
|
||||
}
|
||||
|
||||
export const warehouseService = {
|
||||
/** Customer self-haul trucks assigned to a booking (portal multi-truck). */
|
||||
getCustomerTrucks: async (bookingId: string): Promise<Freight.ICustomerTruck[]> => {
|
||||
@@ -133,6 +147,12 @@ export const warehouseService = {
|
||||
return data?.data ?? data ?? [];
|
||||
},
|
||||
|
||||
/** Assigned EDR last-mile trucks for a booking (arrival/exit weighing prefill). */
|
||||
getLastMileTrucks: async (bookingId: string): Promise<LastMileArrivalTruck[]> => {
|
||||
const { data } = await apiClient.get(`/last-mile/booking/${bookingId}/arrival-trucks`);
|
||||
return data?.data ?? data ?? [];
|
||||
},
|
||||
|
||||
/** Per-container/bulk items of a booking with lifecycle stage + refs. */
|
||||
getContainerItems: async (bookingId: string): Promise<ContainerItem[]> => {
|
||||
const { data } = await apiClient.get(
|
||||
|
||||
Reference in New Issue
Block a user