From 65b603ab42170a5f4b1b12baa76bc23064fdcc86 Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Mon, 28 Oct 2024 11:48:49 +0700 Subject: [PATCH] feat: change view by condition --- src/pages/05_quotation/QuotationForm.vue | 28 +++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/pages/05_quotation/QuotationForm.vue b/src/pages/05_quotation/QuotationForm.vue index 2dd3d6ad..65d6fe66 100644 --- a/src/pages/05_quotation/QuotationForm.vue +++ b/src/pages/05_quotation/QuotationForm.vue @@ -712,7 +712,6 @@ function getStatus( : 'waiting'; } -// TODO: check for payment type and decide wether to change view to pre or not const statusQuotationForm = ref< { title: string; status: 'done' | 'doing' | 'waiting'; handler: () => void }[] >([ @@ -729,22 +728,41 @@ const statusQuotationForm = ref< { title: 'ใบแจ้งหนี้', status: getStatus(quotationFormData.value.quotationStatus, 4, 1), - handler: () => (view.value = View.InvoicePre), + handler: () => { + quotationFormData.value.payCondition === 'Full' || + quotationFormData.value.payCondition === 'BillFull' + ? View.Invoice + : View.InvoicePre; + }, }, { title: 'ชำระเงิน', status: getStatus(quotationFormData.value.quotationStatus, 4, 1), - handler: () => (view.value = View.PaymentPre), + handler: () => { + view.value = + quotationFormData.value.payCondition === 'Full' || + quotationFormData.value.payCondition === 'BillFull' + ? View.Payment + : View.PaymentPre; + }, }, { title: 'ใบเสร็จรับเงิน', status: getStatus(quotationFormData.value.quotationStatus, 4, 1), - handler: () => (view.value = View.ReceiptPre), + handler: () => { + view.value = + quotationFormData.value.payCondition === 'Full' || + quotationFormData.value.payCondition === 'BillFull' + ? View.Receipt + : View.ReceiptPre; + }, }, { title: 'เสร็จสิ้น', status: getStatus(quotationFormData.value.quotationStatus, 5, 4), - handler: () => (view.value = View.Complete), + handler: () => { + view.value = View.Complete; + }, }, ]);