mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
delivery approve notification
This commit is contained in:
@@ -1424,6 +1424,18 @@ export class BookingsService {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -108,6 +108,7 @@ export function ReadonlyBookingView({
|
||||
: status === "SELECTED_FOR_BATCH");
|
||||
const canApproveDelivery =
|
||||
status === "COMPLETED" ||
|
||||
Boolean(booking.handoverAwaitingSignature) ||
|
||||
(status === "TRUCK_ASSIGNED" && Boolean(booking.customerTruckArrivedAt));
|
||||
const usesCustomerTruck =
|
||||
booking.tradeDirection === "IMPORT"
|
||||
|
||||
@@ -521,6 +521,8 @@ export interface IBooking extends BaseEntity {
|
||||
customerTruckContainerNumber?: string | null;
|
||||
customerTruckAssignedAt?: string | null;
|
||||
customerTruckArrivedAt?: string | null;
|
||||
/** A handover has been generated for this booking and is awaiting the customer's signature. */
|
||||
handoverAwaitingSignature?: boolean;
|
||||
|
||||
customsClearingEnabled?: boolean;
|
||||
// (multi-truck self-haul lives in ICustomerTruck[], fetched via the
|
||||
|
||||
Reference in New Issue
Block a user