From 08dda8bab367d25ab37a8dc9bbdddeef816736a7 Mon Sep 17 00:00:00 2001 From: Thomas Joise Date: Fri, 17 Jul 2026 13:57:45 +0530 Subject: [PATCH] fix(hq-web): edit dialogs clear blanked optional fields (follow-up, outcome, plan amount) Co-Authored-By: Claude Opus 4.8 (1M context) --- apps/hq-web/src/pages/client-forms.tsx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/apps/hq-web/src/pages/client-forms.tsx b/apps/hq-web/src/pages/client-forms.tsx index 24632ed..e652ec9 100644 --- a/apps/hq-web/src/pages/client-forms.tsx +++ b/apps/hq-web/src/pages/client-forms.tsx @@ -72,7 +72,11 @@ export function PlanDialog(props: { setSaving(true) const body = { clientModuleId: f.clientModuleId, cadence: f.cadence, nextRun: f.nextRun, policy: f.policy, - ...(amount !== undefined ? { amountPaise: fromRupees(amount) } : {}), + // Edit mode: blank means "revert to price book" — send an explicit null so it clears. + // Create mode: blank just omits the override, letting the price book resolve at generation time. + ...(editing + ? { amountPaise: amount !== undefined ? fromRupees(amount) : null } + : amount !== undefined ? { amountPaise: fromRupees(amount) } : {}), } const call = editing ? updateRecurringPlan(props.initial!.id, body) : createRecurringPlan(props.clientId, body) call @@ -219,8 +223,14 @@ export function InteractionDialog(props: { setSaving(true) const body = { typeCode: f.typeCode, onDate: f.onDate, notes: f.notes, - ...(f.outcome !== '' ? { outcome: f.outcome } : {}), - ...(f.followUpOn !== '' ? { followUpOn: f.followUpOn } : {}), + // Edit mode: blank means "clear it" — send an explicit null so the server clears the column + // (same semantics as ClientDetail's inline follow-up quick-edit). Create mode omits when blank. + ...(editing + ? { outcome: f.outcome !== '' ? f.outcome : null, followUpOn: f.followUpOn !== '' ? f.followUpOn : null } + : { + ...(f.outcome !== '' ? { outcome: f.outcome } : {}), + ...(f.followUpOn !== '' ? { followUpOn: f.followUpOn } : {}), + }), } const call = editing ? updateInteraction(props.initial!.id, body) : createInteraction(props.clientId, body) call