From 036f8c2891c2515f0604675fdb0f1171ed792ab6 Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Thu, 7 Nov 2024 14:57:45 +0700 Subject: [PATCH] feat: change tab on enter with query string --- src/pages/05_quotation/QuotationForm.vue | 32 +++++++++++++++++++----- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/pages/05_quotation/QuotationForm.vue b/src/pages/05_quotation/QuotationForm.vue index c739756f..6daf4b1a 100644 --- a/src/pages/05_quotation/QuotationForm.vue +++ b/src/pages/05_quotation/QuotationForm.vue @@ -82,6 +82,7 @@ import QuotationFormMetadata from './QuotationFormMetadata.vue'; import BadgeComponent from 'src/components/BadgeComponent.vue'; import PaymentForm from './PaymentForm.vue'; import { api } from 'src/boot/axios'; +import { useRoute } from 'vue-router'; type Node = { [key: string]: any; @@ -95,6 +96,7 @@ type Node = { type ProductGroupId = string; +const route = useRoute(); const useReceiptStore = useReceipt(); const configStore = useConfigStore(); const productServiceStore = useProductServiceStore(); @@ -531,6 +533,16 @@ async function convertDataToFormSubmit() { if (res === true) { quotationFormState.value.mode = 'info'; + localStorage.setItem( + 'new-quotation', + JSON.stringify({ + quotationId: quotationFormData.value.id, + customerBranchId: quotationFormData.value.customerBranchId, + branchId: quotationFormData.value.registeredBranchId, + agentPrice: agentPrice.value, + statusDialog: 'info', + }), + ); await fetchQuotation(); } } @@ -861,6 +873,17 @@ onMounted(async () => { } pageState.isLoaded = true; + + if (route.query['tab'] === 'invoice') { + view.value = + quotationFormData.value.payCondition === 'Full' || + quotationFormData.value.payCondition === 'BillFull' + ? View.Invoice + : View.InvoicePre; + } + if (route.query['tab'] === 'receipt') { + view.value = View.Receipt; + } }); watch( @@ -1006,7 +1029,6 @@ enum View { Invoice, PaymentPre, Payment, - ReceiptPre, Receipt, Complete, } @@ -1028,6 +1050,7 @@ const view = ref(View.Quotation); + {{ $t('quotation.title') }} {{ @@ -1484,11 +1507,7 @@ const view = ref(View.Quotation);