refactor: stats missing and new tab
This commit is contained in:
parent
453252c4be
commit
448d9156f9
6 changed files with 55 additions and 54 deletions
|
|
@ -35,7 +35,7 @@ const { stats, pageMax, page, data, pageSize } = storeToRefs(debitNote);
|
|||
// NOTE: Variable
|
||||
const pageState = reactive({
|
||||
quotationId: '',
|
||||
currentTab: DebitNoteStatus.Pending,
|
||||
currentTab: DebitNoteStatus.Issued,
|
||||
hideStat: false,
|
||||
statusFilter: 'None',
|
||||
inputSearch: '',
|
||||
|
|
@ -64,7 +64,9 @@ async function getList(opts?: { page?: number; pageSize?: number }) {
|
|||
page: opts?.page || page.value,
|
||||
pageSize: opts?.pageSize || pageSize.value,
|
||||
query: pageState.inputSearch === '' ? undefined : pageState.inputSearch,
|
||||
deebitNoteStatus: pageState.currentTab as DebitNoteStatus | undefined,
|
||||
status: (pageState.currentTab === DebitNoteStatus.Issued
|
||||
? undefined
|
||||
: pageState.currentTab) as DebitNoteStatus,
|
||||
includeRegisteredBranch: true,
|
||||
});
|
||||
|
||||
|
|
@ -126,7 +128,17 @@ onMounted(async () => {
|
|||
navigator.current.title = 'debitNote.title';
|
||||
navigator.current.path = [{ text: 'debitNote.caption', i18n: true }];
|
||||
|
||||
debitNote.getDebitNoteStats().then((res) => res && (stats.value = res));
|
||||
await debitNote.getDebitNoteStats().then((res) => {
|
||||
if (res) {
|
||||
stats.value = res;
|
||||
|
||||
stats.value['issued'] = Object.values(res).reduce(
|
||||
(sum, value) => sum + value,
|
||||
0,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
getList();
|
||||
});
|
||||
|
||||
|
|
@ -184,33 +196,28 @@ watch(
|
|||
:branch="[
|
||||
{
|
||||
icon: 'material-symbols-light:receipt-long',
|
||||
count: stats[DebitNoteStatus.Pending] || 0,
|
||||
label: `debitNote.stats.${DebitNoteStatus.Pending}`,
|
||||
count: stats['issued'] || 0,
|
||||
label: `debitNote.stats.${DebitNoteStatus.Issued}`,
|
||||
color: 'orange',
|
||||
},
|
||||
{
|
||||
icon: 'mdi-clock-alert-outline',
|
||||
count: stats[DebitNoteStatus.Expire] || 0,
|
||||
label: `debitNote.stats.${DebitNoteStatus.Expire}`,
|
||||
color: 'cyan',
|
||||
},
|
||||
|
||||
{
|
||||
icon: 'tabler:cash-register',
|
||||
count: stats[DebitNoteStatus.Payment] || 0,
|
||||
label: `debitNote.stats.${DebitNoteStatus.Payment}`,
|
||||
count: stats['paymentPending'] || 0,
|
||||
label: `debitNote.stats.${DebitNoteStatus.PaymentPending}`,
|
||||
color: 'dark-orange',
|
||||
},
|
||||
{
|
||||
icon: 'fluent:receipt-money-16-regular',
|
||||
count: stats[DebitNoteStatus.Receipt] || 0,
|
||||
label: `debitNote.stats.${DebitNoteStatus.Receipt}`,
|
||||
count: stats['paymentSuccess'] || 0,
|
||||
label: `debitNote.stats.${DebitNoteStatus.PaymentSuccess}`,
|
||||
color: 'green',
|
||||
},
|
||||
|
||||
{
|
||||
icon: 'mdi-check-decagram-outline',
|
||||
count: stats[DebitNoteStatus.Succeed] || 0,
|
||||
label: `debitNote.stats.${DebitNoteStatus.Succeed}`,
|
||||
count: stats['processComplete'] || 0,
|
||||
label: `debitNote.stats.${DebitNoteStatus.ProcessComplete}`,
|
||||
color: 'blue',
|
||||
},
|
||||
]"
|
||||
|
|
|
|||
|
|
@ -4,29 +4,24 @@ import { formatNumberDecimal } from 'src/stores/utils';
|
|||
|
||||
export const taskStatusOpts = [
|
||||
{
|
||||
status: DebitNoteStatus.Expire,
|
||||
name: `debitNote.status.${DebitNoteStatus.Expire}`,
|
||||
status: DebitNoteStatus.PaymentPending,
|
||||
name: `debitNote.status.${DebitNoteStatus.PaymentPending}`,
|
||||
},
|
||||
{
|
||||
status: DebitNoteStatus.Payment,
|
||||
name: `debitNote.status.${DebitNoteStatus.Payment}`,
|
||||
status: DebitNoteStatus.PaymentSuccess,
|
||||
name: `debitNote.status.${DebitNoteStatus.PaymentSuccess}`,
|
||||
},
|
||||
{
|
||||
status: DebitNoteStatus.Receipt,
|
||||
name: `debitNote.status.${DebitNoteStatus.Receipt}`,
|
||||
},
|
||||
{
|
||||
status: DebitNoteStatus.Succeed,
|
||||
name: `debitNote.status.${DebitNoteStatus.Succeed}`,
|
||||
status: DebitNoteStatus.PaymentSuccess,
|
||||
name: `debitNote.status.${DebitNoteStatus.ProcessComplete}`,
|
||||
},
|
||||
];
|
||||
|
||||
export const pageTabs = [
|
||||
{ label: 'Pending', value: DebitNoteStatus.Pending },
|
||||
{ label: 'Expire', value: DebitNoteStatus.Expire },
|
||||
{ label: 'Payment', value: DebitNoteStatus.Payment },
|
||||
{ label: 'Receipt', value: DebitNoteStatus.Receipt },
|
||||
{ label: 'Succeed', value: DebitNoteStatus.Succeed },
|
||||
{ label: 'Pending', value: DebitNoteStatus.Issued },
|
||||
{ label: 'Payment', value: DebitNoteStatus.PaymentPending },
|
||||
{ label: 'Receipt', value: DebitNoteStatus.PaymentSuccess },
|
||||
{ label: 'Succeed', value: DebitNoteStatus.ProcessComplete },
|
||||
];
|
||||
|
||||
export enum Status {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue