From 051221e324f1834c4e2b88629fb11f6b5eed7671 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Thu, 6 Mar 2025 13:26:50 +0700 Subject: [PATCH] feat: add date range parameters to quotation and payment report APIs --- src/stores/quotations/index.ts | 7 +++++-- src/stores/report/index.ts | 9 +++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/stores/quotations/index.ts b/src/stores/quotations/index.ts index ad203cee..133b160c 100644 --- a/src/stores/quotations/index.ts +++ b/src/stores/quotations/index.ts @@ -32,8 +32,11 @@ export const useQuotationStore = defineStore('quotation-store', () => { canceled: 0, }); - async function getQuotationStats() { - const res = await api.get('/quotation/stats'); + async function getQuotationStats(params?: { + startDate: string | Date; + endDate: string | Date; + }) { + const res = await api.get('/quotation/stats', { params }); if (res.status < 400) { return res.data; } diff --git a/src/stores/report/index.ts b/src/stores/report/index.ts index aae45d32..c82cabaa 100644 --- a/src/stores/report/index.ts +++ b/src/stores/report/index.ts @@ -98,8 +98,13 @@ export async function getReportProduct() { return null; } -export async function getReportPayment() { - const res = await api.get(`/${ENDPOINT}/payment`); +export async function getReportPayment(params?: { + startDate: string | Date; + endDate: string | Date; +}) { + const res = await api.get(`/${ENDPOINT}/payment`, { + params, + }); if (res.status < 400) { return res.data; }