This commit is contained in:
marshal
2026-09-08 22:05:09 +00:00
parent 788ce6e254
commit 54f76d4779
2 changed files with 82 additions and 8 deletions

View File

@@ -131,12 +131,12 @@ export function ForwarderDocumentReview({
const { clearance, customerDocs, canUpload, pending, adHoc, status } = flow;
const docNoun = bookingDocNoun(booking);
const reviewOpen = clearance.documentsOpen ?? canUpload;
// A phased (agent-cleared) booking advances through the clearance wizard
// approving the last document moves it on by itself, and the server refuses
// the plain finalize. Only a non-phased booking finalizes from here.
// An agent-cleared booking normally advances through the clearance wizard,
// but finalizing is still allowed once every document is approved: the
// remaining steps are closed as not applicable, for an agent that files
// with customs off the platform. The wizard stays the expected path.
const phased = Boolean(clearance.phase);
const canFinalize =
!phased && status === "DOCUMENTS_UNDER_REVIEW" && clearance.allApproved;
const canFinalize = status === "DOCUMENTS_UNDER_REVIEW" && clearance.allApproved;
const finalized = [
"CLEARANCE_READY",
"OPERATION_REQUEST_PENDING",
@@ -449,16 +449,22 @@ export function ForwarderDocumentReview({
Submit documents
</Button>
) : null}
{!finalized && !phased ? (
{!finalized ? (
<Button
color="edr-green"
radius="md"
variant={phased ? "light" : "filled"}
leftSection={<ShieldCheck size={16} />}
onClick={() => finalize.mutate()}
loading={finalize.isPending}
disabled={!canFinalize}
title={
phased
? "Closes the clearance now and marks the remaining steps as not applicable"
: undefined
}
>
Finalize clearance
{phased ? "Finalize without remaining steps" : "Finalize clearance"}
</Button>
) : null}
</Group>