From 284028aff07f46a254bf4061b63d57b8137364f2 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Thu, 3 Oct 2024 09:43:32 +0700 Subject: [PATCH] refactor: quotation type & customer branch fetch by register branch id --- src/pages/05_quotation/form.ts | 26 +++++++++----------------- src/stores/customer/index.ts | 2 ++ src/stores/quotations/types.ts | 24 ++++++++---------------- 3 files changed, 19 insertions(+), 33 deletions(-) diff --git a/src/pages/05_quotation/form.ts b/src/pages/05_quotation/form.ts index a66c161a..78907dc8 100644 --- a/src/pages/05_quotation/form.ts +++ b/src/pages/05_quotation/form.ts @@ -10,23 +10,15 @@ export const useQuotationForm = defineStore('form-quotation', () => { const quotationStore = useQuotationStore(); const defaultFormData: QuotationPayload = { - service: [ + productServiceList: [ { - work: [ - { - product: [ - { - vat: 0, - discount: 1, - amount: 0, - id: '', - }, - ], - excluded: false, - id: '', - }, - ], - id: '', + vat: 0, + pricePerUnit: 0, + discount: 0, + amount: 0, + productId: '', + workId: '', + serviceId: '', }, ], urgent: false, @@ -45,7 +37,7 @@ export const useQuotationForm = defineStore('form-quotation', () => { actorName: '', status: 'CREATED', }; - let resetFormData = structuredClone(defaultFormData); + const resetFormData = structuredClone(defaultFormData); const currentFormData = ref(structuredClone(resetFormData)); diff --git a/src/stores/customer/index.ts b/src/stores/customer/index.ts index 45947074..539a1fc5 100644 --- a/src/stores/customer/index.ts +++ b/src/stores/customer/index.ts @@ -81,6 +81,7 @@ const useCustomerStore = defineStore('api-customer', () => { zipCode?: string; customerId?: string; includeCustomer?: boolean; + registeredBranchId?: string; status?: 'CREATED' | 'ACTIVE' | 'INACTIVE'; query?: string; page?: number; @@ -118,6 +119,7 @@ const useCustomerStore = defineStore('api-customer', () => { page?: number; pageSize?: number; query?: string; + registeredBranchId?: string; includeBranch?: boolean; status?: 'CREATED' | 'ACTIVE' | 'INACTIVE'; customerType?: CustomerType; diff --git a/src/stores/quotations/types.ts b/src/stores/quotations/types.ts index a32cd051..ee09501c 100644 --- a/src/stores/quotations/types.ts +++ b/src/stores/quotations/types.ts @@ -251,23 +251,15 @@ export type QuotationFull = { }; export type QuotationPayload = { - service: [ + productServiceList: [ { - work: [ - { - product: [ - { - vat: number; // 0..1 - discount: 1; // 0..1 - amount: 0; // int - id: string; - }, - ]; - excluded: boolean; - id: string; - }, - ]; - id: string; + vat: number; + pricePerUnit: number; + discount: number; + amount: number; + productId: string; + workId: string; + serviceId: string; }, ]; urgent: boolean;