Show refunds as refunds in transaction breakdown checklist
Refunds were rendered like payments (abs value, no marker). Backend now flags items with is_refund from NewBook item_type (refunds_raised / refunds_voided) and labels the type '-refund'; frontend shows them in red with a leading minus. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
b750004714
commit
af1560d58f
3 changed files with 11 additions and 4 deletions
|
|
@ -929,6 +929,8 @@ function TransactionChecklist({ breakdown, checked, onToggle }: {
|
|||
{items.map((item, i) => {
|
||||
const key = `${section}:${category}:${i}`
|
||||
const isDone = checked.has(key)
|
||||
// Refunds are a transaction type, not a negative value — amount stays positive
|
||||
const isRefund = item.is_refund
|
||||
return (
|
||||
<div key={key} onClick={() => onToggle(key)} style={{
|
||||
display: 'grid', gridTemplateColumns: '20px 1fr auto auto',
|
||||
|
|
@ -949,9 +951,11 @@ function TransactionChecklist({ breakdown, checked, onToggle }: {
|
|||
<span style={{ fontSize: '0.7rem', color: 'var(--text-mid)', marginLeft: '0.5rem' }}>{item.time.slice(11, 16)}</span>
|
||||
)}
|
||||
</div>
|
||||
<span style={{ fontSize: '0.7rem', color: 'var(--text-mid)' }}>{item.payment_type}</span>
|
||||
<span style={{ fontSize: '0.8rem', fontWeight: 600, color: item.is_voided ? 'var(--danger)' : undefined }}>
|
||||
{item.is_voided ? '-' : ''}{fmtGBP(Math.abs(item.amount))}
|
||||
<span style={{ fontSize: '0.7rem', color: 'var(--text-mid)' }}>
|
||||
{item.payment_type}
|
||||
</span>
|
||||
<span style={{ fontSize: '0.8rem', fontWeight: 600, color: item.is_voided || isRefund ? 'var(--danger)' : undefined }}>
|
||||
{item.is_voided || isRefund ? '-' : ''}{fmtGBP(Math.abs(item.amount))}
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ export interface TransactionItem {
|
|||
details: string
|
||||
amount: number
|
||||
is_voided: boolean
|
||||
is_refund: boolean
|
||||
}
|
||||
|
||||
export interface TransactionBreakdown {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue