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; + }, }, ]);