From c75ed8f1490aed2033aad8f1bf55f07ab0041e79 Mon Sep 17 00:00:00 2001 From: ghost2023 Date: Mon, 10 Aug 2026 12:35:43 +0300 Subject: [PATCH] fix --- .../src/pages/accounts/CompanyProfileForm.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/apps/edr-freight-web/portal/src/pages/accounts/CompanyProfileForm.tsx b/apps/edr-freight-web/portal/src/pages/accounts/CompanyProfileForm.tsx index 5fd19fe4f..21956c9a1 100644 --- a/apps/edr-freight-web/portal/src/pages/accounts/CompanyProfileForm.tsx +++ b/apps/edr-freight-web/portal/src/pages/accounts/CompanyProfileForm.tsx @@ -769,7 +769,14 @@ export default function CompanyProfileForm({ // themselves, so there is no delegation to evidence. Mirrors the API's own // waiver in `assertPoaDelegationSatisfied` — the two must agree, or this // demands a file the server would accept the submission without. - const delegationRequired = (poaProvided || requirePoa) && !poaSameAsOwner; + // + // Split from `poaDue` — "there is a representative, so their details are + // owed" — because a self-PoA keeps the second while dropping the first. The + // API draws the same line (`poaDue` / `delegationDue` in + // getOnboardingRequirements); anything that is about the *details* must key + // on `poaDue`, only the paper keys on this. + const poaDue = poaProvided || requirePoa; + const delegationRequired = poaDue && !poaSameAsOwner; const delegationPresent = (uploadedDocumentKeys ?? []).includes(POA_DELEGATION_FILE_KEY) || (() => { @@ -853,9 +860,15 @@ export default function CompanyProfileForm({ // here. if (gmGaps.name) requiredKeys.push("generalManagerName"); if (gmGaps.phone) requiredKeys.push("generalManagerPhone"); - } else if (step === "poa" && delegationRequired) { + } else if (step === "poa" && poaDue) { // Only once a PoA is required or provided: an untouched optional PoA is // still a step the customer may walk straight past. + // + // `poaDue`, NOT `delegationRequired`: the paper is waived for a self-PoA + // but `REQUIRED_POA_FIELDS` is not, and the API reports every one of them + // missing (`missingPoaFields` keys on its own `poaDue`) — which fails the + // submit and clamps the resume back here. Keying this on the paper let the + // customer walk past an input this step had already put on screen. if (poaGaps.name) requiredKeys.push("poaName"); if (poaGaps.email) requiredKeys.push("poaEmail"); if (poaGaps.phone) requiredKeys.push("poaPhone");