diff --git a/src/app/(protected)/workorders/_components/wizard/wizard-step-location-service-select.tsx b/src/app/(protected)/workorders/_components/wizard/wizard-step-location-service-select.tsx index 71d6ace7..0acc1014 100644 --- a/src/app/(protected)/workorders/_components/wizard/wizard-step-location-service-select.tsx +++ b/src/app/(protected)/workorders/_components/wizard/wizard-step-location-service-select.tsx @@ -28,18 +28,14 @@ export function WizardStepLocationServiceSelect({ onUpdate, onPatch, }: WizardStepLocationServiceSelectProps) { - const svcSel = [draft.pm, ...draft.extraServices].filter((p, i, a) => !!p && a.indexOf(p) === i); - const clearVendorIfPrimaryChanged = (nextPm: string): Partial => nextPm !== draft.pm ? { vendorId: "", vendorName: "", techPhone: "" } : {}; - const toggleSvc = (p: string) => { - const next = svcSel.includes(p) ? svcSel.filter((x) => x !== p) : [...svcSel, p]; - const nextPm = next[0] ?? ""; + const selectSvc = (p: string) => { onPatch({ - pm: nextPm, - extraServices: next.slice(1), - ...clearVendorIfPrimaryChanged(nextPm), + pm: p, + extraServices: [], + ...clearVendorIfPrimaryChanged(p), }); }; @@ -63,13 +59,7 @@ export function WizardStepLocationServiceSelect({ ), }; })} - onPick={(p) => - onPatch({ - pm: p, - extraServices: draft.extraServices.filter((x) => x !== p), - ...clearVendorIfPrimaryChanged(p), - }) - } + onPick={selectSvc} /> {!svcOpen ? (