feat: filter by installment no

This commit is contained in:
Methapon Metanipat 2024-10-28 15:12:07 +07:00
parent 69d1418ba7
commit f1d718fc9b

View file

@ -131,10 +131,19 @@ const selectedWorker = ref<
const workerList = ref<Employee[]>([]);
const selectedProductGroup = ref('');
const selectedInstallmentNo = ref<number[]>([]);
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>(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)
"
/>
</div>
</q-expansion-item>