diff --git a/src/components/cases/collections-tab.tsx b/src/components/cases/collections-tab.tsx index da56bed..634eaee 100644 --- a/src/components/cases/collections-tab.tsx +++ b/src/components/cases/collections-tab.tsx @@ -748,24 +748,34 @@ export function CollectionDetail({ withRunning.forEach((e: any) => { const isPayment = num(e.payment) > 0; let desc = e.description || (e.account || "—"); - if (isPayment && e.allocations) { - const allocParts = BUCKETS - .filter((b) => num(e.allocations[b]) > 0) - .map((b) => `${BUCKET_SHORT[b]} ${formatCurrency(num(e.allocations[b]))}`); - if (allocParts.length > 0) { - desc = `${desc}\nApplied → ${allocParts.join(", ")}`; + // For payments, show the per-bucket allocation in each column, + // greyed out + italic + in parentheses (e.g. "(25.00)"). + const allocCell = (bucket: typeof BUCKETS[number]) => { + if (isPayment && e.allocations) { + const v = num(e.allocations[bucket]); + if (v > 0) { + return { + content: `(${v.toFixed(2)})`, + styles: { + textColor: [140, 140, 140] as any, + fontStyle: "italic" as const, + }, + }; + } } - } + const raw = num(e[bucket]); + return raw ? raw.toFixed(2) : ""; + }; body.push([ e.entry_date ? formatDate(e.entry_date) : "", desc, - num(e.assess) ? num(e.assess).toFixed(2) : "", - num(e.late) ? num(e.late).toFixed(2) : "", - num(e.admin) ? num(e.admin).toFixed(2) : "", - num(e.legal) ? num(e.legal).toFixed(2) : "", - num(e.viol) ? num(e.viol).toFixed(2) : "", - num(e.interest) ? num(e.interest).toFixed(2) : "", - num(e.bank) ? num(e.bank).toFixed(2) : "", + allocCell("assess"), + allocCell("late"), + allocCell("admin"), + allocCell("legal"), + allocCell("viol"), + allocCell("interest"), + allocCell("bank"), isPayment ? { content: num(e.payment).toFixed(2), styles: { textColor: [0, 130, 0] as any, fontStyle: "bold" } } : "",