mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 23:28:11 +00:00
delivery approve notification
This commit is contained in:
@@ -1424,6 +1424,18 @@ export class BookingsService {
|
|||||||
schedule?.status ?? null;
|
schedule?.status ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A generated-but-unsigned handover means the customer must approve delivery.
|
||||||
|
// Surfaced so the portal shows "Approve delivery" as soon as the handover
|
||||||
|
// exists, independent of the truck-arrival flag.
|
||||||
|
const [pendingHandover] = await this.dataSource.query(
|
||||||
|
`SELECT 1 FROM freight.booking_handovers
|
||||||
|
WHERE booking_id = $1 AND signed_at IS NULL AND deleted_at IS NULL
|
||||||
|
LIMIT 1`,
|
||||||
|
[id],
|
||||||
|
);
|
||||||
|
(booking as Booking & { handoverAwaitingSignature?: boolean }).handoverAwaitingSignature =
|
||||||
|
Boolean(pendingHandover);
|
||||||
|
|
||||||
return booking;
|
return booking;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ export function ReadonlyBookingView({
|
|||||||
: status === "SELECTED_FOR_BATCH");
|
: status === "SELECTED_FOR_BATCH");
|
||||||
const canApproveDelivery =
|
const canApproveDelivery =
|
||||||
status === "COMPLETED" ||
|
status === "COMPLETED" ||
|
||||||
|
Boolean(booking.handoverAwaitingSignature) ||
|
||||||
(status === "TRUCK_ASSIGNED" && Boolean(booking.customerTruckArrivedAt));
|
(status === "TRUCK_ASSIGNED" && Boolean(booking.customerTruckArrivedAt));
|
||||||
const usesCustomerTruck =
|
const usesCustomerTruck =
|
||||||
booking.tradeDirection === "IMPORT"
|
booking.tradeDirection === "IMPORT"
|
||||||
|
|||||||
@@ -521,6 +521,8 @@ export interface IBooking extends BaseEntity {
|
|||||||
customerTruckContainerNumber?: string | null;
|
customerTruckContainerNumber?: string | null;
|
||||||
customerTruckAssignedAt?: string | null;
|
customerTruckAssignedAt?: string | null;
|
||||||
customerTruckArrivedAt?: string | null;
|
customerTruckArrivedAt?: string | null;
|
||||||
|
/** A handover has been generated for this booking and is awaiting the customer's signature. */
|
||||||
|
handoverAwaitingSignature?: boolean;
|
||||||
|
|
||||||
customsClearingEnabled?: boolean;
|
customsClearingEnabled?: boolean;
|
||||||
// (multi-truck self-haul lives in ICustomerTruck[], fetched via the
|
// (multi-truck self-haul lives in ICustomerTruck[], fetched via the
|
||||||
|
|||||||
Reference in New Issue
Block a user