refactor: handle undefined stats in credit note display

This commit is contained in:
puriphatt 2025-02-19 16:26:46 +07:00
parent 7be89d1d4f
commit 453252c4be

View file

@ -157,7 +157,7 @@ watch(
color: hsl(var(--info-bg)); color: hsl(var(--info-bg));
" "
> >
{{ pageState.total }} {{ stats.Pending + stats.Success || 0 }}
</q-badge> </q-badge>
<q-btn <q-btn
class="q-ml-sm" class="q-ml-sm"
@ -181,13 +181,13 @@ watch(
:branch="[ :branch="[
{ {
icon: 'material-symbols-light:receipt-long', icon: 'material-symbols-light:receipt-long',
count: stats[CreditNoteStatus.Pending], count: stats[CreditNoteStatus.Pending] || 0,
label: `creditNote.stats.${CreditNoteStatus.Pending}`, label: `creditNote.stats.${CreditNoteStatus.Pending}`,
color: 'orange', color: 'orange',
}, },
{ {
icon: 'mdi-check-decagram-outline', icon: 'mdi-check-decagram-outline',
count: stats[CreditNoteStatus.Success], count: stats[CreditNoteStatus.Success] || 0,
label: `creditNote.stats.${CreditNoteStatus.Success}`, label: `creditNote.stats.${CreditNoteStatus.Success}`,
color: 'blue', color: 'blue',
}, },