mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 15:30:56 +00:00
finilize gl
This commit is contained in:
@@ -23,11 +23,34 @@ export const CLEARANCE_WORKFLOW_FILE_CATALOG: ClearanceWorkflowFileCatalogEntry[
|
||||
{ code: "ex8", label: "EX8 Declaration", uploadedBy: "gl_et", category: "declaration", tradeDirection: "EXPORT" },
|
||||
{ code: "duty_tax_notice", label: "Duty / Tax Notice", uploadedBy: "gl_et", category: "duty" },
|
||||
{ code: "duty_tax_receipt", label: "Duty / Tax Payment Slip", uploadedBy: "customer", category: "duty" },
|
||||
{ code: "transit_permitted", label: "Transit Permit", uploadedBy: "gl_et", category: "transit" },
|
||||
{ code: "transit_permitted", label: "Transit Permit", uploadedBy: "gl_et", category: "transit", tradeDirection: "IMPORT" },
|
||||
{
|
||||
code: "export_transport_document",
|
||||
label: "Transit Permit",
|
||||
uploadedBy: "gl_et",
|
||||
category: "transit",
|
||||
tradeDirection: "EXPORT",
|
||||
},
|
||||
{ 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" },
|
||||
];
|
||||
|
||||
/** Legacy single-type declaration codes (still shown when already uploaded). */
|
||||
export const LEGACY_DECLARATION_FILE_CODES = ["im4", "im5", "ex3", "ex8"] as const;
|
||||
|
||||
/** Multi-file declaration uploads use `declaration_0`, `declaration_1`, … */
|
||||
export const DECLARATION_FILE_PREFIX = "declaration_";
|
||||
|
||||
export function isDeclarationFileCode(code: string | null | undefined): boolean {
|
||||
if (!code) return false;
|
||||
const lower = code.toLowerCase();
|
||||
return (
|
||||
(LEGACY_DECLARATION_FILE_CODES as readonly string[]).includes(lower) ||
|
||||
lower === "declaration" ||
|
||||
lower.startsWith(DECLARATION_FILE_PREFIX)
|
||||
);
|
||||
}
|
||||
|
||||
export interface ClearanceWorkflowFile {
|
||||
code: string;
|
||||
label: string;
|
||||
@@ -45,6 +68,39 @@ export function clearanceWorkflowFileLabel(code: string | null | undefined): str
|
||||
return CATALOG_BY_CODE.get(code)?.label ?? null;
|
||||
}
|
||||
|
||||
export function declarationFileLabel(code: string, index?: number): string {
|
||||
const lower = code.toLowerCase();
|
||||
const legacy = CATALOG_BY_CODE.get(lower);
|
||||
if (legacy?.category === "declaration") return legacy.label;
|
||||
if (lower.startsWith(DECLARATION_FILE_PREFIX) || lower === "declaration") {
|
||||
return index != null ? `Declaration document ${index + 1}` : "Customs declaration";
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
/** Legacy single import transit permit code. */
|
||||
export const LEGACY_IMPORT_TRANSIT_PERMIT_CODE = "transit_permitted";
|
||||
|
||||
/** Multi-file import transit permit uploads use `transit_permit_0`, `transit_permit_1`, … */
|
||||
export const TRANSIT_PERMIT_FILE_PREFIX = "transit_permit_";
|
||||
|
||||
export function isImportTransitPermitFileCode(code: string | null | undefined): boolean {
|
||||
if (!code) return false;
|
||||
const lower = code.toLowerCase();
|
||||
return (
|
||||
lower === LEGACY_IMPORT_TRANSIT_PERMIT_CODE || lower.startsWith(TRANSIT_PERMIT_FILE_PREFIX)
|
||||
);
|
||||
}
|
||||
|
||||
export function transitPermitFileLabel(code: string, index?: number): string {
|
||||
const lower = code.toLowerCase();
|
||||
if (lower === LEGACY_IMPORT_TRANSIT_PERMIT_CODE) return "Transit Permit";
|
||||
if (lower.startsWith(TRANSIT_PERMIT_FILE_PREFIX)) {
|
||||
return index != null ? `Transit permit ${index + 1}` : "Transit Permit";
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
export function catalogEntriesForTradeDirection(
|
||||
tradeDirection: string,
|
||||
): ClearanceWorkflowFileCatalogEntry[] {
|
||||
|
||||
@@ -272,6 +272,9 @@ export interface ContractClearanceView {
|
||||
roAmendmentRequestedAt?: string | null;
|
||||
bookingReady?: boolean;
|
||||
preClearanceFinalized?: boolean;
|
||||
/** Export post-booking clearance finalized after transit permit upload. */
|
||||
exportClearanceFinalized?: boolean;
|
||||
linkedBookingId?: string | null;
|
||||
dutyAdvice?: {
|
||||
amount: number;
|
||||
currency: string;
|
||||
|
||||
Reference in New Issue
Block a user