From 73562a59c1b78b5e9c99455224276892dbc9cdf2 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Thu, 17 Apr 2025 17:22:31 +0700 Subject: [PATCH] feat: add date range search functionality to invoice management --- src/pages/10_invoice/MainPage.vue | 62 ++++++++++++++++++++++--------- src/stores/payment/index.ts | 2 + 2 files changed, 46 insertions(+), 18 deletions(-) diff --git a/src/pages/10_invoice/MainPage.vue b/src/pages/10_invoice/MainPage.vue index 12f20809..ef20cd7f 100644 --- a/src/pages/10_invoice/MainPage.vue +++ b/src/pages/10_invoice/MainPage.vue @@ -2,7 +2,7 @@ // NOTE: Library import { computed, onMounted, reactive, ref, watch } from 'vue'; import { storeToRefs } from 'pinia'; -import { QSelect, useQuasar } from 'quasar'; +import { useQuasar } from 'quasar'; // NOTE: Components import StatCardComponent from 'src/components/StatCardComponent.vue'; @@ -18,13 +18,13 @@ import { columns, hslaColors } from './constants'; import useFlowStore from 'src/stores/flow'; import { useInvoice } from 'src/stores/payment'; import { Invoice, PaymentDataStatus } from 'src/stores/payment/types'; +import AdvanceSearch from 'src/components/shared/AdvanceSearch.vue'; const $q = useQuasar(); const navigatorStore = useNavigator(); const flowStore = useFlowStore(); const invoiceStore = useInvoice(); const { data, stats, page, pageMax, pageSize } = storeToRefs(invoiceStore); -const refFilter = ref>(); // NOTE: Variable const pageState = reactive({ @@ -34,6 +34,7 @@ const pageState = reactive({ fieldSelected: [...columns.map((v) => v.name)], gridView: false, total: 0, + searchDate: [], }); const fieldSelectedOption = computed(() => { @@ -56,6 +57,8 @@ async function fetchList(opts?: { rotateFlowId?: boolean }) { : undefined, quotationOnly: true, debitNoteOnly: false, + startDate: pageState.searchDate[0], + endDate: pageState.searchDate[1], }); if (ret) { data.value = $q.screen.xs ? [...data.value, ...ret.result] : ret.result; @@ -89,8 +92,6 @@ function triggerView(opts: { quotationId: string }) { } function viewDocExample(quotationId: string, codeInvoice: string) { - console.log(codeInvoice); - localStorage.setItem( 'quotation-preview', JSON.stringify({ @@ -124,6 +125,7 @@ watch( () => pageState.inputSearch, () => pageState.statusFilter, () => pageSize.value, + () => pageState.searchDate, ], () => { page.value = 1; @@ -207,26 +209,50 @@ watch( -
{ debitNoteOnly?: boolean; quotationId?: string; debitNoteId?: string; + startDate?: string; + endDate?: string; }) { const res = await api.get>('/invoice', { params,