fix: service use utils function & confirm delete
This commit is contained in:
parent
1822051a78
commit
44cd753fc3
3 changed files with 277 additions and 247 deletions
|
|
@ -1,5 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import { Icon } from '@iconify/vue';
|
||||
import { formatNumberDecimal } from 'src/stores/utils';
|
||||
|
||||
defineProps<{
|
||||
workIndex: number;
|
||||
|
|
@ -14,15 +15,19 @@ const productItems = defineModel<
|
|||
label: string;
|
||||
labelEn: string;
|
||||
code: string;
|
||||
price: string;
|
||||
price: number;
|
||||
time: string;
|
||||
}[]
|
||||
>('productItems');
|
||||
>('productItems', { required: true });
|
||||
|
||||
defineEmits<{
|
||||
(e: 'addProduct'): void;
|
||||
(e: 'moveWorkUp'): void;
|
||||
(e: 'moveWorkDown'): void;
|
||||
(e: 'deleteWork'): void;
|
||||
(e: 'deleteProduct'): void;
|
||||
(e: 'addProduct'): void;
|
||||
(e: 'moveProductUp', items: unknown[], index: number): void;
|
||||
(e: 'moveProductDown', items: unknown[], index: number): void;
|
||||
(e: 'deleteProduct', items: unknown[], index: number): void;
|
||||
}>();
|
||||
</script>
|
||||
<template>
|
||||
|
|
@ -34,18 +39,19 @@ defineEmits<{
|
|||
expand-icon="mdi-chevron-down-circle"
|
||||
>
|
||||
<template v-slot:header>
|
||||
<div class="row items-center q-py-sm full-width">
|
||||
<div class="row items-center q-py-sm full-width" @click.stop>
|
||||
<q-btn
|
||||
id="btn-swap-work-product"
|
||||
id="btn-work-up-product"
|
||||
icon="mdi-arrow-up"
|
||||
dense
|
||||
flat
|
||||
round
|
||||
:disable="index === 0"
|
||||
style="color: hsl(var(--text-mute-2))"
|
||||
@click.stop="$emit('moveWorkUp')"
|
||||
/>
|
||||
<q-btn
|
||||
id="btn-swap-work-product"
|
||||
id="btn-work-down-product"
|
||||
icon="mdi-arrow-down"
|
||||
dense
|
||||
flat
|
||||
|
|
@ -53,6 +59,7 @@ defineEmits<{
|
|||
class="q-mx-sm"
|
||||
:disable="index === length - 1"
|
||||
style="color: hsl(var(--text-mute-2))"
|
||||
@click.stop="$emit('moveWorkDown')"
|
||||
/>
|
||||
<q-input
|
||||
for="input-work-name"
|
||||
|
|
@ -94,7 +101,7 @@ defineEmits<{
|
|||
padding="0"
|
||||
color="negative"
|
||||
class="q-ml-sm"
|
||||
@click="$emit('deleteWork')"
|
||||
@click.stop="$emit('deleteWork')"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -112,7 +119,7 @@ defineEmits<{
|
|||
:label="$t('serviceAddProduct')"
|
||||
padding="0"
|
||||
style="color: hsl(var(--info-bg))"
|
||||
@click="$emit('addProduct')"
|
||||
@click.stop="$emit('addProduct')"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
@ -127,16 +134,17 @@ defineEmits<{
|
|||
>
|
||||
<div class="row items-center col-9 no-wrap" v-if="productItems">
|
||||
<q-btn
|
||||
id="btn-swap-work-product"
|
||||
id="btn-product-up"
|
||||
icon="mdi-arrow-up"
|
||||
dense
|
||||
flat
|
||||
round
|
||||
:disable="index === 0"
|
||||
style="color: hsl(var(--text-mute-2))"
|
||||
@click.stop="$emit('moveProductUp', productItems, index)"
|
||||
/>
|
||||
<q-btn
|
||||
id="btn-swap-work-product"
|
||||
id="btn-product-down"
|
||||
icon="mdi-arrow-down"
|
||||
dense
|
||||
flat
|
||||
|
|
@ -144,6 +152,7 @@ defineEmits<{
|
|||
class="q-mx-sm"
|
||||
:disable="index === productItems.length - 1"
|
||||
style="color: hsl(var(--text-mute-2))"
|
||||
@click.stop="$emit('moveProductDown', productItems, index)"
|
||||
/>
|
||||
|
||||
<q-avatar
|
||||
|
|
@ -194,7 +203,7 @@ defineEmits<{
|
|||
class="col-12 text-weight-bold text-h6"
|
||||
style="color: var(--teal-9)"
|
||||
>
|
||||
฿ {{ product.price }}
|
||||
฿ {{ formatNumberDecimal(product.price, 2) }}
|
||||
</span>
|
||||
<span class="col-9 text-caption app-text-muted-2">
|
||||
{{ $t('processTime') }}
|
||||
|
|
@ -213,7 +222,7 @@ defineEmits<{
|
|||
round
|
||||
color="negative"
|
||||
class="q-mx-sm"
|
||||
@click="$emit('deleteProduct')"
|
||||
@click.stop="$emit('deleteProduct', productItems, index)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue