mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-08 18:18:18 +00:00
fix: reuse the locaiton too
This commit is contained in:
@@ -343,13 +343,28 @@ export default function CompanyProfileForm({
|
|||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [contactSameAsGm, gmName, gmEmail, gmPhone]);
|
}, [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(() => {
|
useEffect(() => {
|
||||||
if (!poaSameAsContact) return;
|
if (!poaSameAsContact) return;
|
||||||
setValue("poaName", contactName ?? "");
|
setValue("poaName", contactName ?? "");
|
||||||
setValue("poaEmail", contactEmail ?? "");
|
setValue("poaEmail", contactEmail ?? "");
|
||||||
setValue("poaPhone", contactPhone ?? "");
|
setValue("poaPhone", contactPhone ?? "");
|
||||||
|
setValue("poaLocation", companyLocation ?? "");
|
||||||
|
setValue("poaAddress", companyAddress ?? "");
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [poaSameAsContact, contactName, contactEmail, contactPhone]);
|
}, [
|
||||||
|
poaSameAsContact,
|
||||||
|
contactName,
|
||||||
|
contactEmail,
|
||||||
|
contactPhone,
|
||||||
|
companyLocation,
|
||||||
|
companyAddress,
|
||||||
|
]);
|
||||||
|
|
||||||
const toggleContactSameAsGm = (checked: boolean) => {
|
const toggleContactSameAsGm = (checked: boolean) => {
|
||||||
setContactSameAsGm(checked);
|
setContactSameAsGm(checked);
|
||||||
@@ -367,6 +382,8 @@ export default function CompanyProfileForm({
|
|||||||
setValue("poaName", "");
|
setValue("poaName", "");
|
||||||
setValue("poaEmail", "");
|
setValue("poaEmail", "");
|
||||||
setValue("poaPhone", "");
|
setValue("poaPhone", "");
|
||||||
|
setValue("poaLocation", "");
|
||||||
|
setValue("poaAddress", "");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -852,7 +869,7 @@ export default function CompanyProfileForm({
|
|||||||
checked={poaSameAsContact}
|
checked={poaSameAsContact}
|
||||||
onToggle={togglePoaSameAsContact}
|
onToggle={togglePoaSameAsContact}
|
||||||
title="Same as contact person"
|
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."
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<TextInput
|
<TextInput
|
||||||
|
|||||||
Reference in New Issue
Block a user