From 8c39b539fab7a880f293e5c972199dafb46deaf6 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sun, 26 Apr 2026 08:29:44 +0000 Subject: [PATCH] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/cases/ledger-row.tsx | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/components/cases/ledger-row.tsx b/src/components/cases/ledger-row.tsx index e104fe3..94ac184 100644 --- a/src/components/cases/ledger-row.tsx +++ b/src/components/cases/ledger-row.tsx @@ -3,7 +3,7 @@ import { useSortable } from "@dnd-kit/sortable"; import { CSS } from "@dnd-kit/utilities"; import { GripVertical, Trash2 } from "lucide-react"; import { Button } from "@/components/ui/button"; -import { BUCKETS, num } from "@/lib/ledger"; +import { BUCKETS, num, type Bucket } from "@/lib/ledger"; import { formatCurrency } from "@/lib/format"; export interface EditableEntry { @@ -20,6 +20,7 @@ export interface EditableEntry { bank: number; payment: number; runningBalance?: number; + allocations?: Record; } interface Props { @@ -29,13 +30,13 @@ interface Props { } const NUM_COLS: { key: keyof EditableEntry; danger?: boolean; positive?: boolean }[] = [ - { key: "assess" }, + { key: "bank", danger: true }, + { key: "interest" }, { key: "late" }, { key: "admin" }, { key: "legal" }, { key: "viol" }, - { key: "interest" }, - { key: "bank", danger: true }, + { key: "assess" }, { key: "payment", positive: true }, ]; @@ -111,6 +112,24 @@ export function SortableLedgerRow({ entry, onPatch, onRemove }: Props) { {NUM_COLS.map(({ key, danger, positive }) => { const v = num((draft as any)[key]); + // For non-payment columns: if this row is a payment with an allocation + // to this bucket, show the allocation as a green negative deduction. + const isPaymentCol = key === "payment"; + const allocAmt = !isPaymentCol && entry.allocations + ? num((entry.allocations as any)[key]) + : 0; + if (!isPaymentCol && allocAmt > 0 && v === 0) { + return ( + +
+ −{allocAmt.toFixed(2)} +
+ + ); + } return (