From c4ce5dd23dac920c5bffc7ada072b301795d343e Mon Sep 17 00:00:00 2001 From: Gitead Date: Wed, 6 May 2026 21:46:25 -0400 Subject: [PATCH] refactor: replace status dropdown with computed status badge MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Status is now derived from the numbers — no manual switching needed: - Balance = 0 → Paid in Full (teal) - Balance > 0, Collected > 0 → Partially Paid (blue) - Balance > 0, Collected = 0 → Pending (red) VOID/DENIED/OVERPAID still show from DB as manual decisions. Removed Revert Full Due button (tied to old status system). Void button now shows for all non-VOID, non-DENIED payments. Co-Authored-By: Claude Sonnet 4.6 --- .../payments/payments-recent-table.tsx | 94 +++++-------------- 1 file changed, 26 insertions(+), 68 deletions(-) diff --git a/apps/Frontend/src/components/payments/payments-recent-table.tsx b/apps/Frontend/src/components/payments/payments-recent-table.tsx index 05112cb7..03b8d8f6 100755 --- a/apps/Frontend/src/components/payments/payments-recent-table.tsx +++ b/apps/Frontend/src/components/payments/payments-recent-table.tsx @@ -718,61 +718,33 @@ export default function PaymentsRecentTable({
{(() => { - const { label, color, icon } = getStatusInfo( - payment.status - ); - const switchableStatuses: PaymentStatus[] = [ - "PENDING", - "PARTIALLY_PAID", - "PAID", - ]; - const isSwitchable = switchableStatuses.includes( - payment.status as PaymentStatus - ); - if (isSwitchable) { + // VOID and DENIED are manual decisions — show as-is + if (payment.status === "VOID" || payment.status === "DENIED" || payment.status === "OVERPAID") { + const { label, color, icon } = getStatusInfo(payment.status); return ( - + + {icon}{label} + + ); + } + // Compute status from numbers + if (totalDue === 0) { + return ( + + Paid in Full + + ); + } + if (totalCollected > 0) { + return ( + + Partially Paid + ); } return ( - - - {icon} - {label} - + + Pending ); })()} @@ -977,9 +949,9 @@ export default function PaymentsRecentTable({ )} - {/* When NOT PAID and NOT VOID → Void */} - {payment.status !== "PAID" && - payment.status !== "VOID" && ( + {/* Show Void unless already voided or denied */} + {payment.status !== "VOID" && + payment.status !== "DENIED" && ( - )} - {/* When VOID → Unvoid */} {payment.status === "VOID" && (