From db67ccd05c4cae24b3c1fa0145454c52af0f09ac Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Wed, 30 Oct 2024 10:24:24 +0700 Subject: [PATCH] refactor: update status --- src/pages/05_quotation/QuotationForm.vue | 66 +++++++++++------------- 1 file changed, 29 insertions(+), 37 deletions(-) diff --git a/src/pages/05_quotation/QuotationForm.vue b/src/pages/05_quotation/QuotationForm.vue index 80d6915c..493f6256 100644 --- a/src/pages/05_quotation/QuotationForm.vue +++ b/src/pages/05_quotation/QuotationForm.vue @@ -74,11 +74,6 @@ import { useConfigStore } from 'src/stores/config'; import QuotationFormMetadata from './QuotationFormMetadata.vue'; import BadgeComponent from 'src/components/BadgeComponent.vue'; import PaymentForm from './PaymentForm.vue'; -import TableComponents from 'src/components/TableComponents.vue'; - -// defineProps<{ -// readonly?: boolean; -// }>(); type Node = { [key: string]: any; @@ -309,14 +304,13 @@ async function fetchStatus() { async function fetchQuotation() { if ( - currentQuotationId.value !== undefined && + (!!currentQuotationId.value || !!quotationFormData.value.id) && quotationFormState.value.mode && quotationFormState.value.mode !== 'create' ) { - await quotationForm.assignFormData( - currentQuotationId.value, - quotationFormState.value.mode, - ); + const id = currentQuotationId.value || quotationFormData.value.id || ''; + + await quotationForm.assignFormData(id, quotationFormState.value.mode); await assignWorkerToSelectedWorker(); } @@ -401,7 +395,10 @@ async function convertInvoiceToSubmit() { }; const res = await quotationForm.submitInvoice(); - if (res) view.value = View.Payment; + if (res) { + await fetchQuotation(); + view.value = View.Payment; + } } } @@ -743,11 +740,9 @@ onMounted(async () => { }); watch( - () => quotationFormData.value.status, + () => quotationFormData.value.quotationStatus, () => { fetchStatus(); - - statusQuotationForm.value.filter((v) => v.title === 'ลูกค้าตอบรับ'); }, ); @@ -1175,7 +1170,6 @@ const view = ref(View.Quotation); :rows=" selectedInstallmentNo.length > 0 ? productServiceList.filter((v) => { - console.log(v.installmentNo, selectedInstallmentNo); return ( v.installmentNo && selectedInstallmentNo.includes(v.installmentNo) @@ -1377,8 +1371,15 @@ const view = ref(View.Quotation);