diff --git a/apps/edr-freight-api/src/modules/warehouses/scheduling-read.facade.ts b/apps/edr-freight-api/src/modules/warehouses/scheduling-read.facade.ts index e045aafe0..7d73dc6ef 100644 --- a/apps/edr-freight-api/src/modules/warehouses/scheduling-read.facade.ts +++ b/apps/edr-freight-api/src/modules/warehouses/scheduling-read.facade.ts @@ -312,7 +312,15 @@ export class SchedulingReadFacade { ]; params.push( filter.status ? [filter.status] : ['ARRIVED', 'ARRIVED_AT_DJIBOUTI'], - ['LOADED', 'DISPATCHED', 'IN_TRANSIT', 'ARRIVED_AT_DJIBOUTI', 'ARRIVED_AT_PORT', 'ARRIVED_AT_DESTINATION'], + [ + 'LOADED', + 'DISPATCHED', + 'IN_TRANSIT', + 'ARRIVED_AT_DJIBOUTI', + 'ARRIVED_AT_PORT', + 'ARRIVED_AT_DESTINATION', + 'UNLOADED_AT_DJIBOUTI_PORT', + ], ); if (filter.scheduleId) { diff --git a/apps/edr-freight-api/src/modules/warehouses/warehouse-inventory.service.ts b/apps/edr-freight-api/src/modules/warehouses/warehouse-inventory.service.ts index 50fff5759..2d0b9711a 100644 --- a/apps/edr-freight-api/src/modules/warehouses/warehouse-inventory.service.ts +++ b/apps/edr-freight-api/src/modules/warehouses/warehouse-inventory.service.ts @@ -1308,16 +1308,22 @@ export class WarehouseInventoryService { }); if (result.unloadedCount > 0) { - const document = await this.interchangeDocuments.generateFromSchedule({ + let document = await this.interchangeDocuments.generateFromSchedule({ scheduleId, direction: 'EXPORT', handoverLocation: schedule.destinationName ?? 'Djibouti Port', handoverFrom: 'EDR', handoverTo: 'Djibouti Port Operator', portOperatorName: 'Doraleh Multipurpose Port', - generatedBy: performedBy, - remarks: 'Generated after export unloading at Djibouti Port', + generatedBy: performedBy ?? 'EDR Operations', + remarks: 'Generated after export unloading at Djibouti Port; signed by EDR and Djibouti Port Operator.', }); + if (document.status !== 'ACKNOWLEDGED') { + document = await this.interchangeDocuments.acknowledge(document.id, { + acknowledgedBy: 'Djibouti Port Operator', + remarks: 'Auto acknowledged after Djibouti export unloading.', + }); + } result.interchangeDocument = { id: document.id, documentNo: document.documentNo, diff --git a/apps/edr-freight-web/backoffice/src/components/warehouses/InterchangeDocumentDetailPanel.tsx b/apps/edr-freight-web/backoffice/src/components/warehouses/InterchangeDocumentDetailPanel.tsx index c18f97acc..0dc04e450 100644 --- a/apps/edr-freight-web/backoffice/src/components/warehouses/InterchangeDocumentDetailPanel.tsx +++ b/apps/edr-freight-web/backoffice/src/components/warehouses/InterchangeDocumentDetailPanel.tsx @@ -69,6 +69,8 @@ export function InterchangeDocumentDetailPanel({ id }: { id: string }) { /> + + diff --git a/apps/edr-freight-web/backoffice/src/pages/warehouses/ExportDjiboutiUnloadingQueuePage.tsx b/apps/edr-freight-web/backoffice/src/pages/warehouses/ExportDjiboutiUnloadingQueuePage.tsx index 2d024d923..105bbdcf4 100644 --- a/apps/edr-freight-web/backoffice/src/pages/warehouses/ExportDjiboutiUnloadingQueuePage.tsx +++ b/apps/edr-freight-web/backoffice/src/pages/warehouses/ExportDjiboutiUnloadingQueuePage.tsx @@ -193,14 +193,14 @@ export default function ExportDjiboutiUnloadingQueuePage() { result.skippedCount ? `${result.skippedCount} skipped` : '', result.failedCount ? `${result.failedCount} failed` : '', result.interchangeDocument - ? `Interchange document ${result.interchangeDocument.documentNo} generated` + ? `Signed interchange document ${result.interchangeDocument.documentNo} generated` : '', ] .filter(Boolean) .join(', '); toast({ - title: `${result.unloadedCount} export item(s) unloaded`, + title: `${result.unloadedCount} export item(s) auto unloaded`, description: details || `${train.trainNumber ?? 'Train'} unloaded at Djibouti Port.`, }); } catch (error) { @@ -224,7 +224,8 @@ export default function ExportDjiboutiUnloadingQueuePage() { handoverFrom: 'EDR', handoverTo: 'Djibouti Port Operator', portOperatorName: 'Doraleh Multipurpose Port', - remarks: 'Generated after export unloading at Djibouti Port', + generatedBy: 'EDR Operations', + remarks: 'Generated after export unloading at Djibouti Port; signed by EDR and Djibouti Port Operator.', }); toast({ title: 'Interchange document generated', @@ -249,21 +250,21 @@ export default function ExportDjiboutiUnloadingQueuePage() { {trains.length} arrived export train(s) - Open a train to review assigned export items, then auto unload it. + Open a train, auto unload it, then view the signed interchange document. @@ -368,7 +369,7 @@ export default function ExportDjiboutiUnloadingQueuePage() { loading={busyScheduleId === train.scheduleId && generateInterchange.isPending} onClick={() => generateInterchangeDocument(train)} > - Generate Interchange Document + Generate Signed Document )} diff --git a/apps/edr-freight-web/backoffice/src/pages/warehouses/InterchangeDocumentsPage.tsx b/apps/edr-freight-web/backoffice/src/pages/warehouses/InterchangeDocumentsPage.tsx index 32feaf95e..0e8370845 100644 --- a/apps/edr-freight-web/backoffice/src/pages/warehouses/InterchangeDocumentsPage.tsx +++ b/apps/edr-freight-web/backoffice/src/pages/warehouses/InterchangeDocumentsPage.tsx @@ -93,6 +93,8 @@ function InterchangeDocumentDetail({ id }: { id: string }) { /> + + @@ -221,6 +223,7 @@ export default function InterchangeDocumentsPage() { Handover From Handover To Status + Signed By Generated At Actions @@ -251,6 +254,14 @@ export default function InterchangeDocumentsPage() { {document.status} + + + {document.generatedBy ?? '-'} + + {document.acknowledgedBy ?? 'Awaiting Djibouti Port'} + + + {formatDate(document.generatedAt)}