refactor: kebab action
This commit is contained in:
parent
5ec6d1c9d5
commit
bc578d569c
11 changed files with 518 additions and 1357 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue