refactor: simplify total calculation logic in quotation and debit note pages

This commit is contained in:
puriphatt 2025-02-20 11:08:33 +07:00
parent a8f11d158b
commit 8dd3268738
2 changed files with 7 additions and 10 deletions

View file

@ -390,15 +390,7 @@ async function storeDataLocal(id: string) {
color: hsl(var(--info-bg));
"
>
{{
quotationStats[
pageState.currentTab === 'Invoice'
? 'paymentInProcess'
: (toCamelCase(
pageState.currentTab,
) as keyof typeof quotationStats)
]
}}
{{ Object.values(quotationStats).reduce((a, c) => a + c, 0) }}
</q-badge>
<q-btn
class="q-ml-sm"

View file

@ -172,7 +172,12 @@ watch(
color: hsl(var(--info-bg));
"
>
{{ pageState.total }}
{{
Object.entries(stats).reduce(
(sum, [key, value]) => (key === 'canceled' ? sum : sum + value),
0,
)
}}
</q-badge>
<q-btn
class="q-ml-sm"