feat: แก้ สถานะ
This commit is contained in:
parent
52baaca35e
commit
fc002b9ca0
3 changed files with 116 additions and 26 deletions
|
|
@ -10,6 +10,8 @@ withDefaults(
|
||||||
status?: Status;
|
status?: Status;
|
||||||
date?: Date;
|
date?: Date;
|
||||||
isType?: boolean;
|
isType?: boolean;
|
||||||
|
id?: string;
|
||||||
|
isDisabled?: boolean;
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
color: 'var(--brand-1)',
|
color: 'var(--brand-1)',
|
||||||
|
|
@ -19,8 +21,16 @@ withDefaults(
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="full-width rounded hover-card bordered q-pa-sm"
|
class="full-width rounded bordered q-pa-sm"
|
||||||
@click="$emit('onClick')"
|
@click="
|
||||||
|
() => {
|
||||||
|
if (!isDisabled) $emit('onClick');
|
||||||
|
}
|
||||||
|
"
|
||||||
|
:class="{
|
||||||
|
'hover-card': !isDisabled,
|
||||||
|
'disabled-card': isDisabled,
|
||||||
|
}"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="relative-position rounded q-pb-lg"
|
class="relative-position rounded q-pb-lg"
|
||||||
|
|
@ -52,7 +62,11 @@ withDefaults(
|
||||||
dense
|
dense
|
||||||
class="row q-py-sm"
|
class="row q-py-sm"
|
||||||
style="white-space: nowrap"
|
style="white-space: nowrap"
|
||||||
@click="$emit('viewCard')"
|
@click="
|
||||||
|
() => {
|
||||||
|
if (!isDisabled) $emit('viewCard');
|
||||||
|
}
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<q-icon
|
<q-icon
|
||||||
name="mdi-eye-outline"
|
name="mdi-eye-outline"
|
||||||
|
|
@ -69,7 +83,13 @@ withDefaults(
|
||||||
clickable
|
clickable
|
||||||
class="row q-py-sm"
|
class="row q-py-sm"
|
||||||
style="white-space: nowrap"
|
style="white-space: nowrap"
|
||||||
@click="$emit('updateCard')"
|
@click="
|
||||||
|
() => {
|
||||||
|
if (!isDisabled) {
|
||||||
|
$emit('updateCard');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"
|
||||||
v-close-popup
|
v-close-popup
|
||||||
>
|
>
|
||||||
<q-icon
|
<q-icon
|
||||||
|
|
@ -85,7 +105,11 @@ withDefaults(
|
||||||
<q-item
|
<q-item
|
||||||
dense
|
dense
|
||||||
clickable
|
clickable
|
||||||
@click="$emit('deleteCard')"
|
@click="
|
||||||
|
() => {
|
||||||
|
if (!isDisabled) $emit('deleteCard');
|
||||||
|
}
|
||||||
|
"
|
||||||
v-close-popup
|
v-close-popup
|
||||||
>
|
>
|
||||||
<q-icon
|
<q-icon
|
||||||
|
|
@ -97,6 +121,28 @@ withDefaults(
|
||||||
{{ $t('delete') }}
|
{{ $t('delete') }}
|
||||||
</span>
|
</span>
|
||||||
</q-item>
|
</q-item>
|
||||||
|
<q-item dense>
|
||||||
|
<q-item-section class="q-py-sm">
|
||||||
|
<div class="q-pa-sm surface-2 rounded">
|
||||||
|
<q-toggle
|
||||||
|
dense
|
||||||
|
size="sm"
|
||||||
|
@click="$emit('toggleStatus', id)"
|
||||||
|
:model-value="isDisabled"
|
||||||
|
val="xs"
|
||||||
|
padding="none"
|
||||||
|
>
|
||||||
|
<div class="q-ml-xs">
|
||||||
|
{{
|
||||||
|
isDisabled
|
||||||
|
? $t('switchOnLabel')
|
||||||
|
: $t('switchOffLabel')
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
|
</q-toggle>
|
||||||
|
</div>
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
</q-list>
|
</q-list>
|
||||||
</q-menu>
|
</q-menu>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
|
|
@ -142,7 +188,13 @@ withDefaults(
|
||||||
{{ dateFormat(date) }}
|
{{ dateFormat(date) }}
|
||||||
</div>
|
</div>
|
||||||
<q-btn
|
<q-btn
|
||||||
@click.stop="$emit('viewDetail')"
|
@click.stop="
|
||||||
|
() => {
|
||||||
|
if (!isDisabled) {
|
||||||
|
$emit('viewDetail');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"
|
||||||
unelevated
|
unelevated
|
||||||
class="q-px-sm"
|
class="q-px-sm"
|
||||||
:label="$t('detail')"
|
:label="$t('detail')"
|
||||||
|
|
@ -171,4 +223,9 @@ withDefaults(
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
box-shadow: var(--shadow-3);
|
box-shadow: var(--shadow-3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.disabled-card {
|
||||||
|
opacity: 0.5;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import TotalProductCardComponent from 'components/04_product-service/TotalProduc
|
||||||
style="
|
style="
|
||||||
width: 75vw;
|
width: 75vw;
|
||||||
display: grid;
|
display: grid;
|
||||||
|
background: none;
|
||||||
grid-template-columns: repeat(4, 1fr);
|
grid-template-columns: repeat(4, 1fr);
|
||||||
gap: var(--size-3);
|
gap: var(--size-3);
|
||||||
"
|
"
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,8 @@ import { onMounted } from 'vue';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const inputSearch = ref<string>('');
|
const inputSearch = ref<string>('');
|
||||||
|
const searchTotalProduct = ref<string>('');
|
||||||
|
|
||||||
const drawerInfo = ref<boolean>(false);
|
const drawerInfo = ref<boolean>(false);
|
||||||
const isEdit = ref<boolean>(false);
|
const isEdit = ref<boolean>(false);
|
||||||
const dialogInputForm = ref<boolean>(false);
|
const dialogInputForm = ref<boolean>(false);
|
||||||
|
|
@ -99,7 +101,7 @@ const profileUrl = ref<string | null>('');
|
||||||
|
|
||||||
const groupName = ref<string>('งาน MOU');
|
const groupName = ref<string>('งาน MOU');
|
||||||
const dialogProductServiceType = ref<boolean>(false);
|
const dialogProductServiceType = ref<boolean>(false);
|
||||||
const dialogTotalProduct = ref<boolean>(false);
|
const dialogTotalProduct = ref<boolean>(true);
|
||||||
const productMode = ref<'group' | 'type' | 'service' | 'product'>('group');
|
const productMode = ref<'group' | 'type' | 'service' | 'product'>('group');
|
||||||
|
|
||||||
const productGroup = ref<ProductGroup[]>();
|
const productGroup = ref<ProductGroup[]>();
|
||||||
|
|
@ -286,6 +288,22 @@ const itemCard = [
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
async function toggleStatusType(id: string, status: Status) {
|
||||||
|
await editProductServiceType(id, {
|
||||||
|
status: status === 'INACTIVE' ? 'ACTIVE' : 'INACTIVE',
|
||||||
|
});
|
||||||
|
|
||||||
|
await fetchListType();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function toggleStatusGroup(id: string, status: Status) {
|
||||||
|
await editProductService(id, {
|
||||||
|
status: status === 'INACTIVE' ? 'ACTIVE' : 'INACTIVE',
|
||||||
|
});
|
||||||
|
|
||||||
|
await fetchListGroups();
|
||||||
|
}
|
||||||
|
|
||||||
async function deleteServiceById(serviceId?: string) {
|
async function deleteServiceById(serviceId?: string) {
|
||||||
dialog({
|
dialog({
|
||||||
color: 'negative',
|
color: 'negative',
|
||||||
|
|
@ -772,7 +790,10 @@ watch(currentStatus, async () => {
|
||||||
:subtitle="v.code"
|
:subtitle="v.code"
|
||||||
:date="new Date(v.updatedAt)"
|
:date="new Date(v.updatedAt)"
|
||||||
:status="v.status"
|
:status="v.status"
|
||||||
|
:id="v.id"
|
||||||
|
:isDisabled="v.status === 'ACTIVE' || v.status === 'CREATED'"
|
||||||
color="var(--purple-11-hsl)"
|
color="var(--purple-11-hsl)"
|
||||||
|
@toggleStatus="toggleStatusType(v.id, v.status)"
|
||||||
@viewCard="
|
@viewCard="
|
||||||
() => {
|
() => {
|
||||||
clearFormGroup();
|
clearFormGroup();
|
||||||
|
|
@ -811,6 +832,9 @@ watch(currentStatus, async () => {
|
||||||
:date="new Date(v.updatedAt)"
|
:date="new Date(v.updatedAt)"
|
||||||
:status="v.status"
|
:status="v.status"
|
||||||
color="var(--pink-6-hsl)"
|
color="var(--pink-6-hsl)"
|
||||||
|
:id="v.id"
|
||||||
|
:isDisabled="v.status === 'ACTIVE' || v.status === 'CREATED'"
|
||||||
|
@toggleStatus="toggleStatusGroup(v.id, v.status)"
|
||||||
@viewCard="
|
@viewCard="
|
||||||
() => {
|
() => {
|
||||||
clearFormGroup();
|
clearFormGroup();
|
||||||
|
|
@ -1111,7 +1135,7 @@ watch(currentStatus, async () => {
|
||||||
v-model:modal="dialogTotalProduct"
|
v-model:modal="dialogTotalProduct"
|
||||||
noAddress
|
noAddress
|
||||||
noAppBox
|
noAppBox
|
||||||
title="รวมสินค้าทั้งหมด (2 ชิ้น)"
|
title="สินค้าทั้งหมด"
|
||||||
:submit="
|
:submit="
|
||||||
() => {
|
() => {
|
||||||
console.log('submit');
|
console.log('submit');
|
||||||
|
|
@ -1119,24 +1143,33 @@ watch(currentStatus, async () => {
|
||||||
"
|
"
|
||||||
:close="() => {}"
|
:close="() => {}"
|
||||||
>
|
>
|
||||||
<template #footer>
|
<div
|
||||||
<div class="row items-center q-gutter-md">
|
style="
|
||||||
<q-icon name="mdi-cart" class="app-text-muted" size="sm" />
|
width: 75vw;
|
||||||
<div class="relative-position" style="bottom: 15px; right: 25px">
|
display: grid;
|
||||||
<div
|
background: none;
|
||||||
class="absolute bg-red text-white flex justify-center text-center rounded items-center"
|
grid-template-rows: auto;
|
||||||
style="width: 16px; height: 16px; font-size: 11px"
|
gap: var(--size-3);
|
||||||
>
|
"
|
||||||
2
|
>
|
||||||
</div>
|
<div class="row items-center">
|
||||||
</div>
|
<q-space />
|
||||||
<div>
|
<q-input
|
||||||
รวมสินค้าทั้งหมด
|
outlined
|
||||||
<div class="text-bold" style="color: var(--green-10)">฿ 2,400</div>
|
dense
|
||||||
</div>
|
:label="$t('search')"
|
||||||
|
:bg-color="$q.dark.isActive ? 'dark' : 'white'"
|
||||||
|
v-model="searchTotalProduct"
|
||||||
|
debounce="500"
|
||||||
|
@update:model-value=""
|
||||||
|
>
|
||||||
|
<template v-slot:prepend>
|
||||||
|
<q-icon name="mdi-magnify" />
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
<TotalProductComponent />
|
||||||
<TotalProductComponent />
|
</div>
|
||||||
</FormDialog>
|
</FormDialog>
|
||||||
|
|
||||||
<!-- Add Product -->
|
<!-- Add Product -->
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue