feat: remember selected worker for product

This commit is contained in:
Methapon Metanipat 2024-10-11 11:11:16 +07:00
parent a31d95e496
commit 98c10c2fa1
2 changed files with 28 additions and 28 deletions

View file

@ -40,13 +40,6 @@ const rows = defineModel<
Required<QuotationPayload['productServiceList'][number]>[]
>('rows', { required: true });
const groupList = ref<
{
title: string;
product: QuotationPayload['productServiceList'][number][];
}[]
>([{ title: '', product: [] }]);
const finalDiscount = defineModel<number>('finalDiscount', { default: 0 });
const summaryPrice = defineModel<{
@ -181,7 +174,7 @@ function openEmployeeTable(title: string, index: number) {
!currentBtnOpen.value[0].opened[index];
}
function groupByServiceId() {
function groupByServiceId(data: typeof rows.value) {
const groupedItems: {
title: string;
product: QuotationPayload['productServiceList'][number][];
@ -191,7 +184,7 @@ function groupByServiceId() {
let currentServiceName: string | null = null;
let serviceFlag: boolean = false;
rows.value.forEach((item) => {
data.forEach((item) => {
if (item.service) {
if (noServiceGroup.length > 0) {
// console.log('push p changmode');
@ -244,7 +237,7 @@ function groupByServiceId() {
});
}
groupList.value = groupedItems;
return groupedItems;
}
function handleCheck(
@ -259,13 +252,6 @@ function handleCheck(
}
}
watch(
() => rows.value,
() => {
if (rows.value.length > 0) groupByServiceId();
},
);
watch(
() => summary.value,
() => {
@ -289,7 +275,11 @@ watch(
<template>
<div class="column">
<div class="full-width">
<section v-for="(item, i) in groupList" :key="i" class="q-pb-md">
<section
v-for="(item, i) in groupByServiceId(rows)"
:key="i"
class="q-pb-md"
>
<div
v-if="item.title && !item.title.includes('_product')"
class="q-py-sm q-px-md bordered"