fix: แก้ layout หน้าสินค้าและบริการใหม่

This commit is contained in:
Net 2024-07-12 13:35:15 +07:00
parent 6b25dff32a
commit 2c955de900

View file

@ -107,9 +107,10 @@ const stat = ref<
>([
{
icon: 'mdi-folder',
count: 0, label: 'productAndService',
count: 0,
label: 'productAndService',
mode: 'group',
color: 'pink'
color: 'pink',
},
{
icon: 'mdi-folder-table',
@ -120,16 +121,17 @@ const stat = ref<
},
{
icon: 'mdi-server-network',
count: 0, label: 'service',
count: 0,
label: 'service',
mode: 'service',
color: 'orange'
color: 'orange',
},
{
icon: 'mdi-folder',
count: 0, label: 'product',
count: 0,
label: 'product',
mode: 'product',
color: 'green'
color: 'green',
},
]);
@ -144,6 +146,7 @@ const drawerInfo = ref(false);
const isEdit = ref(false);
const modeView = ref(false);
const splitterModel = ref(25);
const dialogInputForm = ref(false);
const dialogProduct = ref(false);
@ -1154,9 +1157,6 @@ onMounted(async () => {
text: 'manage',
handler: () => {
productMode.value = 'group';
},
},
];
@ -1175,7 +1175,7 @@ watch(productMode, () => {
text: 'manage',
handler: () => {
productMode.value = 'group';
filterStat.value = []
filterStat.value = [];
},
},
];
@ -1188,7 +1188,7 @@ watch(productMode, () => {
productMode.value = 'type';
filterStat.value = filterStat.value.filter((item) => {
return item !== 'type';
})
});
},
});
}
@ -1295,28 +1295,6 @@ watch(inputSearchProductAndService, async () => {
></q-fab-action>
</ButtonAddComponent>
<div class="column full-height no-wrap">
<div
v-if="stat[0].count === 0"
class="column col bordered rounded q-pa-md"
:no-padding="productGroup?.length !== 0"
>
<TooltipComponent
class="self-end"
title="messageTooltipNoProduct"
caption="messageTooltipProductCreate"
imgSrc="personnel-table-"
/>
<div class="row items-center justify-center" style="flex-grow: 1">
<AddButton
label="productCreate"
@trigger="() => (dialogInputForm = true)"
/>
</div>
</div>
<div v-if="stat[0].count !== 0" class="column full-height no-wrap">
<div class="text-body-2 q-mb-xs flex items-center">
{{ $t('dataSum') }}
<q-btn
@ -1346,15 +1324,184 @@ watch(inputSearchProductAndService, async () => {
</div>
</transition>
<q-splitter
v-model="splitterModel"
:limits="[0, 100]"
style="width: 100%; height: 82%"
after-class="overflow-hidden"
>
<template v-slot:before>
<div class="surface-2 column full-height">
<div
class="row bordered-b q-pl-sm text-weight-bold items-center"
style="height: 56px"
>
<div class="col">ดการสาขาทงหมด</div>
</div>
<div class="col" style="position: relative">
<div class="scroll" style="position: absolute; inset: 0">
<!-- <q-tree
:nodes="treeData"
node-key="id"
label-key="name"
children-key="branch"
style="color: var(--foreground)"
>
<template #default-header="{ node }">
<div
class="row items-center justify-between full-width no-wrap"
>
<span>{{ node.name }}</span>
<div
class="row q-gutter-xs items-center no-wrap"
@click.stop
>
<q-btn
v-if="node.isHeadOffice"
:id="`create-sub-branch-btn-${node.name}`"
@click.stop=""
icon="mdi-file-plus-outline"
size="sm"
dense
round
flat
/>
<q-btn
:id="`view-detail-btn-${node.name}`"
icon="mdi-dots-vertical"
size="sm"
dense
round
flat
>
<q-menu class="bordered">
<q-list v-close-popup>
<q-item
:id="`view-detail-btn-${node.name}-view`"
@click.stop="
"
clickable
dense
class="row q-py-sm"
style="white-space: nowrap"
>
<q-icon
name="mdi-eye-outline"
class="col-3"
size="xs"
style="color: hsl(var(--green-6-hsl))"
/>
<span
class="col-9 q-px-md flex items-center"
>
{{ $t('viewDetail') }}
</span>
</q-item>
<q-item
:id="`view-detail-btn-${node.name}-edit`"
clickable
dense
class="row q-py-sm"
style="white-space: nowrap"
@click="
() => {
}
"
>
<q-icon
name="mdi-pencil-outline"
class="col-3"
size="xs"
style="color: hsl(var(--cyan-6-hsl))"
/>
<span
class="col-9 q-px-md flex items-center"
>
{{ $t('edit') }}
</span>
</q-item>
<q-item
:id="`view-detail-btn-${node.name}-delete`"
dense
:clickable="node.status === 'CREATED'"
class="row"
:class="{
'surface-3': node.status !== 'CREATED',
'app-text-muted':
node.status !== 'CREATED',
}"
style="white-space: nowrap"
@click=""
>
<q-icon
name="mdi-trash-can-outline"
size="xs"
class="col-3"
:class="{
'app-text-negative':
node.status === 'CREATED',
}"
/>
<span
class="col-9 q-px-md flex items-center"
>
{{ $t('delete') }}
</span>
</q-item>
<q-item dense>
<q-item-section class="q-py-sm">
<div class="q-pa-sm surface-2 rounded">
<q-toggle
:id="`view-detail-btn-${node.name}-status`"
dense
size="sm"
:label="
node.status !== 'INACTIVE'
? $t('switchOnLabel')
: $t('switchOffLabel')
"
@click="
async () => {
}
"
:model-value="
node.status === 'CREATED' ||
node.status === 'ACTIVE'
"
/>
</div>
</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
</div>
</div>
</template>
</q-tree> -->
</div>
</div>
</div>
</template>
<template v-slot:after>
<div class="column no-wrap full-height">
<!-- group/type -->
<div
v-if="productMode === 'group' || productMode === 'type'"
class="surface-2 col bordered rounded column no-wrap"
class="col justify-between surface-2 items-center full-width full-height justify-between"
>
<div class="row q-px-md q-py-sm items-center">
<div
v-if="productMode === 'group' || productMode === 'type'"
class="row full-width justify-between"
class="q-px-md row bordered-b justify-between items-center"
style="height: 56px"
>
<q-input
style="width: 300px"
@ -1362,7 +1509,7 @@ watch(inputSearchProductAndService, async () => {
dense
unelavated
:label="$t('search')"
class="q-mr-md"
class=""
:bg-color="$q.dark.isActive ? 'dark' : 'white'"
v-model="inputSearch"
debounce="250"
@ -1488,18 +1635,18 @@ watch(inputSearchProductAndService, async () => {
</q-btn-toggle>
</div>
</div>
</div>
<div
v-if="
(productMode === 'type' && productType?.length === 0) ||
(productGroup?.length === 0 && productMode === 'group')
((productMode === 'type' && productType?.length === 0) ||
(productGroup?.length === 0 && productMode === 'group')) &&
stat[0].count !== undefined
"
class="flex full-height justify-center items-center q-mt-lg"
style="min-height: 70vh; background-color: var(--surface-2)"
class="surface-1 row items-center justify-center bordered q-pa-md full-width full-height"
>
<NoData :not-found="!!inputSearch" />
</div>
<template v-else>
<div class="col flex scroll full-height q-pa-md surface-1">
<div class="full-width">
@ -1512,7 +1659,7 @@ watch(inputSearchProductAndService, async () => {
"
:columns="tbColumn.groupAndType"
class="full-width"
card-container-class="q-gutter-md "
card-container-class="q-col-gutter-md"
row-key="name"
:rows-per-page-options="[0]"
hide-pagination
@ -1560,8 +1707,6 @@ watch(inputSearchProductAndService, async () => {
await fetchListType();
flowStore.rotate();
}
}
"
>
@ -1605,7 +1750,9 @@ watch(inputSearchProductAndService, async () => {
</q-td>
<q-td
v-if="
tbControl.groupAndType.fieldSelected.includes('detail')
tbControl.groupAndType.fieldSelected.includes(
'detail',
)
"
>
{{ props.row.detail || '-' }}
@ -2151,7 +2298,10 @@ watch(inputSearchProductAndService, async () => {
{
product: tbControl.product.fieldDisplay,
service: tbControl.service.fieldDisplay,
}[productAndServiceTab].map((x) => ({ label: $t(x), value: x }))
}[productAndServiceTab].map((x) => ({
label: $t(x),
value: x,
}))
"
:display-value="$t('displayField')"
:model-value="
@ -2337,9 +2487,10 @@ watch(inputSearchProductAndService, async () => {
service: tbControl.service.fieldSelected,
}[productAndServiceTab].includes(
{ product: 'productName', service: 'serviceName' }[
productAndServiceTab
],
{
product: 'productName',
service: 'serviceName',
}[productAndServiceTab],
)
"
>
@ -2347,7 +2498,8 @@ watch(inputSearchProductAndService, async () => {
<div
:class="{
'status-active': props.row.status !== 'INACTIVE',
'status-inactive': props.row.status === 'INACTIVE',
'status-inactive':
props.row.status === 'INACTIVE',
}"
style="
width: 50px;
@ -2445,7 +2597,10 @@ watch(inputSearchProductAndService, async () => {
<div class="col-4">{{ $t('agentPrice') }}</div>
<div class="col-4 text-weight-bold">
{{
formatNumberDecimal(props.row.agentPrice || 0, 2)
formatNumberDecimal(
props.row.agentPrice || 0,
2,
)
}}
</div>
</div>
@ -2453,7 +2608,9 @@ watch(inputSearchProductAndService, async () => {
class="tags col-3 column ellipsis-2-lines"
style="min-width: 50px"
>
<div class="col-4">{{ $t('processingPrice') }}</div>
<div class="col-4">
{{ $t('processingPrice') }}
</div>
<div class="col-4 text-weight-bold">
{{
formatNumberDecimal(
@ -2523,7 +2680,9 @@ watch(inputSearchProductAndService, async () => {
if (props.row.type === 'service') {
currentIdService = props.row.id;
infoServiceEdit = false;
assignFormDataProductService(props.row.id);
assignFormDataProductService(
props.row.id,
);
dialogServiceEdit = true;
}
await fetchListOfOptionBranch();
@ -2564,7 +2723,9 @@ watch(inputSearchProductAndService, async () => {
if (props.row.type === 'service') {
currentIdService = props.row.id;
infoServiceEdit = true;
assignFormDataProductService(props.row.id);
assignFormDataProductService(
props.row.id,
);
dialogServiceEdit = true;
}
@ -2721,7 +2882,9 @@ watch(inputSearchProductAndService, async () => {
</div>
</template>
<!-- footer -->
<div class="row items-center justify-between q-py-sm q-px-md surface-2">
<div
class="row items-center justify-between q-py-sm q-px-md surface-2"
>
<div class="col-4">
<div class="row items-center">
<div class="app-text-muted" style="width: 80px">
@ -2783,7 +2946,8 @@ watch(inputSearchProductAndService, async () => {
</div>
</div>
</div>
</div>
</template>
</q-splitter>
<FormDialog
v-model:modal="dialogInputForm"