From 1f244450b2bdd5806fd124b6258e87bf3ef09d50 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 23:52:54 +0000 Subject: [PATCH] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/cases/collections-tab.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/components/cases/collections-tab.tsx b/src/components/cases/collections-tab.tsx index c66d7db..8b72808 100644 --- a/src/components/cases/collections-tab.tsx +++ b/src/components/cases/collections-tab.tsx @@ -381,9 +381,6 @@ export function CollectionDetail({ const { user } = useAuth(); const [entries, setEntries] = useState([]); const [loading, setLoading] = useState(true); - const [chargeOpen, setChargeOpen] = useState(false); - const [paymentOpen, setPaymentOpen] = useState(false); - const [bankOpen, setBankOpen] = useState(false); const [importOpen, setImportOpen] = useState(false); // Editable header fields @@ -426,8 +423,8 @@ export function CollectionDetail({ } }; - // Insert a blank row at the end (sort_order = max+10) - const addBlankRow = async () => { + // Insert a new row at the end. Optional preset for transaction_type / description. + const addBlankRow = async (preset?: { transaction_type?: string; description?: string }) => { const maxSort = entries.reduce((m: number, e: any) => Math.max(m, Number(e.sort_order) || 0), 0); const today = new Date().toISOString().slice(0, 10); const { data, error } = await supabase @@ -435,7 +432,8 @@ export function CollectionDetail({ .insert({ collection_id: collection.id, entry_date: today, - transaction_type: "adjustment", + transaction_type: preset?.transaction_type ?? "adjustment", + description: preset?.description ?? null, sort_order: maxSort + 10, created_by: user?.id, })