fix paid coloum

This commit is contained in:
null 2026-05-28 01:38:18 -05:00
parent a811589db4
commit fa60ea8fbd
1 changed files with 9 additions and 12 deletions

View File

@ -456,6 +456,13 @@ function PaymentProgress({ row, threshold, onOpen, compact = false }) {
? 'bg-amber-500' ? 'bg-amber-500'
: 'bg-muted-foreground/40'; : 'bg-muted-foreground/40';
const amountLabel = (() => {
if (summary.paid === 0) return '—';
if (summary.overpaid > 0) return `${fmt(summary.paidTowardDue)} · overpaid`;
if (summary.remaining > 0) return `${fmt(summary.paidTowardDue)} paid`;
return fmt(summary.paidTowardDue);
})();
return ( return (
<button <button
type="button" type="button"
@ -468,11 +475,11 @@ function PaymentProgress({ row, threshold, onOpen, compact = false }) {
> >
<div className="flex items-center justify-between gap-2 text-xs"> <div className="flex items-center justify-between gap-2 text-xs">
<span className={cn('font-mono', summary.paid > 0 ? 'text-emerald-500' : 'text-muted-foreground')}> <span className={cn('font-mono', summary.paid > 0 ? 'text-emerald-500' : 'text-muted-foreground')}>
{summary.paid > 0 ? `${fmt(summary.paidTowardDue)} of ${fmt(summary.target)}` : `Paid ${fmt(0)} of ${fmt(summary.target)}`} {amountLabel}
</span> </span>
{summary.count > 1 && ( {summary.count > 1 && (
<span className="shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground"> <span className="shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground">
{summary.count} payments {summary.count}×
</span> </span>
)} )}
</div> </div>
@ -482,16 +489,6 @@ function PaymentProgress({ row, threshold, onOpen, compact = false }) {
style={{ width: `${summary.percent}%` }} style={{ width: `${summary.percent}%` }}
/> />
</div> </div>
<div className="mt-1 flex items-center justify-between gap-2 text-[11px] text-muted-foreground">
<span>{summary.percent}%</span>
<span>
{summary.overpaid > 0
? `${fmt(summary.overpaid)} overpaid`
: summary.remaining > 0
? `${fmt(summary.remaining)} remaining`
: 'Paid in full'}
</span>
</div>
</button> </button>
); );
} }