feat: add date range search functionality to quotation management

This commit is contained in:
puriphatt 2025-04-17 17:13:26 +07:00
parent 36cef7ceb6
commit 7897103a1b
2 changed files with 19 additions and 4 deletions

View file

@ -49,6 +49,7 @@ import { Quotation } from 'src/stores/quotations/types';
import TableQuotation from 'src/components/05_quotation/TableQuotation.vue';
import PaginationPageSize from 'src/components/PaginationPageSize.vue';
import { DialogContainer, DialogHeader } from 'src/components/dialog';
import AdvanceSearch from 'src/components/shared/AdvanceSearch.vue';
const { t, locale } = useI18n();
const $q = useQuasar();
@ -109,6 +110,7 @@ const pageState = reactive({
quotationModal: false,
employeeModal: false,
receiptModal: false,
searchDate: [],
});
pageState.fieldSelected = [...columnQuotation.map((v) => v.name)];
@ -327,6 +329,8 @@ async function fetchQuotationList(mobileFetch?: boolean) {
: 'Issued',
query: pageState.inputSearch,
urgentFirst: true,
startDate: pageState.searchDate[0],
endDate: pageState.searchDate[1],
});
if (ret) {
@ -350,7 +354,12 @@ async function fetchQuotationList(mobileFetch?: boolean) {
}
watch(
[() => pageState.currentTab, () => pageState.inputSearch, quotationPageSize],
[
() => pageState.currentTab,
() => pageState.inputSearch,
() => pageState.searchDate,
quotationPageSize,
],
() => {
quotationPage.value = 1;
quotationData.value = [];
@ -517,6 +526,10 @@ async function storeDataLocal(id: string) {
<template #prepend>
<q-icon name="mdi-magnify" />
</template>
<template v-slot:append>
<q-separator vertical inset class="q-mr-xs" />
<AdvanceSearch v-model="pageState.searchDate" />
</template>
</q-input>
<div class="row col-md-5 justify-end" style="white-space: nowrap">
@ -1126,13 +1139,13 @@ async function storeDataLocal(id: string) {
id="form-basic-info-customer"
:onCreate="customerFormState.dialogType === 'create'"
@edit="
(customerFormState.dialogType = 'edit'),
(customerFormState.readonly = false)
((customerFormState.dialogType = 'edit'),
(customerFormState.readonly = false))
"
@cancel="() => customerFormUndo(false)"
@delete="
customerFormState.editCustomerId &&
deleteCustomerById(customerFormState.editCustomerId)
deleteCustomerById(customerFormState.editCustomerId)
"
:customer-type="customerFormData.customerType"
v-model:registered-branch-id="customerFormData.registeredBranchId"

View file

@ -76,6 +76,8 @@ export const useQuotationStore = defineStore('quotation-store', () => {
includeRegisteredBranch?: boolean;
forDebitNote?: boolean;
cancelIncludeDebitNote?: boolean;
startDate?: string;
endDate?: string;
}) {
const res = await api.get<PaginationResult<Quotation>>('/quotation', {
params,