From 53dcb6af9ee8123803ffe78a9a5d6e53ef6bec4a Mon Sep 17 00:00:00 2001 From: Alexandre Brandizzi Date: Fri, 25 Sep 2026 19:36:09 -0300 Subject: [PATCH] fix(workorders): Site dialog hides per-contact notes when it edits the site record Site contacts carry only a name and a phone (LocationContact, and the Sites page contact rows), so PATCH contact-info has nowhere to put an additional contact's note. The Notes box on each additional contact card let a dispatcher type one under copy saying contacts are saved to the site record, but the note only reached this work order's copy and no other work order at the site ever saw it. The additional-contact Notes box is now hidden while the dialog edits the site record. It stays where contacts are saved to the work order only: inline create, the wizard, and an existing work order whose site record failed to load. --- .../table/cells/site-dialog-poc-section.tsx | 2 ++ .../_components/poc/poc-contact-fields.tsx | 24 ++++++++++++------- .../site-dialog-site-record.test.tsx | 24 +++++++++++++++++++ 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/src/app/(protected)/workorders/_components/list/table/cells/site-dialog-poc-section.tsx b/src/app/(protected)/workorders/_components/list/table/cells/site-dialog-poc-section.tsx index 9b81279d..806092b3 100644 --- a/src/app/(protected)/workorders/_components/list/table/cells/site-dialog-poc-section.tsx +++ b/src/app/(protected)/workorders/_components/list/table/cells/site-dialog-poc-section.tsx @@ -54,6 +54,8 @@ export function SiteDialogPocSection({ onPocNotesChange={onPocNotesChange} onAdditionalContactsChange={onAdditionalContactsChange} helperText={helperText(editsSiteRecord, siteRecordUnavailable)} + // Site contacts carry only a name and phone, so a per-contact note could never reach the site. + additionalContactNotes={!editsSiteRecord || siteRecordUnavailable} /> ); } diff --git a/src/app/(protected)/workorders/_components/poc/poc-contact-fields.tsx b/src/app/(protected)/workorders/_components/poc/poc-contact-fields.tsx index c12c2eab..548706c6 100644 --- a/src/app/(protected)/workorders/_components/poc/poc-contact-fields.tsx +++ b/src/app/(protected)/workorders/_components/poc/poc-contact-fields.tsx @@ -26,6 +26,8 @@ type PocContactFieldsProps = { showPrimaryErrors?: boolean; /** Labels the primary name/phone inputs with a persistent required asterisk. */ primaryRequired?: boolean; + /** Offers a Notes box on each additional contact; off where contacts save without per-contact notes. */ + additionalContactNotes?: boolean; }; function extraNameMissing(contact: WorkOrderAdditionalContact): boolean { @@ -49,11 +51,13 @@ function updateContactAt( function AdditionalPocCard({ contact, index, + showNotes, onChange, onRemove, }: { contact: WorkOrderAdditionalContact; index: number; + showNotes: boolean; onChange: (patch: Partial) => void; onRemove: () => void; }) { @@ -115,14 +119,16 @@ function AdditionalPocCard({ -