fix: add product mode + service page
This commit is contained in:
parent
9bf966f2cd
commit
e48946d4e7
1 changed files with 107 additions and 40 deletions
|
|
@ -66,8 +66,8 @@ const inputSearch = 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);
|
||||||
const isType = ref<boolean>(false);
|
|
||||||
const groupName = ref<string>('test');
|
const groupName = ref<string>('งาน MOU');
|
||||||
const dialogProductServiceType = ref<boolean>(false);
|
const dialogProductServiceType = ref<boolean>(false);
|
||||||
const dialogTotalProduct = ref<boolean>(false);
|
const dialogTotalProduct = ref<boolean>(false);
|
||||||
const productMode = ref<'group' | 'type' | 'service' | 'product'>('group');
|
const productMode = ref<'group' | 'type' | 'service' | 'product'>('group');
|
||||||
|
|
@ -110,7 +110,7 @@ async function deleteProductById() {
|
||||||
persistent: true,
|
persistent: true,
|
||||||
message: t('deleteConfirmMessage'),
|
message: t('deleteConfirmMessage'),
|
||||||
action: async () => {
|
action: async () => {
|
||||||
if (isType.value) {
|
if (productMode.value === 'type') {
|
||||||
// Product Type
|
// Product Type
|
||||||
} else {
|
} else {
|
||||||
// Product Group
|
// Product Group
|
||||||
|
|
@ -184,16 +184,20 @@ onMounted(async () => {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v class="column q-pb-lg">
|
<div v class="column q-pb-lg">
|
||||||
<div v-if="isType" class="row items-center q-mb-md">
|
<div
|
||||||
|
v-if="productMode === 'group'"
|
||||||
|
class="text-h6 text-weight-bold q-mb-md"
|
||||||
|
></div>
|
||||||
|
<div v-else-if="productMode === 'type'" class="row items-center q-mb-md">
|
||||||
<q-btn
|
<q-btn
|
||||||
round
|
round
|
||||||
icon="mdi-arrow-left"
|
icon="mdi-arrow-left"
|
||||||
flat
|
flat
|
||||||
dense
|
dense
|
||||||
@click="isType = false"
|
@click="productMode = 'group'"
|
||||||
class="q-mr-md"
|
class="q-mr-md"
|
||||||
/>
|
/>
|
||||||
<div class="text-h6 app-text-muted q-mr-sm">
|
<div class="text-h6 app-text-muted q-mr-sm hover-underline">
|
||||||
{{ groupName }}
|
{{ groupName }}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-h6 app-text-muted q-mx-sm">/</div>
|
<div class="text-h6 app-text-muted q-mx-sm">/</div>
|
||||||
|
|
@ -201,42 +205,59 @@ onMounted(async () => {
|
||||||
{{ $t('ProductAndServiceType') }}
|
{{ $t('ProductAndServiceType') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="text-h6 text-weight-bold q-mb-md">
|
<div v-else-if="productMode === 'service'" class="row items-center q-mb-md">
|
||||||
{{ $t('ProductAndService') }}
|
|
||||||
// ปุ่มเลือกสร้าง
|
|
||||||
<q-btn
|
<q-btn
|
||||||
unelevated
|
|
||||||
@click="dialogProductServiceType = true"
|
|
||||||
size="lg"
|
|
||||||
class="color-btn"
|
|
||||||
icon="mdi-plus"
|
|
||||||
round
|
|
||||||
/>
|
|
||||||
// ปุ่มรวมสินค้าทั้งหมด
|
|
||||||
<q-btn
|
|
||||||
unelevated
|
|
||||||
@click="dialogTotalProduct = true"
|
|
||||||
size="lg"
|
|
||||||
class="color-btn"
|
|
||||||
icon="mdi-plus"
|
|
||||||
round
|
round
|
||||||
|
icon="mdi-arrow-left"
|
||||||
|
flat
|
||||||
|
dense
|
||||||
|
@click="productMode = 'type'"
|
||||||
|
class="q-mr-md"
|
||||||
/>
|
/>
|
||||||
|
<div class="text-h6 app-text-muted q-mr-sm hover-underline">
|
||||||
|
{{ groupName }}
|
||||||
|
</div>
|
||||||
|
<div class="text-h6 app-text-muted q-mx-sm">/</div>
|
||||||
|
<div class="text-h6 app-text-muted q-mr-sm hover-underline">
|
||||||
|
{{ 'บริการพิสูจน์สัญชาติ' }}
|
||||||
|
</div>
|
||||||
|
<div class="text-h6 app-text-muted q-mx-sm">/</div>
|
||||||
|
<div class="text-h6 text-weight-bold">
|
||||||
|
{{ $t('mainProductTitle') }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<AppBox bordered class="q-mb-md">
|
<AppBox
|
||||||
|
v-if="productMode === 'group' || productMode === 'type'"
|
||||||
|
bordered
|
||||||
|
class="q-mb-md"
|
||||||
|
>
|
||||||
<StatCard label-i18n :branch="stat" :dark="$q.dark.isActive" />
|
<StatCard label-i18n :branch="stat" :dark="$q.dark.isActive" />
|
||||||
</AppBox>
|
</AppBox>
|
||||||
<AppBox bordered style="min-height: 80vh">
|
<AppBox
|
||||||
|
v-if="productMode === 'group' || productMode === 'type'"
|
||||||
|
bordered
|
||||||
|
style="min-height: 80vh"
|
||||||
|
>
|
||||||
<div class="row justify-between">
|
<div class="row justify-between">
|
||||||
<div v-if="isType" class="text-h6 text-weight-bold q-mb-md">
|
<div
|
||||||
|
v-if="productMode === 'type'"
|
||||||
|
class="text-h6 text-weight-bold q-mb-md"
|
||||||
|
>
|
||||||
{{ $t('ProductAndServiceType') }}
|
{{ $t('ProductAndServiceType') }}
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="text-h6 text-weight-bold q-mb-md">
|
<div
|
||||||
|
v-else-if="productMode === 'group'"
|
||||||
|
class="text-h6 text-weight-bold q-mb-md"
|
||||||
|
>
|
||||||
{{ $t('ProductAndServiceAll') }}
|
{{ $t('ProductAndServiceAll') }}
|
||||||
</div>
|
</div>
|
||||||
<div class="row q-px-md q-pb-md">
|
<div
|
||||||
|
v-if="productMode === 'group' || productMode === 'type'"
|
||||||
|
class="row q-px-md q-pb-md"
|
||||||
|
>
|
||||||
<q-input
|
<q-input
|
||||||
style="width: 250px"
|
style="width: 300px"
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
:label="$t('search')"
|
:label="$t('search')"
|
||||||
|
|
@ -244,7 +265,11 @@ onMounted(async () => {
|
||||||
:bg-color="$q.dark.isActive ? 'dark' : 'white'"
|
:bg-color="$q.dark.isActive ? 'dark' : 'white'"
|
||||||
v-model="inputSearch"
|
v-model="inputSearch"
|
||||||
debounce="500"
|
debounce="500"
|
||||||
></q-input>
|
>
|
||||||
|
<template v-slot:prepend>
|
||||||
|
<q-icon name="mdi-magnify" />
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
<q-btn
|
<q-btn
|
||||||
icon="mdi-tune-vertical-variant"
|
icon="mdi-tune-vertical-variant"
|
||||||
size="sm"
|
size="sm"
|
||||||
|
|
@ -284,11 +309,11 @@ onMounted(async () => {
|
||||||
<div class="row q-col-gutter-lg">
|
<div class="row q-col-gutter-lg">
|
||||||
<div
|
<div
|
||||||
:class="`${$q.screen.gt.sm ? 'col-3' : $q.screen.gt.xs ? 'col-6' : 'col-12'}`"
|
:class="`${$q.screen.gt.sm ? 'col-3' : $q.screen.gt.xs ? 'col-6' : 'col-12'}`"
|
||||||
v-for="(v, i) in isType ? productGroup : productGroup"
|
v-for="(v, i) in productMode ? productGroup : productGroup"
|
||||||
:key="i"
|
:key="i"
|
||||||
>
|
>
|
||||||
<ProductCardComponent
|
<ProductCardComponent
|
||||||
v-if="isType"
|
v-if="productMode === 'type'"
|
||||||
:title="cardTypeData.title"
|
:title="cardTypeData.title"
|
||||||
:subtitle="cardTypeData.subtitle"
|
:subtitle="cardTypeData.subtitle"
|
||||||
:date="cardTypeData.date"
|
:date="cardTypeData.date"
|
||||||
|
|
@ -303,12 +328,12 @@ onMounted(async () => {
|
||||||
@on-click="
|
@on-click="
|
||||||
() => {
|
() => {
|
||||||
currentId = v.id;
|
currentId = v.id;
|
||||||
if (isType === true) drawerInfo = true;
|
productMode = 'service';
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
<ProductCardComponent
|
<ProductCardComponent
|
||||||
v-else
|
v-else-if="productMode === 'group'"
|
||||||
:title="v.name"
|
:title="v.name"
|
||||||
:subtitle="v.code"
|
:subtitle="v.code"
|
||||||
:date="new Date(v.updatedAt)"
|
:date="new Date(v.updatedAt)"
|
||||||
|
|
@ -324,7 +349,7 @@ onMounted(async () => {
|
||||||
@on-click="
|
@on-click="
|
||||||
() => {
|
() => {
|
||||||
currentId = v.id;
|
currentId = v.id;
|
||||||
if (isType === false) isType = true;
|
productMode = 'type';
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
|
|
@ -333,13 +358,13 @@ onMounted(async () => {
|
||||||
:class="`${$q.screen.gt.sm ? 'col-3' : $q.screen.gt.xs ? 'col-6' : 'col-12'}`"
|
:class="`${$q.screen.gt.sm ? 'col-3' : $q.screen.gt.xs ? 'col-6' : 'col-12'}`"
|
||||||
>
|
>
|
||||||
<NewProductCardCompoent
|
<NewProductCardCompoent
|
||||||
v-if="isType"
|
v-if="productMode === 'type'"
|
||||||
:label="$t('ProductAndServiceType')"
|
:label="$t('ProductAndServiceType')"
|
||||||
:isType="true"
|
:isType="true"
|
||||||
@on-click="() => (dialogInputForm = true)"
|
@on-click="() => (dialogInputForm = true)"
|
||||||
/>
|
/>
|
||||||
<NewProductCardCompoent
|
<NewProductCardCompoent
|
||||||
v-else
|
v-else-if="productMode === 'group'"
|
||||||
:label="$t('ProductAndService')"
|
:label="$t('ProductAndService')"
|
||||||
:isType="false"
|
:isType="false"
|
||||||
@on-click="() => (dialogInputForm = true)"
|
@on-click="() => (dialogInputForm = true)"
|
||||||
|
|
@ -347,6 +372,48 @@ onMounted(async () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</AppBox>
|
</AppBox>
|
||||||
|
<AppBox bordered v-else-if="productMode === 'service'" no-padding>
|
||||||
|
<div
|
||||||
|
class="row justify-center q-py-sm"
|
||||||
|
style="background-color: var(--surface-2)"
|
||||||
|
>
|
||||||
|
<q-input
|
||||||
|
style="width: 500px"
|
||||||
|
outlined
|
||||||
|
dense
|
||||||
|
:label="$t('search')"
|
||||||
|
class="q-mr-md"
|
||||||
|
:bg-color="$q.dark.isActive ? 'dark' : 'white'"
|
||||||
|
v-model="inputSearch"
|
||||||
|
debounce="500"
|
||||||
|
>
|
||||||
|
<template v-slot:prepend>
|
||||||
|
<q-icon name="mdi-magnify" />
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
|
<q-btn
|
||||||
|
icon="mdi-plus"
|
||||||
|
:color="$q.dark.isActive ? 'dark' : 'white'"
|
||||||
|
:text-color="$q.dark.isActive ? 'white' : 'dark'"
|
||||||
|
class="bordered rounded q-px-sm"
|
||||||
|
unelevated
|
||||||
|
@click="dialogProductServiceType = true"
|
||||||
|
/>
|
||||||
|
<div class="q-mx-lg">ปุ่มรวมสินค้าทั้งหมด >></div>
|
||||||
|
<q-btn
|
||||||
|
unelevated
|
||||||
|
@click="dialogTotalProduct = true"
|
||||||
|
class="bordered rounded q-px-sm"
|
||||||
|
icon="mdi-plus"
|
||||||
|
:color="$q.dark.isActive ? 'dark' : 'white'"
|
||||||
|
:text-color="$q.dark.isActive ? 'white' : 'dark'"
|
||||||
|
round
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="flex justify-center items-center" style="min-height: 70vh">
|
||||||
|
asdasdasd
|
||||||
|
</div>
|
||||||
|
</AppBox>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<FormDialog
|
<FormDialog
|
||||||
|
|
@ -363,7 +430,7 @@ onMounted(async () => {
|
||||||
<template #information>
|
<template #information>
|
||||||
<BasicInformation
|
<BasicInformation
|
||||||
dense
|
dense
|
||||||
:isType="isType"
|
:isType="productMode === 'type'"
|
||||||
v-model:remark="formData.remark"
|
v-model:remark="formData.remark"
|
||||||
v-model:name="formData.name"
|
v-model:name="formData.name"
|
||||||
v-model:detail="formData.detail"
|
v-model:detail="formData.detail"
|
||||||
|
|
@ -378,7 +445,7 @@ onMounted(async () => {
|
||||||
:undo="() => undoProductGroup()"
|
:undo="() => undoProductGroup()"
|
||||||
:isEdit="isEdit"
|
:isEdit="isEdit"
|
||||||
:editData="() => (isEdit = true)"
|
:editData="() => (isEdit = true)"
|
||||||
:submit="() => (isType ? submitType() : submitGroup())"
|
:submit="() => (productMode === 'type' ? submitType() : submitGroup())"
|
||||||
:delete-data="() => deleteProductById()"
|
:delete-data="() => deleteProductById()"
|
||||||
:close="() => (drawerInfo = false)"
|
:close="() => (drawerInfo = false)"
|
||||||
>
|
>
|
||||||
|
|
@ -386,7 +453,7 @@ onMounted(async () => {
|
||||||
<AppBox class="q-ma-md" bordered>
|
<AppBox class="q-ma-md" bordered>
|
||||||
<BasicInformation
|
<BasicInformation
|
||||||
dense
|
dense
|
||||||
:isType="isType"
|
:isType="productMode === 'type'"
|
||||||
:readonly="!isEdit"
|
:readonly="!isEdit"
|
||||||
v-model:remark="formData.remark"
|
v-model:remark="formData.remark"
|
||||||
v-model:name="formData.name"
|
v-model:name="formData.name"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue