From f1d718fc9b96fd4b8a1b81b12451e0017f506703 Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Mon, 28 Oct 2024 15:12:07 +0700 Subject: [PATCH] feat: filter by installment no --- src/pages/05_quotation/QuotationForm.vue | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/pages/05_quotation/QuotationForm.vue b/src/pages/05_quotation/QuotationForm.vue index e6540f31..664363d5 100644 --- a/src/pages/05_quotation/QuotationForm.vue +++ b/src/pages/05_quotation/QuotationForm.vue @@ -131,10 +131,19 @@ const selectedWorker = ref< const workerList = ref([]); const selectedProductGroup = ref(''); +const selectedInstallmentNo = ref([]); const agentPrice = ref(false); const summaryPrice = computed(() => productServiceList.value.reduce( (a, c) => { + if ( + selectedInstallmentNo.value.length > 0 && + c.installmentNo && + !selectedInstallmentNo.value.includes(c.installmentNo) + ) { + return a; + } + const price = precisionRound(c.pricePerUnit * c.amount); const vat = precisionRound( (c.pricePerUnit * c.amount - c.discount) * (config.value?.vat || 0.07), @@ -1076,7 +1085,18 @@ const view = ref(View.Quotation); })) " @delete="toggleDeleteProduct" - v-model:rows="productServiceList" + :rows=" + selectedInstallmentNo.length > 0 + ? productServiceList.filter( + (v) => + v.installmentNo && + selectedInstallmentNo.includes(v.installmentNo), + ) + : productServiceList + " + @update:rows=" + (v) => view === View.Quotation && (productServiceList = v) + " />