refactor: kebab action

This commit is contained in:
puriphatt 2024-08-27 11:46:26 +07:00
parent 5ec6d1c9d5
commit bc578d569c
11 changed files with 518 additions and 1357 deletions

View file

@ -36,6 +36,7 @@ import ImageUploadDialog from 'components/ImageUploadDialog.vue';
import FormBank from 'components/01_branch-management/FormBank.vue';
import ToggleButton from 'src/components/button/ToggleButton.vue';
import FormBranchAdmin from 'src/components/01_branch-management/FormBranchAdmin.vue';
import KebabAction from 'src/components/shared/KebabAction.vue';
import { User } from 'src/stores/user/types';
import {
EditButton,
@ -479,10 +480,10 @@ function triggerDelete(id: string) {
dialog({
color: 'negative',
icon: 'mdi-alert',
title: t('deleteConfirmTitle'),
actionText: t('agree'),
title: t('dialog.title.confirmDelete'),
actionText: t('general.delete'),
persistent: true,
message: t('deleteConfirmMessage'),
message: t('dialog.message.confirmDelete'),
action: async () => {
await branchStore.deleteById(id);
await branchStore.fetchList({ pageSize: 99999 });
@ -1189,155 +1190,56 @@ watch(currentHq, () => {
}}
</q-td>
<q-td>
<q-btn
icon="mdi-dots-vertical"
:id="`btn-dots-${props.row.code}`"
size="sm"
dense
round
flat
@click.stop
>
<q-menu class="bordered">
<q-list v-close-popup>
<q-item
:id="`view-detail-btn-${props.row.name}-view`"
@click.stop="
if (props.row.isHeadOffice) {
triggerEdit(
'drawer',
props.row.id,
'headOffice',
props.row.code,
);
} else {
triggerEdit(
'drawer',
props.row.id,
'subBranch',
);
}
"
v-close-popup
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('general.viewDetail') }}
</span>
</q-item>
<KebabAction
:status="props.row.status"
:idName="props.row.code"
@view="
if (props.row.isHeadOffice) {
triggerEdit(
'drawer',
props.row.id,
'headOffice',
props.row.code,
);
} else {
triggerEdit(
'drawer',
props.row.id,
'subBranch',
);
}
"
@edit="
async () => {
if (props.row.isHeadOffice) {
await triggerEdit(
'drawer',
props.row.id,
'headOffice',
props.row.code,
);
} else {
await triggerEdit(
'drawer',
props.row.id,
'subBranch',
);
}
formType = 'edit';
}
"
@delete="triggerDelete(props.row.id)"
@changeStatus="
async () => {
const res = await triggerChangeStatus(
props.row.id,
props.row.status,
);
<q-item
:id="`view-detail-btn-${props.row.name}-edit`"
v-close-popup
clickable
dense
class="row q-py-sm"
style="white-space: nowrap"
@click="
async () => {
if (props.row.isHeadOffice) {
await triggerEdit(
'drawer',
props.row.id,
'headOffice',
props.row.code,
);
} else {
await triggerEdit(
'drawer',
props.row.id,
'subBranch',
);
}
formType = 'edit';
}
"
>
<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('general.edit') }}
</span>
</q-item>
<q-item
:id="`view-detail-btn-${props.row.name}-delete`"
dense
v-close-popup
:clickable="props.row.status === 'CREATED'"
class="row"
:class="{
'surface-3': props.row.status !== 'CREATED',
'app-text-muted':
props.row.status !== 'CREATED',
}"
style="white-space: nowrap"
@click="triggerDelete(props.row.id)"
>
<q-icon
name="mdi-trash-can-outline"
size="xs"
class="col-3"
:class="{
'app-text-negative':
props.row.status === 'CREATED',
}"
/>
<span class="col-9 q-px-md flex items-center">
{{ $t('general.delete') }}
</span>
</q-item>
<q-item dense>
<q-item-section class="q-py-sm">
<div
class="q-pa-sm surface-2 rounded flex items-center"
>
<ToggleButton
two-way
:id="`view-detail-btn-${props.row.name}-status`"
@click="
async () => {
const res =
await triggerChangeStatus(
props.row.id,
props.row.status,
);
if (res)
props.row.status = res.status;
}
"
:model-value="
props.row.status === 'CREATED' ||
props.row.status === 'ACTIVE'
"
/>
<span class="q-pl-md">
{{
props.row.status !== 'INACTIVE'
? $t('general.open')
: $t('general.close')
}}
</span>
</div>
</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
if (res) props.row.status = res.status;
}
"
/>
</q-td>
</q-tr>
</template>
@ -1409,145 +1311,56 @@ watch(currentHq, () => {
"
>
<template v-slot:action>
<q-menu class="bordered">
<q-list>
<q-item
:id="`view-detail-btn-${props.row.name}-view`"
@click.stop="
if (props.row.isHeadOffice) {
triggerEdit(
'drawer',
props.row.id,
'headOffice',
props.row.code,
);
} else {
triggerEdit(
'drawer',
props.row.id,
'subBranch',
);
}
"
v-close-popup
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('general.viewDetail') }}
</span>
</q-item>
<KebabAction
:status="props.row.status"
:idName="props.row.code"
@view="
if (props.row.isHeadOffice) {
triggerEdit(
'drawer',
props.row.id,
'headOffice',
props.row.code,
);
} else {
triggerEdit(
'drawer',
props.row.id,
'subBranch',
);
}
"
@edit="
async () => {
if (props.row.isHeadOffice) {
await triggerEdit(
'drawer',
props.row.id,
'headOffice',
props.row.code,
);
} else {
await triggerEdit(
'drawer',
props.row.id,
'subBranch',
);
}
formType = 'edit';
}
"
@delete="triggerDelete(props.row.id)"
@change-status="
async () => {
const res = await triggerChangeStatus(
props.row.id,
props.row.status,
);
<q-item
:id="`view-detail-btn-${props.row.name}-edit`"
v-close-popup
clickable
dense
class="row q-py-sm"
style="white-space: nowrap"
@click="
async () => {
if (props.row.isHeadOffice) {
await triggerEdit(
'drawer',
props.row.id,
'headOffice',
props.row.code,
);
} else {
await triggerEdit(
'drawer',
props.row.id,
'subBranch',
);
}
formType = 'edit';
}
"
>
<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('general.edit') }}
</span>
</q-item>
<q-item
:id="`view-detail-btn-${props.row.name}-delete`"
dense
v-close-popup
:clickable="props.row.status === 'CREATED'"
class="row"
:class="{
'surface-3': props.row.status !== 'CREATED',
'app-text-muted':
props.row.status !== 'CREATED',
}"
style="white-space: nowrap"
@click="triggerDelete(props.row.id)"
>
<q-icon
name="mdi-trash-can-outline"
size="xs"
class="col-3"
:class="{
'app-text-negative':
props.row.status === 'CREATED',
}"
/>
<span class="col-9 q-px-md flex items-center">
{{ $t('generaldelete') }}
</span>
</q-item>
<q-item dense>
<q-item-section class="q-py-sm">
<div
class="q-pa-sm surface-2 rounded flex items-center"
>
<ToggleButton
:id="`view-detail-btn-${props.row.name}-status`"
two-way
:model-value="
props.row.status === 'CREATED' ||
props.row.status === 'ACTIVE'
"
@click="
async () => {
const res =
await triggerChangeStatus(
props.row.id,
props.row.status,
);
if (res)
props.row.status = res.status;
}
"
/>
<span class="q-pl-md">
{{
props.row.status !== 'INACTIVE'
? $t('general.open')
: $t('general.close')
}}
</span>
</div>
</q-item-section>
</q-item>
</q-list>
</q-menu>
if (res) props.row.status = res.status;
}
"
/>
</template>
</BranchCard>
</div>
@ -1622,7 +1435,7 @@ watch(currentHq, () => {
class="col surface-1 q-ma-lg rounded bordered scroll row"
id="branch-form"
>
<div class="col">
<div class="col" v-if="$q.screen.gt.sm">
<div style="position: sticky; top: 0" class="q-pa-sm">
<SideMenu
:menu="[
@ -1661,7 +1474,7 @@ watch(currentHq, () => {
</div>
</div>
<div class="col-10 q-pa-md q-gutter-y-xl">
<div class="col-md-10 col-12 q-pa-md q-gutter-y-xl">
<FormBranchInformation
id="form-information"
v-model:abbreviation="formData.code"
@ -1842,6 +1655,7 @@ watch(currentHq, () => {
</div>
</div>
<div
v-if="$q.screen.gt.sm"
class="col full-height rounded scroll row q-py-md q-pl-md q-pr-sm"
>
<SideMenu
@ -1880,7 +1694,8 @@ watch(currentHq, () => {
/>
</div>
<div
class="col-12 col-md-10 q-py-md q-pr-md q-pl-sm full-height"
class="col-12 col-md-10 q-py-md q-pr-md full-height"
:class="$q.screen.xs ? 'q-pl-md' : 'q-pl-sm'"
id="branch-info"
style="overflow-y: auto"
>
@ -1952,6 +1767,7 @@ watch(currentHq, () => {
inputFile.click();
}
"
class="q-mb-xl"
/>
<FormBank
id="info-bank"

View file

@ -43,7 +43,7 @@ import SideMenu from 'components/SideMenu.vue';
import ImageUploadDialog from 'components/ImageUploadDialog.vue';
import { AddressForm } from 'components/form';
import DialogForm from 'components/DialogForm.vue';
import ToggleButton from 'src/components/button/ToggleButton.vue';
import KebabAction from 'src/components/shared/KebabAction.vue';
const { locale, t } = useI18n();
const $q = useQuasar();
@ -496,10 +496,10 @@ async function onDelete(id: string) {
dialog({
color: 'negative',
icon: 'mdi-trash-can-outline',
title: t('deleteConfirmTitle'),
actionText: t('agree'),
title: t('dialog.title.confirmDelete'),
actionText: t('general.delete'),
persistent: true,
message: t('deleteConfirmMessage'),
message: t('dialog.message.confirmDelete'),
action: async () => {
await userStore.deleteById(id);
@ -1276,124 +1276,26 @@ watch(
}
"
/>
<q-btn
:id="`btn-dots-${props.row.username}`"
icon="mdi-dots-vertical"
size="sm"
dense
round
flat
@click.stop
:key="props.row.id"
>
<q-menu class="bordered">
<q-list v-close-popup>
<q-item
:id="`view-detail-btn-${props.row.username}-view`"
@click.stop="
() => {
openDialog('INFO', props.row.id);
}
"
v-close-popup
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('general.viewDetail') }}
</span>
</q-item>
<q-item
:id="`view-detail-btn-${props.row.username}-edit`"
v-close-popup
clickable
dense
class="row q-py-sm"
style="white-space: nowrap"
@click="
() => {
openDialog('INFO', props.row.id, true);
}
"
>
<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('general.edit') }}
</span>
</q-item>
<q-item
:id="`view-detail-btn-${props.row.username}-delete`"
dense
v-close-popup
:clickable="props.row.status === 'CREATED'"
class="row"
:class="{
'surface-3': props.row.status !== 'CREATED',
'app-text-muted': props.row.status !== 'CREATED',
}"
style="white-space: nowrap"
@click="onDelete(props.row.id)"
>
<q-icon
name="mdi-trash-can-outline"
size="xs"
class="col-3"
:class="{
'app-text-negative':
props.row.status === 'CREATED',
}"
/>
<span class="col-9 q-px-md flex items-center">
{{ $t('general.delete') }}
</span>
</q-item>
<q-item dense>
<q-item-section class="q-py-sm">
<div
class="q-pa-sm surface-2 rounded flex items-center"
>
<ToggleButton
:id="`view-detail-btn-${props.row.username}-status`"
two-way
:model-value="props.row.status !== 'INACTIVE'"
@click="
async () => {
triggerChangeStatus(
props.row.id,
props.row.status,
);
}
"
/>
<span class="q-pl-md">
{{
props.row.status !== 'INACTIVE'
? $t('general.open')
: $t('general.close')
}}
</span>
</div>
</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
<KebabAction
:id-name="props.row.username"
:status="props.row.status"
@view="
() => {
openDialog('INFO', props.row.id);
}
"
@edit="
() => {
openDialog('INFO', props.row.id, true);
}
"
@delete="onDelete(props.row.id)"
@change-status="
async () => {
triggerChangeStatus(props.row.id, props.row.status);
}
"
/>
</q-td>
</q-tr>
</template>
@ -1737,8 +1639,9 @@ watch(
</div>
<div
class="col-12 col-md-10 q-py-md q-pr-md q-pl-sm relative-position"
class="col-12 col-md-10 q-py-md q-pr-md relative-position"
id="user-form-content"
:class="$q.screen.xs ? 'q-pl-md' : 'q-pl-sm'"
style="height: 100%; max-height: 100; overflow-y: auto"
>
<FormInformation
@ -1815,7 +1718,6 @@ watch(
v-model:agencyFile="agencyFile"
v-model:agencyFileList="agencyFileList"
v-model:userId="userId"
class="q-mb-xl"
/>
</div>
</div>
@ -1987,7 +1889,6 @@ watch(
v-model:checkpoint="formData.checkpoint"
v-model:checkpointEN="formData.checkpointEN"
v-model:agencyFile="agencyFile"
class="q-mb-xl"
/>
</div>
</div>

View file

@ -65,7 +65,7 @@ import FormEmployeeWorkHistory from 'components/03_customer-management/FormEmplo
import FormEmployeeOther from 'components/03_customer-management/FormEmployeeOther.vue';
import useOptionStore from 'stores/options';
import { DialogContainer, DialogHeader } from 'components/dialog';
import ToggleButton from 'src/components/button/ToggleButton.vue';
import KebabAction from 'src/components/shared/KebabAction.vue';
const { t, locale } = useI18n();
const $q = useQuasar();
@ -267,10 +267,10 @@ function deleteCustomerById(id: string) {
dialog({
color: 'negative',
icon: 'mdi-alert',
title: t('deleteConfirmTitle'),
actionText: t('ok'),
title: t('dialog.title.confirmDelete'),
actionText: t('general.delete'),
persistent: true,
message: t('deleteConfirmMessage'),
message: t('dialog.message.confirmDelete'),
action: async () => {
await customerStore.deleteById(id);
@ -287,10 +287,10 @@ async function deleteCustomerBranchById(id: string) {
dialog({
color: 'negative',
icon: 'mdi-alert',
title: t('deleteConfirmTitle'),
actionText: t('ok'),
title: t('dialog.title.confirmDelete'),
actionText: t('general.delete'),
persistent: true,
message: t('deleteConfirmMessage'),
message: t('dialog.message.confirmDelete'),
action: async () => {
await customerStore.deleteBranchById(id);
flowStore.rotate();
@ -385,13 +385,13 @@ async function triggerChangeStatus(id: string, status: string) {
color: status !== 'INACTIVE' ? 'warning' : 'info',
icon:
status !== 'INACTIVE' ? 'mdi-alert' : 'mdi-message-processing-outline',
title: t('confirmChangeStatusTitle'),
title: t('dialog.title.confirmChangeStatus'),
actionText:
status !== 'INACTIVE' ? t('switchOffLabel') : t('switchOnLabel'),
status !== 'INACTIVE' ? t('general.close') : t('general.open'),
message:
status !== 'INACTIVE'
? t('confirmChangeStatusOffMessage')
: t('confirmChangeStatusOnMessage'),
? t('dialog.message.confirmChangeStatusOff')
: t('dialog.message.confirmChangeStatusOn'),
action: async () => {
if (currentTab.value === 'employee') {
await toggleStatusEmployee(id, status === 'INACTIVE' ? false : true)
@ -428,10 +428,10 @@ async function deleteEmployeeById(opts: {
dialog({
color: 'negative',
icon: 'mdi-alert',
title: t('deleteConfirmTitle'),
actionText: t('ok'),
title: t('dialog.title.confirmDelete'),
actionText: t('general.delete'),
persistent: true,
message: t('deleteConfirmMessage'),
message: t('dialog.message.confirmDelete'),
action: async () => {
if (opts.type === 'healthCheck') {
await employeeFormStore.deleteHealthCheck();
@ -1172,130 +1172,33 @@ const emptyCreateDialog = ref(false);
@click.stop="editCustomerForm(props.row.id)"
/>
<q-btn
icon="mdi-dots-vertical"
:id="`btn-dots-${props.row.code}`"
size="sm"
dense
round
flat
@click.stop
:key="props.row.id"
>
<q-menu class="bordered">
<q-list v-close-popup>
<q-item
:id="`view-detail-btn-${props.row.name}-view`"
@click.stop="
() => {
const { branch, ...payload } = props.row;
currentCustomer = payload;
editCustomerForm(props.row.id);
}
"
v-close-popup
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('general.viewDetail') }}
</span>
</q-item>
<q-item
:id="`view-detail-btn-${props.row.name}-edit`"
v-close-popup
clickable
dense
class="row q-py-sm"
style="white-space: nowrap"
@click="
async () => {
await editCustomerForm(props.row.id);
customerFormState.dialogType = 'edit';
customerFormState.readonly = false;
}
"
>
<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('general.edit') }}
</span>
</q-item>
<q-item
:id="`view-detail-btn-${props.row.name}-delete`"
dense
v-close-popup
:clickable="props.row.status === 'CREATED'"
class="row"
:class="{
'surface-3': props.row.status !== 'CREATED',
'app-text-muted':
props.row.status !== 'CREATED',
}"
style="white-space: nowrap"
@click="deleteCustomerById(props.row.id)"
>
<q-icon
name="mdi-trash-can-outline"
size="xs"
class="col-3"
:class="{
'app-text-negative':
props.row.status === 'CREATED',
}"
/>
<span class="col-9 q-px-md flex items-center">
{{ $t('general.delete') }}
</span>
</q-item>
<q-item dense>
<q-item-section class="q-py-sm">
<div
class="q-pa-sm surface-2 rounded flex items-center"
>
<ToggleButton
:id="`view-detail-btn-${props.row.name}-status`"
two-way
:model-value="
props.row.status !== 'INACTIVE'
"
@click="
async () => {
triggerChangeStatus(
props.row.id,
props.row.status,
);
}
"
/>
<span class="q-pl-md">
{{
props.row.status !== 'INACTIVE'
? $t('general.open')
: $t('general.close')
}}
</span>
</div>
</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
<KebabAction
:id-name="props.row.code"
:status="props.row.status"
@view="
() => {
const { branch, ...payload } = props.row;
currentCustomer = payload;
editCustomerForm(props.row.id);
}
"
@edit="
async () => {
await editCustomerForm(props.row.id);
customerFormState.dialogType = 'edit';
customerFormState.readonly = false;
}
"
@delete="deleteCustomerById(props.row.id)"
@change-status="
async () => {
triggerChangeStatus(
props.row.id,
props.row.status,
);
}
"
/>
</q-td>
</q-tr>
@ -1315,12 +1218,25 @@ const emptyCreateDialog = ref(false);
@view="
(item: any) => {
employeeFormState.drawerModal = true;
//employeeFormState.isEmployeeEdit = true;
employeeFormState.isEmployeeEdit = false;
employeeFormStore.assignFormDataEmployee(
item.id,
);
}
"
@edit="
(item: any) => editEmployeeFormPersonal(item.id)
"
@delete="
(item: any) => {
deleteEmployeeById({ id: item.id });
}
"
@toggle-status="
async (item: any) => {
triggerChangeStatus(item.id, item.status);
}
"
/>
</div>
</q-td>

View file

@ -27,6 +27,7 @@ import DialogForm from 'components/DialogForm.vue';
import ProfileBanner from 'components/ProfileBanner.vue';
import SideMenu from 'components/SideMenu.vue';
import ImageUploadDialog from 'components/ImageUploadDialog.vue';
import KebabAction from 'src/components/shared/KebabAction.vue';
import {
EditButton,
DeleteButton,
@ -2075,181 +2076,74 @@ watch([currentStatusList, productMode], () => {
"
/>
<q-btn
icon="mdi-dots-vertical"
:id="`btn-dots-${props.row.name}`"
size="sm"
dense
round
flat
@click.stop
:key="props.row.id"
v-if="actionDisplay"
>
<q-menu class="bordered">
<q-list v-close-popup>
<q-item
v-close-popup
clickable
:id="`view-detail-btn-${props.row.name}-view`"
@click.stop="
() => {
if (productMode === 'type') {
editByTree = 'type';
currentStatusProduct =
props.row.status === 'INACTIVE';
clearFormGroup();
currentIdType = props.row.id;
assignFormDataGroup(props.row);
isEdit = false;
drawerInfo = true;
}
if (productMode === 'group') {
editByTree = 'group';
currentStatusProduct =
props.row.status === 'INACTIVE';
clearFormGroup();
assignFormDataGroup(props.row);
isEdit = false;
currentIdGrop = props.row.id;
drawerInfo = true;
}
}
"
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('general.viewDetail') }}
</span>
</q-item>
<KebabAction
:disable-delete="props.row.status !== 'CREATED'"
:status="props.row.status"
:idName="props.row.name"
@view="
() => {
if (productMode === 'type') {
editByTree = 'type';
currentStatusProduct =
props.row.status === 'INACTIVE';
clearFormGroup();
currentIdType = props.row.id;
assignFormDataGroup(props.row);
isEdit = false;
drawerInfo = true;
}
if (productMode === 'group') {
editByTree = 'group';
currentStatusProduct =
props.row.status === 'INACTIVE';
clearFormGroup();
assignFormDataGroup(props.row);
isEdit = false;
currentIdGrop = props.row.id;
drawerInfo = true;
}
}
"
@edit="
() => {
if (productMode === 'type') {
editByTree = 'type';
clearFormGroup();
currentIdType = props.row.id;
assignFormDataGroup(props.row);
isEdit = true;
drawerInfo = true;
}
if (productMode === 'group') {
editByTree = 'group';
clearFormGroup();
assignFormDataGroup(props.row);
isEdit = true;
currentIdGrop = props.row.id;
<q-item
v-if="
props.row.status !== 'INACTIVE' &&
currentNoAction
"
:id="`view-detail-btn-${props.row.name}-edit`"
v-close-popup
clickable
dense
class="row q-py-sm"
style="white-space: nowrap"
@click="
() => {
if (productMode === 'type') {
editByTree = 'type';
clearFormGroup();
currentIdType = props.row.id;
assignFormDataGroup(props.row);
isEdit = true;
drawerInfo = true;
}
if (productMode === 'group') {
editByTree = 'group';
clearFormGroup();
assignFormDataGroup(props.row);
isEdit = true;
currentIdGrop = props.row.id;
drawerInfo = true;
}
}
"
>
<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('general.edit') }}
</span>
</q-item>
<q-item
v-close-popup
v-if="
props.row.status !== 'INACTIVE' &&
currentNoAction
"
:id="`view-detail-btn-${props.row.name}-delete`"
dense
:disable="props.row.status !== 'CREATED'"
:clickable="props.row.status === 'CREATED'"
class="row"
:class="{
'surface-3': props.row.status !== 'CREATED',
'app-text-muted':
props.row.status !== 'CREATED',
}"
style="white-space: nowrap"
@click="
() => {
if (productMode === 'type') {
deleteProductById(props.row.id);
}
if (productMode === 'group') {
deleteProductById(props.row.id);
}
}
"
>
<q-icon
name="mdi-trash-can-outline"
size="xs"
class="col-3"
:class="{
'app-text-negative':
props.row.status === 'CREATED',
}"
/>
<span class="col-9 q-px-md flex items-center">
{{ $t('general.delete') }}
</span>
</q-item>
<q-item dense>
<q-item-section class="q-py-sm">
<div
class="q-pa-sm surface-2 rounded flex items-center"
>
<ToggleButton
two-way
:id="`view-detail-btn-${props.row.name}-status`"
:model-value="
props.row.status !== 'INACTIVE'
"
@click="
async () => {
triggerChangeStatus(
props.row.id,
props.row.status,
);
}
"
/>
<span class="q-pl-md">
{{
props.row.status !== 'INACTIVE'
? $t('general.open')
: $t('general.close')
}}
</span>
</div>
</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
drawerInfo = true;
}
}
"
@delete="
() => {
if (productMode === 'type') {
deleteProductById(props.row.id);
}
if (productMode === 'group') {
deleteProductById(props.row.id);
}
}
"
@changeStatus="
async () => {
triggerChangeStatus(
props.row.id,
props.row.status,
);
}
"
/>
</q-td>
</q-tr>
</template>
@ -2999,165 +2893,62 @@ watch([currentStatusList, productMode], () => {
}
"
/>
<q-btn
icon="mdi-dots-vertical"
:id="`btn-dots-${props.row.name}`"
size="sm"
dense
round
flat
@click.stop
v-if="actionDisplay"
>
<q-menu class="bordered">
<q-list v-close-popup>
<q-item
:id="`view-detail-btn-${props.row.name}-view`"
@click.stop="
async () => {
await fetchListOfOptionBranch();
if (props.row.type === 'product') {
currentIdProduct = props.row.id;
assignFormDataProduct(props.row);
dialogProductEdit = true;
}
if (props.row.type === 'service') {
currentIdService = props.row.id;
infoServiceEdit = false;
assignFormDataProductService(
props.row.id,
);
dialogServiceEdit = true;
}
}
"
v-close-popup
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('general.viewDetail') }}
</span>
</q-item>
<q-item
:id="`view-detail-btn-${props.row.name}-edit`"
v-close-popup
clickable
dense
class="row q-py-sm"
style="white-space: nowrap"
@click="
async () => {
await fetchListOfOptionBranch();
if (props.row.type === 'product') {
currentIdProduct = props.row.id;
infoProductEdit = true;
assignFormDataProduct(props.row);
dialogProductEdit = true;
}
if (props.row.type === 'service') {
currentIdService = props.row.id;
infoServiceEdit = true;
assignFormDataProductService(
props.row.id,
);
dialogServiceEdit = true;
}
}
"
>
<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('general.edit') }}
</span>
</q-item>
<q-item
:id="`view-detail-btn-${props.row.name}-delete`"
dense
v-close-popup
:clickable="props.row.status === 'CREATED'"
class="row"
:class="{
'surface-3': props.row.status !== 'CREATED',
'app-text-muted':
props.row.status !== 'CREATED',
}"
style="white-space: nowrap"
@click="
() => {
if (props.row.type === 'product') {
deleteProductConfirm(props.row.id);
}
if (props.row.type === 'service') {
deleteServiceConfirm(props.row.id);
}
}
"
>
<q-icon
name="mdi-trash-can-outline"
size="xs"
class="col-3"
:class="{
'app-text-negative':
props.row.status === 'CREATED',
}"
/>
<span class="col-9 q-px-md flex items-center">
{{ $t('general.delete') }}
</span>
</q-item>
<q-item dense>
<q-item-section class="q-py-sm">
<div
class="q-pa-sm surface-2 rounded flex items-center"
>
<ToggleButton
two-way
:id="`view-detail-btn-${props.row.name}-status`"
:model-value="
props.row.status === 'CREATED' ||
props.row.status === 'ACTIVE'
"
@click="
() => {
triggerChangeStatus(
props.row.id,
props.row.status,
props.row.type,
);
}
"
/>
<span class="q-pl-md">
{{
props.row.status !== 'INACTIVE'
? $t('general.open')
: $t('general.close')
}}
</span>
</div>
</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
<KebabAction
:status="props.row.status"
:idName="props.row.name"
@view="
async () => {
await fetchListOfOptionBranch();
if (props.row.type === 'product') {
currentIdProduct = props.row.id;
assignFormDataProduct(props.row);
dialogProductEdit = true;
}
if (props.row.type === 'service') {
currentIdService = props.row.id;
infoServiceEdit = false;
assignFormDataProductService(props.row.id);
dialogServiceEdit = true;
}
}
"
@edit="
async () => {
await fetchListOfOptionBranch();
if (props.row.type === 'product') {
currentIdProduct = props.row.id;
infoProductEdit = true;
assignFormDataProduct(props.row);
dialogProductEdit = true;
}
if (props.row.type === 'service') {
currentIdService = props.row.id;
infoServiceEdit = true;
assignFormDataProductService(props.row.id);
dialogServiceEdit = true;
}
}
"
@delete="
() => {
if (props.row.type === 'product') {
deleteProductConfirm(props.row.id);
}
if (props.row.type === 'service') {
deleteServiceConfirm(props.row.id);
}
}
"
@changeStatus="
() => {
triggerChangeStatus(
props.row.id,
props.row.status,
props.row.type,
);
}
"
/>
</q-td>
</q-tr>
</template>
@ -3209,6 +3000,16 @@ watch([currentStatusList, productMode], () => {
}
}
"
@menuDelete="
() => {
if (row.type === 'product') {
deleteProductConfirm(row.id);
}
if (row.type === 'service') {
deleteServiceConfirm(row.id);
}
}
"
/>
</div>
</template>
@ -3374,8 +3175,9 @@ watch([currentStatusList, productMode], () => {
</div>
</div>
<div
class="col-12 col-md-10 q-py-md q-pr-md q-pl-sm"
class="col-12 col-md-10 q-py-md q-pr-md"
id="customer-form-content"
:class="$q.screen.xs ? 'q-pl-md' : 'q-pl-sm'"
style="height: 100%; max-height: 100%; overflow-y: auto"
>
<BasicInformation
@ -3546,8 +3348,9 @@ watch([currentStatusList, productMode], () => {
/>
</div>
<div
class="col-12 col-md-10 q-py-md q-pr-md q-pl-sm full-height"
class="col-12 col-md-10 q-py-md q-pr-md full-height"
id="group-info"
:class="$q.screen.xs ? 'q-pl-md' : 'q-pl-sm'"
style="overflow-y: auto"
>
<BasicInformation
@ -3848,8 +3651,9 @@ watch([currentStatusList, productMode], () => {
</div>
</div>
<div
class="col-12 col-md-10 q-py-md q-pr-md q-pl-sm"
class="col-12 col-md-10 q-py-md q-pr-md"
id="customer-form-content"
:class="$q.screen.xs ? 'q-pl-md' : 'q-pl-sm'"
style="height: 100%; max-height: 100%; overflow-y: auto"
>
<BasicInfoProduct
@ -4023,7 +3827,8 @@ watch([currentStatusList, productMode], () => {
</div>
</div>
<div
class="col-12 col-md-10 q-py-md q-pr-md q-pl-sm"
class="col-12 col-md-10 q-py-md q-pr-md"
:class="$q.screen.xs ? 'q-pl-md' : 'q-pl-sm'"
id="customer-form-content"
style="height: 100%; max-height: 100%; overflow-y: auto"
>
@ -4156,8 +3961,9 @@ watch([currentStatusList, productMode], () => {
</div>
</div>
<div
class="col-12 col-md-10 q-py-md q-pr-md q-pl-sm"
class="col-12 col-md-10 q-py-md q-pr-md"
id="customer-form-content"
:class="$q.screen.xs ? 'q-pl-md' : 'q-pl-sm'"
style="height: 100%; max-height: 100%; overflow-y: auto"
>
<BasicInformation
@ -4435,8 +4241,9 @@ watch([currentStatusList, productMode], () => {
</div>
</div>
<div
class="col-12 col-md-10 q-py-md q-pr-md q-pl-sm"
class="col-12 col-md-10 q-py-md q-pr-md"
id="customer-form-content"
:class="$q.screen.xs ? 'q-pl-md' : 'q-pl-sm'"
style="height: 100%; max-height: 100%; overflow-y: auto"
>
<BasicInformation