update import gl flow

This commit is contained in:
Marshal
2026-07-02 13:27:59 +00:00
parent fe40d9f4be
commit fec2a5d320
12 changed files with 452 additions and 252 deletions

View File

@@ -33,6 +33,13 @@ export const CLEARANCE_WORKFLOW_FILE_CATALOG: ClearanceWorkflowFileCatalogEntry[
},
{ code: "delivery_order", label: "Delivery Order", uploadedBy: "gl_dj", category: "djibouti", tradeDirection: "IMPORT" },
{ code: "release_order", label: "Release Order", uploadedBy: "gl_dj", category: "djibouti", tradeDirection: "EXPORT" },
{
code: "t1_transport_document",
label: "T1 Transport Document",
uploadedBy: "gl_dj",
category: "djibouti",
tradeDirection: "IMPORT",
},
];
/** Legacy single-type declaration codes (still shown when already uploaded). */
@@ -101,6 +108,27 @@ export function transitPermitFileLabel(code: string, index?: number): string {
return code;
}
/** Legacy single T1 code (GL post-booking uploader). */
export const LEGACY_T1_TRANSPORT_CODE = "t1_transport_document";
/** Multi-file T1 transport uploads use `t1_transport_document_0`, `_1`, … */
export const T1_TRANSPORT_FILE_PREFIX = "t1_transport_document_";
export function isT1TransportFileCode(code: string | null | undefined): boolean {
if (!code) return false;
const lower = code.toLowerCase();
return lower === LEGACY_T1_TRANSPORT_CODE || lower.startsWith(T1_TRANSPORT_FILE_PREFIX);
}
export function t1TransportFileLabel(code: string, index?: number): string {
const lower = code.toLowerCase();
if (lower === LEGACY_T1_TRANSPORT_CODE) return "T1 Transport Document";
if (lower.startsWith(T1_TRANSPORT_FILE_PREFIX)) {
return index != null ? `T1 transport document ${index + 1}` : "T1 Transport Document";
}
return code;
}
export const LEGACY_EXPORT_TRANSPORT_CODE = "export_transport_document";
export function isExportTransportFileCode(code: string | null | undefined): boolean {

View File

@@ -242,6 +242,20 @@ export interface ContractClearanceDocument {
reviewedByStaffId?: string | null;
}
/**
* Post-allocation T1 transit document state for the booking linked to an import
* customs flow. GL Djibouti uploads after wagon allocation; uploads lock once the
* train departs; GL Ethiopia closes (accepts) T1 when the train arrives.
*/
export interface ClearanceT1State {
bookingId: string;
wagonAllocated: boolean;
trainDepartedAt: string | null;
trainArrivedAt: string | null;
closed: boolean;
closedAt?: string | null;
}
export interface ContractClearanceView {
contractId: string;
/** Overall contract status (e.g. CLEARANCE_UNDER_REVIEW). */
@@ -283,6 +297,8 @@ export interface ContractClearanceView {
} | null;
/** Phased customs uploads (IM4, DO, transit permit, etc.) with friendly labels. */
workflowFiles?: import("./clearance-files.catalog").ClearanceWorkflowFile[];
/** Import post-allocation T1 transit document state (null until a booking is linked). */
t1?: ClearanceT1State | null;
}
export type ClearanceActorRole = "CUSTOMER" | "GL_ET" | "GL_DJ" | "OPERATIONS";

View File

@@ -548,6 +548,8 @@ export interface ClearanceView {
} | null;
/** Phased customs uploads (IM4, DO, transit permit, etc.) with friendly labels. */
workflowFiles?: import("./clearance-files.catalog").ClearanceWorkflowFile[];
/** Import post-allocation T1 transit document state (null until wagon allocation). */
t1?: import("./contracts").ClearanceT1State | null;
}
/** Company an invoice is billed to (minimal projection). */