2024-06-10 16:42:59 +07:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { ref } from 'vue';
|
|
|
|
|
import AppBox from 'components/app/AppBox.vue';
|
|
|
|
|
import ProductCardComponent from 'src/components/04_product-service/ProductCardComponent.vue';
|
|
|
|
|
import StatCard from 'components/StatCardComponent.vue';
|
2024-06-10 17:42:37 +07:00
|
|
|
import NewProductCardCompoent from 'components/04_product-service/NewProductCardComponent.vue';
|
2024-06-11 12:01:35 +07:00
|
|
|
import DrawerInfo from 'src/components/DrawerInfo.vue';
|
|
|
|
|
import BasicInformation from 'src/components/04_product-service/BasicInformation.vue';
|
|
|
|
|
import FormDialog from 'src/components/FormDialog.vue';
|
|
|
|
|
import { dialog } from 'src/stores/utils';
|
2024-06-10 16:42:59 +07:00
|
|
|
const cardData = ref({
|
|
|
|
|
title: 'งาน MCU',
|
|
|
|
|
subtitle: 'G00000000001',
|
2024-06-10 17:42:37 +07:00
|
|
|
color: 'var(--pink-6)',
|
2024-06-10 16:42:59 +07:00
|
|
|
status: true,
|
|
|
|
|
date: new Date(),
|
|
|
|
|
});
|
|
|
|
|
|
2024-06-11 12:01:35 +07:00
|
|
|
const cardTypeData = ref({
|
|
|
|
|
title: 'บริการพิสูจน์สัญชาติ',
|
|
|
|
|
subtitle: 'TG10000000001',
|
|
|
|
|
color: 'var(--purple-11)',
|
|
|
|
|
status: true,
|
|
|
|
|
date: new Date(),
|
|
|
|
|
});
|
|
|
|
|
|
2024-06-10 16:42:59 +07:00
|
|
|
const stat = ref<
|
|
|
|
|
{
|
|
|
|
|
count: number;
|
|
|
|
|
label: string;
|
|
|
|
|
color: 'pink' | 'purple' | 'green';
|
|
|
|
|
}[]
|
|
|
|
|
>([
|
|
|
|
|
{ count: 5, label: 'branchHQLabel', color: 'pink' },
|
|
|
|
|
{ count: 4, label: 'branchLabel', color: 'purple' },
|
|
|
|
|
{ count: 12, label: 'branchLabel', color: 'green' },
|
|
|
|
|
]);
|
|
|
|
|
|
2024-06-11 12:01:35 +07:00
|
|
|
import { useI18n } from 'vue-i18n';
|
|
|
|
|
|
|
|
|
|
const { t } = useI18n();
|
|
|
|
|
|
2024-06-10 16:42:59 +07:00
|
|
|
const inputSearch = ref<string>('');
|
2024-06-11 12:01:35 +07:00
|
|
|
const drawerInfo = ref<boolean>(false);
|
|
|
|
|
const isEdit = ref<boolean>(false);
|
|
|
|
|
const dialogInputForm = ref<boolean>(false);
|
|
|
|
|
const isViewDetailGroup = ref<boolean>(false);
|
|
|
|
|
const groupName = ref<string>('test');
|
|
|
|
|
|
|
|
|
|
const formData = ref({
|
|
|
|
|
remark: '',
|
|
|
|
|
detail: '',
|
|
|
|
|
name: '',
|
|
|
|
|
code: '',
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
async function submitGroup() {
|
|
|
|
|
console.log(formData.value);
|
|
|
|
|
}
|
|
|
|
|
async function submitType() {
|
|
|
|
|
console.log(formData.value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function deleteProductById() {
|
|
|
|
|
dialog({
|
|
|
|
|
color: 'negative',
|
|
|
|
|
icon: 'mdi-alert',
|
|
|
|
|
title: t('deleteConfirmTitle'),
|
|
|
|
|
actionText: t('ok'),
|
|
|
|
|
persistent: true,
|
|
|
|
|
message: t('deleteConfirmMessage'),
|
|
|
|
|
action: async () => {
|
|
|
|
|
console.log('deleted');
|
|
|
|
|
drawerInfo.value = false;
|
|
|
|
|
},
|
|
|
|
|
cancel: () => {},
|
|
|
|
|
});
|
|
|
|
|
}
|
2024-06-10 16:42:59 +07:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2024-06-11 12:01:35 +07:00
|
|
|
<div v class="column q-pb-lg">
|
|
|
|
|
<div v-if="isViewDetailGroup" class="row items-center q-mb-md">
|
|
|
|
|
<q-btn
|
|
|
|
|
round
|
|
|
|
|
icon="mdi-arrow-left"
|
|
|
|
|
flat
|
|
|
|
|
dense
|
|
|
|
|
@click="isViewDetailGroup = false"
|
|
|
|
|
class="q-mr-md"
|
|
|
|
|
/>
|
|
|
|
|
<div class="text-h6 text-weight-bold">
|
|
|
|
|
{{ $t('ProductAndServiceType') }}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="text-h6 app-text-muted q-mx-sm">/</div>
|
|
|
|
|
<div class="text-h6 app-text-muted q-mr-sm hover-underline">
|
|
|
|
|
{{ groupName }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else class="text-h6 text-weight-bold q-mb-md">
|
|
|
|
|
{{ $t('ProductAndService') }}
|
|
|
|
|
</div>
|
2024-06-10 16:42:59 +07:00
|
|
|
<AppBox bordered class="q-mb-md">
|
|
|
|
|
<StatCard label-i18n :branch="stat" :dark="$q.dark.isActive" />
|
|
|
|
|
</AppBox>
|
|
|
|
|
<AppBox bordered style="min-height: 80vh">
|
|
|
|
|
<div class="row justify-between">
|
2024-06-11 12:01:35 +07:00
|
|
|
<div v-if="isViewDetailGroup" class="text-h6 text-weight-bold q-mb-md">
|
|
|
|
|
{{ $t('ProductAndServiceType') }}
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else class="text-h6 text-weight-bold q-mb-md">
|
|
|
|
|
{{ $t('ProductAndServiceAll') }}
|
2024-06-10 16:42:59 +07:00
|
|
|
</div>
|
|
|
|
|
<div class="row q-px-md q-pb-md">
|
|
|
|
|
<q-input
|
|
|
|
|
style="width: 250px"
|
|
|
|
|
outlined
|
|
|
|
|
dense
|
|
|
|
|
:label="$t('search')"
|
|
|
|
|
class="q-mr-lg"
|
|
|
|
|
:bg-color="$q.dark.isActive ? 'dark' : 'white'"
|
|
|
|
|
v-model="inputSearch"
|
|
|
|
|
debounce="500"
|
|
|
|
|
></q-input>
|
|
|
|
|
<q-btn
|
|
|
|
|
icon="mdi-tune-vertical-variant"
|
|
|
|
|
size="sm"
|
|
|
|
|
:color="$q.dark.isActive ? 'dark' : 'white'"
|
|
|
|
|
:text-color="$q.dark.isActive ? 'white' : 'dark'"
|
|
|
|
|
class="bordered rounded"
|
|
|
|
|
unelevated
|
|
|
|
|
>
|
|
|
|
|
<q-menu class="bordered">
|
|
|
|
|
<q-list v-close-popup dense>
|
|
|
|
|
<q-item
|
|
|
|
|
clickable
|
|
|
|
|
class="flex items-center"
|
|
|
|
|
@click="console.log('test')"
|
|
|
|
|
>
|
|
|
|
|
{{ $t('all') }}
|
|
|
|
|
</q-item>
|
|
|
|
|
<q-item
|
|
|
|
|
clickable
|
|
|
|
|
class="flex items-center"
|
|
|
|
|
@click="console.log('test')"
|
|
|
|
|
>
|
|
|
|
|
{{ $t('statusACTIVE') }}
|
|
|
|
|
</q-item>
|
|
|
|
|
<q-item
|
|
|
|
|
clickable
|
|
|
|
|
class="flex items-center"
|
|
|
|
|
@click="console.log('test')"
|
|
|
|
|
>
|
|
|
|
|
{{ $t('statusINACTIVE') }}
|
|
|
|
|
</q-item>
|
|
|
|
|
</q-list>
|
|
|
|
|
</q-menu>
|
|
|
|
|
</q-btn>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="row q-col-gutter-lg">
|
2024-06-11 09:38:05 +07:00
|
|
|
<div
|
|
|
|
|
:class="`${$q.screen.gt.sm ? 'col-3' : $q.screen.gt.xs ? 'col-6' : 'col-12'}`"
|
2024-06-11 12:01:35 +07:00
|
|
|
v-for="i in isViewDetailGroup ? 4 : 6"
|
2024-06-11 09:38:05 +07:00
|
|
|
:key="i"
|
|
|
|
|
>
|
2024-06-10 16:42:59 +07:00
|
|
|
<ProductCardComponent
|
2024-06-11 12:01:35 +07:00
|
|
|
v-if="isViewDetailGroup"
|
|
|
|
|
:title="cardTypeData.title"
|
|
|
|
|
:subtitle="cardTypeData.subtitle"
|
|
|
|
|
:date="cardTypeData.date"
|
|
|
|
|
:status="cardTypeData.status"
|
|
|
|
|
:color="cardTypeData.color"
|
|
|
|
|
@view-detail="drawerInfo = true"
|
|
|
|
|
@on-click="drawerInfo = true"
|
|
|
|
|
/>
|
|
|
|
|
<ProductCardComponent
|
|
|
|
|
v-else
|
2024-06-10 16:42:59 +07:00
|
|
|
:title="cardData.title"
|
|
|
|
|
:subtitle="cardData.subtitle"
|
|
|
|
|
:date="cardData.date"
|
|
|
|
|
:status="cardData.status"
|
|
|
|
|
:color="cardData.color"
|
2024-06-11 12:01:35 +07:00
|
|
|
@view-detail="drawerInfo = true"
|
|
|
|
|
@on-click="isViewDetailGroup = true"
|
2024-06-10 16:42:59 +07:00
|
|
|
/>
|
|
|
|
|
</div>
|
2024-06-11 09:38:05 +07:00
|
|
|
<div
|
|
|
|
|
:class="`${$q.screen.gt.sm ? 'col-3' : $q.screen.gt.xs ? 'col-6' : 'col-12'}`"
|
|
|
|
|
>
|
2024-06-10 17:42:37 +07:00
|
|
|
<NewProductCardCompoent
|
2024-06-11 12:01:35 +07:00
|
|
|
v-if="isViewDetailGroup"
|
|
|
|
|
:label="$t('ProductAndServiceType')"
|
|
|
|
|
:isType="true"
|
|
|
|
|
@on-click="() => (dialogInputForm = true)"
|
|
|
|
|
/>
|
|
|
|
|
<NewProductCardCompoent
|
|
|
|
|
v-else
|
|
|
|
|
:label="$t('ProductAndService')"
|
2024-06-10 17:42:37 +07:00
|
|
|
:isType="false"
|
2024-06-11 12:01:35 +07:00
|
|
|
@on-click="() => (dialogInputForm = true)"
|
2024-06-10 17:42:37 +07:00
|
|
|
/>
|
|
|
|
|
</div>
|
2024-06-10 16:42:59 +07:00
|
|
|
</div>
|
|
|
|
|
</AppBox>
|
|
|
|
|
</div>
|
2024-06-11 12:01:35 +07:00
|
|
|
|
|
|
|
|
<FormDialog
|
|
|
|
|
v-model:modal="dialogInputForm"
|
|
|
|
|
noAddress
|
|
|
|
|
:title="$t('customerEmployerAdd')"
|
|
|
|
|
:submit="
|
|
|
|
|
() => {
|
|
|
|
|
console.log('submit');
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
:close="() => {}"
|
|
|
|
|
>
|
|
|
|
|
<template #information>
|
|
|
|
|
<BasicInformation
|
|
|
|
|
dense
|
|
|
|
|
:isType="isViewDetailGroup"
|
|
|
|
|
v-model:remark="formData.remark"
|
|
|
|
|
v-model:name="formData.name"
|
|
|
|
|
v-model:code="formData.code"
|
|
|
|
|
v-model:detail="formData.detail"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</FormDialog>
|
|
|
|
|
|
|
|
|
|
<DrawerInfo
|
|
|
|
|
ref="formDialogRef"
|
|
|
|
|
v-model:drawerOpen="drawerInfo"
|
|
|
|
|
:title="'test'"
|
|
|
|
|
:undo="() => (isEdit = false)"
|
|
|
|
|
:isEdit="isEdit"
|
|
|
|
|
:editData="() => (isEdit = true)"
|
|
|
|
|
:submit="() => (isViewDetailGroup ? submitGroup() : submitType())"
|
|
|
|
|
:delete-data="() => deleteProductById()"
|
|
|
|
|
:close="() => (drawerInfo = false)"
|
|
|
|
|
>
|
|
|
|
|
<template #info>
|
|
|
|
|
<AppBox class="q-ma-md" bordered>
|
|
|
|
|
<BasicInformation
|
|
|
|
|
dense
|
|
|
|
|
:isType="isViewDetailGroup"
|
|
|
|
|
:readonly="!isEdit"
|
|
|
|
|
v-model:remark="formData.remark"
|
|
|
|
|
v-model:name="formData.name"
|
|
|
|
|
v-model:code="formData.code"
|
|
|
|
|
v-model:detail="formData.detail"
|
|
|
|
|
/>
|
|
|
|
|
</AppBox>
|
|
|
|
|
</template>
|
|
|
|
|
</DrawerInfo>
|
2024-06-10 16:42:59 +07:00
|
|
|
</template>
|
|
|
|
|
|
2024-06-11 12:01:35 +07:00
|
|
|
<style scoped>
|
|
|
|
|
.hover-underline:hover {
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
text-decoration: underline;
|
|
|
|
|
}
|
|
|
|
|
</style>
|