finilize gl flow for export

This commit is contained in:
Marshal
2026-07-02 17:55:59 +00:00
parent f77e4d150b
commit dd47068a4b
24 changed files with 2462 additions and 598 deletions

View File

@@ -40,6 +40,20 @@ export const CLEARANCE_WORKFLOW_FILE_CATALOG: ClearanceWorkflowFileCatalogEntry[
category: "djibouti",
tradeDirection: "IMPORT",
},
{
code: "final_invoice",
label: "Final Invoice",
uploadedBy: "gl_dj",
category: "djibouti",
tradeDirection: "EXPORT",
},
{
code: "final_invoice_slip",
label: "Final Invoice Payment Slip",
uploadedBy: "customer",
category: "djibouti",
tradeDirection: "EXPORT",
},
];
/** Legacy single-type declaration codes (still shown when already uploaded). */

View File

@@ -256,6 +256,57 @@ export interface ClearanceT1State {
closedAt?: string | null;
}
/** Train link state for the booking tied to a customs clearance flow. */
export interface ClearanceTrainState {
wagonAllocated: boolean;
departedAt: string | null;
arrivedAt: string | null;
}
/** Billing invoice `type` for the GL Djibouti post-offload final invoice. */
export const GL_FINAL_INVOICE_TYPE = "GL_FINAL";
/**
* Post-offload final invoice raised by GL Djibouti: customer pays offline and
* attaches a slip; GL (ET or DJ) confirms to mark it paid.
*/
export interface ClearanceFinalInvoiceSummary {
id: string;
invoiceNumber: string;
status: string;
totalAmount: number;
currency: string;
description?: string | null;
invoiceFile: { id: string; name: string; url: string } | null;
slipFile: { id: string; name: string; url: string } | null;
confirmedAt: string | null;
}
/** A customs booking riding a train schedule, as shown on the GL DJ schedules tab. */
export interface DjClearanceScheduleBooking {
bookingId: string;
reference: string;
tradeDirection: string;
contractId: string | null;
gatepassGranted: boolean;
gatepassAt: string | null;
}
/** Train schedule row for the GL Djibouti gate-pass table. */
export interface DjClearanceSchedule {
id: string;
trainNumber: string | null;
routeName: string | null;
origin: string | null;
destination: string | null;
status: string;
scheduledDepartureDate: string | null;
actualDepartureAt: string | null;
actualArrivalAt: string | null;
freightType: string | null;
customsBookings: DjClearanceScheduleBooking[];
}
export interface ContractClearanceView {
contractId: string;
/** Overall contract status (e.g. CLEARANCE_UNDER_REVIEW). */
@@ -299,6 +350,15 @@ export interface ContractClearanceView {
workflowFiles?: import("./clearance-files.catalog").ClearanceWorkflowFile[];
/** Import post-allocation T1 transit document state (null until a booking is linked). */
t1?: ClearanceT1State | null;
/** Train link state for the booking (both directions; null until a booking is linked). */
train?: ClearanceTrainState | null;
gatepassGranted?: boolean;
gatepassAt?: string | null;
t1Closed?: boolean;
t1ClosedAt?: string | null;
offloaded?: boolean;
/** GL Djibouti post-offload final invoice (export). */
finalInvoice?: ClearanceFinalInvoiceSummary | null;
}
export type ClearanceActorRole = "CUSTOMER" | "GL_ET" | "GL_DJ" | "OPERATIONS";
@@ -423,6 +483,7 @@ export const EXPORT_MILESTONES = [
"DEPARTED_TO_DJIBOUTI",
"ARRIVED_AT_DJIBOUTI",
"GATEPASS_GRANTED",
"T1_CLOSED",
"OFFLOADED",
] as const;

View File

@@ -557,6 +557,15 @@ export interface ClearanceView {
workflowFiles?: import("./clearance-files.catalog").ClearanceWorkflowFile[];
/** Import post-allocation T1 transit document state (null until wagon allocation). */
t1?: import("./contracts").ClearanceT1State | null;
/** Train link state for the booking (both directions). */
train?: import("./contracts").ClearanceTrainState | null;
gatepassGranted?: boolean;
gatepassAt?: string | null;
t1Closed?: boolean;
t1ClosedAt?: string | null;
offloaded?: boolean;
/** GL Djibouti post-offload final invoice (export). */
finalInvoice?: import("./contracts").ClearanceFinalInvoiceSummary | null;
}
/** Company an invoice is billed to (minimal projection). */