fix transi permit file upload

This commit is contained in:
marshal
2026-07-02 12:22:07 +03:00
parent 4fefe4f827
commit 56bb75c9a8
9 changed files with 271 additions and 123 deletions

View File

@@ -101,6 +101,26 @@ export function transitPermitFileLabel(code: string, index?: number): string {
return code;
}
export const LEGACY_EXPORT_TRANSPORT_CODE = "export_transport_document";
export function isExportTransportFileCode(code: string | null | undefined): boolean {
if (!code) return false;
const lower = code.toLowerCase();
return (
lower === LEGACY_EXPORT_TRANSPORT_CODE ||
lower.startsWith(`${LEGACY_EXPORT_TRANSPORT_CODE}_`)
);
}
export function exportTransportFileLabel(code: string, index?: number): string {
const lower = code.toLowerCase();
if (lower === LEGACY_EXPORT_TRANSPORT_CODE) return "Transit Permit";
if (lower.startsWith(`${LEGACY_EXPORT_TRANSPORT_CODE}_`)) {
return index != null ? `Transit permit ${index + 1}` : "Transit Permit";
}
return code;
}
export function catalogEntriesForTradeDirection(
tradeDirection: string,
): ClearanceWorkflowFileCatalogEntry[] {