fix: count บริการไม่อัพเดท + ลบชื่อของบริการตอนแก้ไข

This commit is contained in:
oat_dev 2024-07-10 11:54:22 +07:00
parent 56f880c4e3
commit 96107502ac

View file

@ -932,7 +932,10 @@ async function submitService() {
formDataProductService.value.registeredBranchId = null; formDataProductService.value.registeredBranchId = null;
} }
await createService(formDataProductService.value); const res = await createService(formDataProductService.value);
if (res) {
stat.value[2].count = stat.value[2].count + 1;
}
totalService.value = totalService.value + 1; totalService.value = totalService.value + 1;
productAndServiceTab.value = 'service'; productAndServiceTab.value = 'service';
} }
@ -949,6 +952,7 @@ async function submitService() {
if (productAndServiceTab.value === 'service') { if (productAndServiceTab.value === 'service') {
await fetchListOfService(); await fetchListOfService();
} }
flowStore.rotate(); flowStore.rotate();
clearFormService(); clearFormService();
} }
@ -1445,7 +1449,6 @@ watch(inputSearchProductAndService, async () => {
</div> </div>
</div> </div>
<div <div
v-if=" v-if="
(productMode === 'type' && productType?.length === 0) || (productMode === 'type' && productType?.length === 0) ||
@ -1457,7 +1460,6 @@ watch(inputSearchProductAndService, async () => {
<NoData :not-found="!!inputSearch" /> <NoData :not-found="!!inputSearch" />
</div> </div>
<template v-else> <template v-else>
<div class="col flex scroll full-height q-pa-md surface-1"> <div class="col flex scroll full-height q-pa-md surface-1">
<div class="full-width"> <div class="full-width">
<q-table <q-table
@ -1520,7 +1522,9 @@ watch(inputSearchProductAndService, async () => {
" "
> >
<q-td <q-td
v-if="tbControl.groupAndType.fieldSelected.includes('name')" v-if="
tbControl.groupAndType.fieldSelected.includes('name')
"
> >
<div class="row items-center"> <div class="row items-center">
<div <div
@ -1575,7 +1579,9 @@ watch(inputSearchProductAndService, async () => {
<q-td <q-td
v-if=" v-if="
tbControl.groupAndType.fieldSelected.includes('createdAt') tbControl.groupAndType.fieldSelected.includes(
'createdAt',
)
" "
> >
{{ dateFormat(props.row.createdAt) }} {{ dateFormat(props.row.createdAt) }}
@ -1649,7 +1655,6 @@ watch(inputSearchProductAndService, async () => {
} }
} }
" "
dense dense
class="row q-py-sm" class="row q-py-sm"
style="white-space: nowrap" style="white-space: nowrap"
@ -1666,7 +1671,6 @@ watch(inputSearchProductAndService, async () => {
</q-item> </q-item>
<q-item <q-item
:id="`view-detail-btn-${props.row.name}-edit`" :id="`view-detail-btn-${props.row.name}-edit`"
v-close-popup v-close-popup
clickable clickable
@ -1705,14 +1709,14 @@ watch(inputSearchProductAndService, async () => {
</q-item> </q-item>
<q-item <q-item
v-close-popup v-close-popup
:id="`view-detail-btn-${props.row.name}-delete`" :id="`view-detail-btn-${props.row.name}-delete`"
dense dense
:clickable="props.row.status === 'CREATED'" :clickable="props.row.status === 'CREATED'"
class="row" class="row"
:class="{ :class="{
'surface-3': props.row.status !== 'CREATED', 'surface-3': props.row.status !== 'CREATED',
'app-text-muted': props.row.status !== 'CREATED', 'app-text-muted':
props.row.status !== 'CREATED',
}" }"
style="white-space: nowrap" style="white-space: nowrap"
@click=" @click="
@ -1768,7 +1772,9 @@ watch(inputSearchProductAndService, async () => {
} }
} }
" "
:model-value="props.row.status !== 'INACTIVE'" :model-value="
props.row.status !== 'INACTIVE'
"
/> />
</div> </div>
</q-item-section> </q-item-section>
@ -1886,12 +1892,9 @@ watch(inputSearchProductAndService, async () => {
</div> </div>
</template> </template>
</q-table> </q-table>
</div> </div>
</div> </div>
<div <div
v-if="productMode === 'group'" v-if="productMode === 'group'"
class="row items-center justify-between q-px-md q-py-sm" class="row items-center justify-between q-px-md q-py-sm"
@ -2056,7 +2059,6 @@ watch(inputSearchProductAndService, async () => {
<q-menu class="bordered"> <q-menu class="bordered">
<q-list v-close-popup dense> <q-list v-close-popup dense>
<q-item <q-item
clickable clickable
class="flex items-center" class="flex items-center"
@click=" @click="
@ -2173,7 +2175,7 @@ watch(inputSearchProductAndService, async () => {
</div> </div>
</div> </div>
<q-tabs <q-tabs
dense dense
v-model="productAndServiceTab" v-model="productAndServiceTab"
class="bordered-b q-px-md" class="bordered-b q-px-md"
@ -2238,7 +2240,6 @@ watch(inputSearchProductAndService, async () => {
</div> </div>
<!-- tab --> <!-- tab -->
<template v-else> <template v-else>
<div class="col flex scroll full-height q-pa-md surface-1"> <div class="col flex scroll full-height q-pa-md surface-1">
<div class="full-width"> <div class="full-width">
<q-table <q-table
@ -2466,7 +2467,6 @@ watch(inputSearchProductAndService, async () => {
<q-menu class="bordered"> <q-menu class="bordered">
<q-list v-close-popup> <q-list v-close-popup>
<q-item <q-item
:id="`view-detail-btn-${props.row.name}-view`" :id="`view-detail-btn-${props.row.name}-view`"
@click.stop=" @click.stop="
async () => { async () => {
@ -2541,7 +2541,6 @@ watch(inputSearchProductAndService, async () => {
:id="`view-detail-btn-${props.row.name}-delete`" :id="`view-detail-btn-${props.row.name}-delete`"
dense dense
v-close-popup v-close-popup
:clickable="props.row.status === 'CREATED'" :clickable="props.row.status === 'CREATED'"
class="row" class="row"
:class="{ :class="{
@ -2550,16 +2549,16 @@ watch(inputSearchProductAndService, async () => {
props.row.status !== 'CREATED', props.row.status !== 'CREATED',
}" }"
style="white-space: nowrap" style="white-space: nowrap"
@click="()=>{ @click="
if (props.row.type === 'product'){ () => {
deleteTypeOfProduct(props.row.id) if (props.row.type === 'product') {
deleteTypeOfProduct(props.row.id);
} }
if (props.row.type === 'service') { if (props.row.type === 'service') {
deleteServiceById(props.row.id) deleteServiceById(props.row.id);
} }
} }
" "
> >
<q-icon <q-icon
name="mdi-trash-can-outline" name="mdi-trash-can-outline"
@ -3210,7 +3209,7 @@ watch(inputSearchProductAndService, async () => {
:edit="!(formDataProductService.status === 'INACTIVE')" :edit="!(formDataProductService.status === 'INACTIVE')"
height="95vh" height="95vh"
:isEdit="infoServiceEdit" :isEdit="infoServiceEdit"
:title="$t('service', { msg: formDataProductService.name })" :title="$t('service')"
:tabs-list="serviceTab" :tabs-list="serviceTab"
v-model:modal="dialogServiceEdit" v-model:modal="dialogServiceEdit"
v-model:current-tab="currentServiceTab" v-model:current-tab="currentServiceTab"