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 workerList = ref<Employee[]>([]);
const selectedProductGroup = ref(''); const selectedProductGroup = ref('');
const selectedInstallmentNo = ref<number[]>([]);
const agentPrice = ref(false); const agentPrice = ref(false);
const summaryPrice = computed(() => const summaryPrice = computed(() =>
productServiceList.value.reduce( productServiceList.value.reduce(
(a, c) => { (a, c) => {
if (
selectedInstallmentNo.value.length > 0 &&
c.installmentNo &&
!selectedInstallmentNo.value.includes(c.installmentNo)
) {
return a;
}
const price = precisionRound(c.pricePerUnit * c.amount); const price = precisionRound(c.pricePerUnit * c.amount);
const vat = precisionRound( const vat = precisionRound(
(c.pricePerUnit * c.amount - c.discount) * (config.value?.vat || 0.07), (c.pricePerUnit * c.amount - c.discount) * (config.value?.vat || 0.07),
@ -1076,7 +1085,18 @@ const view = ref<View>(View.Quotation);
})) }))
" "
@delete="toggleDeleteProduct" @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> </div>
</q-expansion-item> </q-expansion-item>