feat: enhance booking flow with multi-route support and onboarding document integration

- Introduced multi-route functionality in the booking process, allowing users to add additional routes for general contracts.
- Updated the StepDocuments component to display onboarding documents automatically attached to bookings.
- Refactored Step4Route to manage extra routes and quantities dynamically.
- Improved Step8Review to reflect the new onboarding document handling and updated submission readiness checks.
- Added new API endpoints and services for managing contract route lines and rejecting bookings.
- Removed the allowConsolidation field from the booking model as it is now managed by the system.
- Created migrations for the new contract route lines table and updated related entities.
This commit is contained in:
Marshal
2026-06-23 20:40:48 +00:00
parent eb85f8d32d
commit 080a08229d
38 changed files with 1457 additions and 286 deletions

View File

@@ -387,7 +387,6 @@ export interface IBooking extends BaseEntity {
tradeDirection: "IMPORT" | "EXPORT";
paymentCurrency: string;
allowConsolidation: boolean;
consolidationPartnerId?: string | null;
startDate?: string | null;
@@ -430,7 +429,14 @@ export interface IBooking extends BaseEntity {
export interface PricingBreakdownLineItem {
code: string;
/** Computed line total (unitAmount × quantity). */
amount: number;
/** Price for a single unit of this charge (e.g. one 20ft container, one ton). */
unitAmount?: number;
/** Unit the rate is charged per: PER_CONTAINER | PER_TON | PER_WAGON | PER_KM | FLAT. */
unit?: string;
/** How many units this charge applies to (containers, tons, wagons; 1 for FLAT). */
quantity?: number;
currency: string;
description: string;
}
@@ -577,6 +583,14 @@ export interface CreateBookingContainerDto {
vgmPerUnitTons: number;
}
/** A contracted route+quantity line for a GENERAL contract. */
export interface CreateContractRouteDto {
originYardId: string;
destinationYardId: string;
containerTypeId?: string | undefined;
quantity: number;
}
export interface CreateBookingDto {
freightShapeValidation?: boolean | undefined;
reference?: string | undefined;
@@ -610,7 +624,8 @@ export interface CreateBookingDto {
endDate?: string | undefined;
financialTerms?: string | undefined;
containers?: CreateBookingContainerDto[];
allowConsolidation?: boolean;
/** GENERAL_CONTRACT only: routes the contract reserves quantity across. */
routes?: CreateContractRouteDto[];
}
// ── General Contracts & Booking Orders ──────────────────────────────────────────
@@ -651,9 +666,25 @@ export interface CreateBookingOrderLineDto {
quantity: number;
}
/** Per-route contracted / ordered / remaining pool line (multi-route contracts). */
export interface ContractRouteLine {
routeLineId: string;
originYardId: string;
originYardName?: string | null;
destinationYardId: string;
destinationYardName?: string | null;
containerTypeId?: string | null;
containerTypeName?: string | null;
contractedQuantity: number;
orderedQuantity: number;
remainingQuantity: number;
}
export interface CreateBookingOrderDto {
/** The general contract (booking) this order draws down from. */
contractBookingId: string;
/** For multi-route contracts: the route line being drawn from. */
routeLineId?: string;
/** The shipment day the customer wants for this order. */
scheduledDate: string;
lines: CreateBookingOrderLineDto[];