From 810b8b96ba37eba10d5fda61fc0b56750369e457 Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Tue, 29 Oct 2024 10:19:47 +0700 Subject: [PATCH] feat: paycondition --- src/i18n/eng/index.ts | 4 +++ src/i18n/tha/index.ts | 4 +++ src/pages/05_quotation/MainPage.vue | 28 ++++++-------------- src/pages/05_quotation/QuotationFormInfo.vue | 12 ++++++--- src/pages/05_quotation/constants.ts | 3 +-- src/stores/quotations/index.ts | 10 ++++++- src/stores/quotations/types.ts | 26 +++++++++++++++--- 7 files changed, 57 insertions(+), 30 deletions(-) diff --git a/src/i18n/eng/index.ts b/src/i18n/eng/index.ts index f5ee78be..bcea9e22 100644 --- a/src/i18n/eng/index.ts +++ b/src/i18n/eng/index.ts @@ -706,12 +706,16 @@ export default { all: 'All', fullAmountCash: 'Full Amount Cash', installmentsCash: 'Installments Cash', + installmentsCustomCash: 'Custom Installments Cash', fullAmountBill: 'Full Amount Bill', installmentsBill: 'Installments Bill', + installmentsCustomBill: 'Custom Installments Bill', Full: 'Full Amount Cash', Split: 'Installments Cash', + SplitCustom: 'Custom Installments Bill', BillFull: 'Full Amount Bill', BillSplit: 'Installments Bill', + BillCustomSplit: 'Custom Installments Bill', }, }, diff --git a/src/i18n/tha/index.ts b/src/i18n/tha/index.ts index 771367bd..32245c27 100644 --- a/src/i18n/tha/index.ts +++ b/src/i18n/tha/index.ts @@ -701,12 +701,16 @@ export default { all: 'ทั้งหมด', fullAmountCash: 'เงินสดเต็มจำนวน', installmentsCash: 'เงินสดแบ่งจ่าย', + installmentsCustomCash: 'เงินสดแบ่งจ่ายกำหนดเอง', fullAmountBill: 'ใบเรียกเก็บเงินเต็มจำนวน', installmentsBill: 'ใบเรียกเก็บเงินแบ่งจ่าย', + installmentsCustomBill: 'ใบเรียกเก็บแบ่งจ่ายกำหนดเอง', Full: 'เงินสดเต็มจำนวน', Split: 'เงินสดแบ่งจ่าย', + SplitCustom: 'เงินสดแบ่งจ่ายกำหนดเอง', BillFull: 'ใบเรียกเก็บเงินเต็มจำนวน', BillSplit: 'ใบเรียกเก็บเงินแบ่งจ่าย', + BillSplitCustom: 'ใบเรียกเก็บแบ่งจ่ายกำหนดเอง', }, }, diff --git a/src/pages/05_quotation/MainPage.vue b/src/pages/05_quotation/MainPage.vue index 5fc17e35..c9a33c2e 100644 --- a/src/pages/05_quotation/MainPage.vue +++ b/src/pages/05_quotation/MainPage.vue @@ -265,8 +265,7 @@ async function fetchQuotationList() { { fullAmountCash: 'Full', installmentsCash: 'Split', - fullAmountBill: 'BillFull', - installmentsBill: 'BillSplit', + installmentsCustomCash: 'SplitCustom', } as const )[pageState.currentTab] : undefined, @@ -337,11 +336,9 @@ async function storeDataLocal(id: string) { ? quotationStats.full : pageState.currentTab === 'installmentsCash' ? quotationStats.split - : pageState.currentTab === 'fullAmountBill' - ? quotationStats.billFull - : pageState.currentTab === 'installmentsBill' - ? quotationStats.billSplit - : 0 + : pageState.currentTab === 'installmentsCustomCash' + ? quotationStats.splitCustom + : 0 }} ('payBillDate', { required: false, }); -const payType = defineModel<'Full' | 'Split' | 'BillFull' | 'BillSplit'>( - 'payType', - { required: true }, -); +const payType = defineModel< + | 'Full' + | 'Split' + | 'SplitCustom' + | 'BillFull' + | 'BillSplit' + | 'BillSplitCustom' +>('payType', { required: true }); const paySplitCount = defineModel('paySplitCount', { default: 1, }); diff --git a/src/pages/05_quotation/constants.ts b/src/pages/05_quotation/constants.ts index 9e248f20..11580d3f 100644 --- a/src/pages/05_quotation/constants.ts +++ b/src/pages/05_quotation/constants.ts @@ -23,8 +23,7 @@ export const pageTabs = [ 'all', 'fullAmountCash', 'installmentsCash', - 'fullAmountBill', - 'installmentsBill', + 'installmentsCustomCash', ]; export const fieldSelectedOption = [{ label: 'general.type', value: 'value' }]; diff --git a/src/stores/quotations/index.ts b/src/stores/quotations/index.ts index 70117df4..f0e34867 100644 --- a/src/stores/quotations/index.ts +++ b/src/stores/quotations/index.ts @@ -24,8 +24,10 @@ export const useQuotationStore = defineStore('quotation-store', () => { const stats = ref({ full: 0, split: 0, + splitCustom: 0, billFull: 0, billSplit: 0, + billSplitCustom: 0, }); async function getQuotationStats() { @@ -47,7 +49,13 @@ export const useQuotationStore = defineStore('quotation-store', () => { async function getQuotationList(params?: { page?: number; pageSize?: number; - payCondition?: 'Full' | 'Split' | 'BillFull' | 'BillSplit'; + payCondition?: + | 'Full' + | 'Split' + | 'SplitCustom' + | 'BillFull' + | 'BillSplit' + | 'BillSplitCustom'; query?: string; }) { const res = await api.get>(`/quotation`, { diff --git a/src/stores/quotations/types.ts b/src/stores/quotations/types.ts index 3e9716ac..4f1edd61 100644 --- a/src/stores/quotations/types.ts +++ b/src/stores/quotations/types.ts @@ -185,8 +185,10 @@ type ServiceRelation = { export type QuotationStats = { full: number; split: number; + splitCustom: number; billFull: number; billSplit: number; + billSplitCustom: number; }; export type Quotation = { @@ -205,7 +207,13 @@ export type Quotation = { invoice: boolean; amount: number; }[]; - payCondition: 'Full' | 'Split' | 'BillFull' | 'BillSplit'; + payCondition: + | 'Full' + | 'Split' + | 'SplitCustom' + | 'BillFull' + | 'BillSplit' + | 'BillSplitCustom'; date: string | Date; dueDate: string | Date; documentReceivePoint: string; @@ -279,7 +287,13 @@ export type QuotationFull = { payBillDate: string | Date | null; paySplitCount: number | null; paySplit: { no: number; amount: number }[]; - payCondition: 'Full' | 'Split' | 'BillFull' | 'BillSplit'; + payCondition: + | 'Full' + | 'Split' + | 'SplitCustom' + | 'BillFull' + | 'BillSplit' + | 'BillSplitCustom'; date: string | Date; dueDate: string | Date; documentReceivePoint: string; @@ -334,7 +348,13 @@ export type QuotationPayload = { payBillDate?: Date | null; paySplit: { no: number; date: string | Date; amount: number }[]; paySplitCount?: number | null; // int - payCondition: 'Full' | 'Split' | 'BillFull' | 'BillSplit'; + payCondition: + | 'Full' + | 'Split' + | 'SplitCustom' + | 'BillFull' + | 'BillSplit' + | 'BillSplitCustom'; dueDate: Date; documentReceivePoint: string; contactTel: string;