From 4d0d978f132fae939a75adbb41a19f4ec616f435 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Fri, 1 May 2026 15:58:08 +0000 Subject: [PATCH] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/trust/trust-account-panel.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/components/trust/trust-account-panel.tsx b/src/components/trust/trust-account-panel.tsx index 80f073c..dd11edd 100644 --- a/src/components/trust/trust-account-panel.tsx +++ b/src/components/trust/trust-account-panel.tsx @@ -354,13 +354,17 @@ function ManualAdjustDialog({ }, [open, defaultCaseId]); const save = async () => { + console.log("[trust-deposit] save clicked", { amount, date, note, caseChoice, type, clientId, userId }); const amt = Number(amount); - if (!amt || amt <= 0) return toast.error("Enter a valid amount"); + if (!amt || amt <= 0) { + console.warn("[trust-deposit] invalid amount", amount); + return toast.error("Enter a valid amount"); + } if (type === "withdrawal" && amt > balance) { if (!confirm(`This will overdraw the trust by ${formatCurrency(amt - balance)}. Continue?`)) return; } setSaving(true); - const { error } = await supabase.from("trust_ledger_entries").insert({ + const { data, error } = await supabase.from("trust_ledger_entries").insert({ client_id: clientId, case_id: caseChoice === POOL_KEY ? null : caseChoice, entry_date: date, @@ -368,9 +372,13 @@ function ManualAdjustDialog({ amount: amt, note: note || (type === "deposit" ? "Manual deposit" : "Manual withdrawal"), created_by: userId, - }); + }).select(); + console.log("[trust-deposit] insert result", { data, error }); setSaving(false); - if (error) return toast.error(error.message); + if (error) { + console.error("[trust-deposit] insert failed", error); + return toast.error(error.message); + } toast.success(type === "deposit" ? "Deposit recorded" : "Withdrawal recorded"); onOpenChange(false); onSaved();