From 1325f79bc254b95d90f2c8e69e26241525196ee1 Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Fri, 1 Nov 2024 10:55:20 +0700 Subject: [PATCH] fix: wrong status --- src/pages/05_quotation/QuotationForm.vue | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/pages/05_quotation/QuotationForm.vue b/src/pages/05_quotation/QuotationForm.vue index 35fa1079..447509ba 100644 --- a/src/pages/05_quotation/QuotationForm.vue +++ b/src/pages/05_quotation/QuotationForm.vue @@ -269,19 +269,19 @@ async function fetchStatus() { statusQuotationForm.value = [ { title: 'ใบเสนอราคา', - status: getStatus(quotationFormData.value.quotationStatus, -1, -1), + status: getStatus(quotationFormData.value.quotationStatus, 0, -1), active: () => view.value === View.Quotation, handler: () => (view.value = View.Quotation), }, { title: 'ลูกค้าตอบรับ', - status: getStatus(quotationFormData.value.quotationStatus, 0, -1), + status: getStatus(quotationFormData.value.quotationStatus, 1, 0), active: () => view.value === View.Accepted, handler: () => (view.value = View.Accepted), }, { title: 'ใบแจ้งหนี้', - status: getStatus(quotationFormData.value.quotationStatus, 4, 0), + status: getStatus(quotationFormData.value.quotationStatus, 4, 1), active: () => view.value === View.Invoice || view.value === View.InvoicePre, handler: () => { @@ -889,9 +889,13 @@ function getStatus( doneIndex: number, doingIndex: number, ) { - return QUOTATION_STATUS.findIndex((v) => v === status) > doneIndex + console.log( + status, + QUOTATION_STATUS.findIndex((v) => v === status), + ); + return QUOTATION_STATUS.findIndex((v) => v === status) >= doneIndex ? 'done' - : QUOTATION_STATUS.findIndex((v) => v === status) > doingIndex + : QUOTATION_STATUS.findIndex((v) => v === status) >= doingIndex ? 'doing' : 'waiting'; }