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 bef027c78..dd68c7006 100644 --- a/apps/edr-freight-web/portal/src/pages/accounts/CompanyProfileForm.tsx +++ b/apps/edr-freight-web/portal/src/pages/accounts/CompanyProfileForm.tsx @@ -343,13 +343,28 @@ export default function CompanyProfileForm({ // eslint-disable-next-line react-hooks/exhaustive-deps }, [contactSameAsGm, gmName, gmEmail, gmPhone]); + // The contact-person step has no location/address of its own, so the linked + // PoA takes the company's — location as entered, address as composed from the + // company's address fields. Both stay mirrored while the link is checked. + const companyLocation = watch("companyLocation"); + const companyAddress = watch("companyAddress"); + useEffect(() => { if (!poaSameAsContact) return; setValue("poaName", contactName ?? ""); setValue("poaEmail", contactEmail ?? ""); setValue("poaPhone", contactPhone ?? ""); + setValue("poaLocation", companyLocation ?? ""); + setValue("poaAddress", companyAddress ?? ""); // eslint-disable-next-line react-hooks/exhaustive-deps - }, [poaSameAsContact, contactName, contactEmail, contactPhone]); + }, [ + poaSameAsContact, + contactName, + contactEmail, + contactPhone, + companyLocation, + companyAddress, + ]); const toggleContactSameAsGm = (checked: boolean) => { setContactSameAsGm(checked); @@ -367,6 +382,8 @@ export default function CompanyProfileForm({ setValue("poaName", ""); setValue("poaEmail", ""); setValue("poaPhone", ""); + setValue("poaLocation", ""); + setValue("poaAddress", ""); } }; @@ -852,7 +869,7 @@ export default function CompanyProfileForm({ checked={poaSameAsContact} onToggle={togglePoaSameAsContact} title="Same as contact person" - description="Reuse the contact person's name, email and phone. Uncheck to enter different details." + description="Reuse the contact person's name, email and phone, plus the company's location and address. Uncheck to enter different details." /> )}