feat: enhance customs clearance process for forwarders

- Added  logic in  to determine if a company can clear its own customs.
- Updated  component to support upload-only mode for forwarders.
- Removed customs clearing agent fields from  and related schema.
- Introduced  component to handle customs clearing agent selection.
- Created  for viewing details of assigned bookings.
- Implemented  and modal for document uploads by forwarders.
- Updated API services to accommodate new customs clearing logic.
This commit is contained in:
marshal
2026-09-08 03:54:48 +00:00
parent 7c422ff600
commit 8314b3bd45
19 changed files with 977 additions and 286 deletions

View File

@@ -1183,7 +1183,7 @@ export class ContractsController {
@MixedAudience(FREIGHT_PERMS.contracts.createBooking)
@ApiOperation({
summary:
'Initiate a bare booking instance under an import/export contract (ONE_TIME or GENERAL) — no cargo, no date; enters per-booking clearance (AWAITING_DOCUMENTS). ONE_TIME customs instances are opened by the customer (or GL); GENERAL customs comes from a shipment request.',
'Initiate a bare booking instance under an import/export contract (ONE_TIME or GENERAL) — no cargo, no date; enters per-booking clearance (AWAITING_DOCUMENTS). A without-customs instance names its clearing agent here (transitAgentId, or the typed agent fields). ONE_TIME customs instances are opened by the customer (or GL); GENERAL customs comes from a shipment request.',
})
async initiateBooking(
@Param('id', ParseUUIDPipe) id: string,
@@ -1198,7 +1198,16 @@ export class ContractsController {
}
return this.contractBookingService.initiateUnderContract(
id,
{ contractRouteId: dto?.contractRouteId },
{
contractRouteId: dto?.contractRouteId,
// Who clears customs is named here, at initiation — the forwarder
// uploads the documents on the bare instance, so it must be on the
// job before that phase, not at completion.
transitAgentId: dto?.transitAgentId,
customsClearingAgent: dto?.customsClearingAgent,
customsClearingAgentEmail: dto?.customsClearingAgentEmail,
customsClearingAgentPhone: dto?.customsClearingAgentPhone,
},
{ id: user?.id ?? user?.sub },
user,
);