refactor: edit name defineModel

This commit is contained in:
Thanaphon Frappet 2024-10-02 14:04:23 +07:00
parent 882b5fb753
commit d7a99d2ee2
13 changed files with 241 additions and 269 deletions

View file

@ -2029,7 +2029,7 @@ watch(
<KebabAction
:disable-delete="props.row.status !== 'CREATED'"
:status="props.row.status"
:idName="props.row.name"
:id-name="props.row.name"
@view="
async () => {
if (productMode === 'group') {
@ -2064,7 +2064,7 @@ watch(
}
}
"
@changeStatus="
@change-status="
async () => {
triggerChangeStatus(
props.row.id,
@ -2099,10 +2099,10 @@ watch(
}[productMode] || 'var(--pink-6-hsl)'
"
:action="actionDisplay"
@toggleStatus="
@toggle-status="
triggerChangeStatus(props.row.id, props.row.status)
"
@viewCard="
@view-card="
async () => {
if (productMode === 'group') {
editByTree = 'group';
@ -2116,7 +2116,7 @@ watch(
}
}
"
@updateCard="
@update-card="
async () => {
if (productMode === 'group') {
clearFormGroup();
@ -2128,7 +2128,7 @@ watch(
}
}
"
@deleteCard="
@delete-card="
() => {
if (productMode === 'group') {
deleteProductById(props.row.id);
@ -2711,7 +2711,7 @@ watch(
/>
<KebabAction
:status="props.row.status"
:idName="props.row.name"
:id-name="props.row.name"
@view="
async () => {
await fetchListOfOptionBranch();
@ -2755,7 +2755,7 @@ watch(
}
}
"
@changeStatus="
@change-status="
() => {
triggerChangeStatus(
props.row.id,
@ -2775,15 +2775,17 @@ watch(
:data="row"
:key="row.id"
:title="row.name"
:isDisabled="row.status === 'INACTIVE' ? true : false"
:is-disabled="
row.status === 'INACTIVE' ? true : false
"
:action="actionDisplay"
:priceDisplay="priceDisplay"
@toggleStatus="
:price-display="priceDisplay"
@toggle-status="
() => {
triggerChangeStatus(row.id, row.status, row.type);
}
"
@menuViewDetail="
@menu-view-detail="
async () => {
await fetchListOfOptionBranch();
if (row.type === 'product') {
@ -2799,7 +2801,7 @@ watch(
}
}
"
@menuEdit="
@menu-edit="
async () => {
await fetchListOfOptionBranch();
if (row.type === 'product') {
@ -2816,7 +2818,7 @@ watch(
}
}
"
@menuDelete="
@menu-delete="
() => {
if (row.type === 'product') {
deleteProductConfirm(row.id);
@ -2924,13 +2926,13 @@ watch(
>
<ProfileBanner
readonly
noImageAction
no-image-action
active
hideFade
hideActive
useToggle
hide-fade
hide-active
use-toggle
:img="`/images/product-service-${productMode}-avatar-add.png`"
:toggleTitle="$t('status.title')"
:toggle-title="$t('status.title')"
:icon="
productMode === 'group'
? 'mdi-folder-plus-outline'
@ -2945,7 +2947,7 @@ watch(
bgColor: 'var(--surface-1)',
},
]"
:fallbackCover="`/images/product-service-${productMode}-banner.png`"
:fallback-cover="`/images/product-service-${productMode}-banner.png`"
:color="`hsla(var(${
productMode === 'group'
? '--pink-6'
@ -3025,7 +3027,7 @@ watch(
<!-- edit group, edit type -->
<DrawerInfo
ref="formDialogRef"
v-model:drawerOpen="drawerInfo"
v-model:drawer-open="drawerInfo"
:title="
$t(
editByTree === 'group'
@ -3071,17 +3073,17 @@ watch(
}"
>
<ProfileBanner
noImageAction
no-image-action
:active="currentStatusGroupType !== 'INACTIVE'"
hideFade
:useToggle="actionDisplay"
hide-fade
:use-toggle="actionDisplay"
:readonly="!isEdit"
:icon="
editByTree === 'group'
? 'mdi-folder-outline'
: 'mdi-folder-table-outline'
"
:fallbackCover="`/images/product-service-${editByTree}-banner.png`"
:fallback-cover="`/images/product-service-${editByTree}-banner.png`"
v-model:toggle-status="currentStatusGroupType"
:color="`hsla(var(${
editByTree === 'group'
@ -3099,7 +3101,7 @@ watch(
}-hsl)/0.1)`"
:title="formDataGroup.name"
:caption="formDataGroup.code"
:toggleTitle="$t('status.title')"
:toggle-title="$t('status.title')"
:menu="[
{
icon: 'mdi-office-building-outline',
@ -3198,7 +3200,7 @@ watch(
id="info-group"
dense
:readonly="!isEdit"
:readOnlybranchOption="!readOnlybranchOption"
:read-onlybranch-option="!readOnlybranchOption"
v-model:options-branch="branchOption"
v-model:registered-branch-id="formDataGroup.registeredBranchId"
v-model:remark="formDataGroup.remark"
@ -3215,11 +3217,11 @@ watch(
<!-- work product, product work -->
<DialogForm
v-model:modal="dialogTotalProduct"
:submitLabel="$t('general.select')"
noAddress
noAppBox
:submit-label="$t('general.select')"
no-address
no-appBox
:title="$t('productService.product.allProduct')"
:saveAmount="selectProduct.length"
:save-amount="selectProduct.length"
:submit="
() => {
selectProduct.forEach((i) => {
@ -3331,7 +3333,7 @@ watch(
v-if="resultSearchProduct?.length === 0 || productIsAdd?.length === 0"
>
<NoData
:notFound="resultSearchProduct?.length === 0"
:not-found="resultSearchProduct?.length === 0"
:text="
productIsAdd?.length === 0
? $t('productService.product.noProduct')
@ -3356,20 +3358,20 @@ watch(
<TotalProductCardComponent
no-time-img
:index="selectProduct.findIndex((v) => v.id === i.id)"
:isAddProduct="!!selectProduct.find((v) => v.id === i.id)"
:is-add-product="!!selectProduct.find((v) => v.id === i.id)"
:action="false"
:data="{ ...i, type: 'product' }"
:title="i.name"
:status="i.status === 'INACTIVE' ? true : false"
:priceDisplay="priceDisplay"
@menuViewDetail="
:price-display="priceDisplay"
@menu-view-detail="
() => {
currentIdProduct = i.id;
assignFormDataProduct(i);
dialogProductEdit = true;
}
"
@menuEdit="
@menu-edit="
() => {
currentIdProduct = i.id;
infoProductEdit = true;
@ -3377,7 +3379,7 @@ watch(
dialogProductEdit = true;
}
"
@viewDetail="
@view-detail="
() => {
currentIdProduct = i.id;
infoProductEdit = false;
@ -3426,13 +3428,13 @@ watch(
}"
>
<ProfileBanner
hideFade
useToggle
hideActive
:toggleTitle="$t('status.title')"
hide-fade
use-toggle
hide-active
:toggle-title="$t('status.title')"
:img="profileUrl || '/images/product-avatar-add.png'"
fallbackCover="/images/product-banner.png"
:bgColor="`hsla(var(--teal-${$q.dark.isActive ? '8' : '10'}-hsl)/0.15)`"
fallback-cover="/images/product-banner.png"
:bg-color="`hsla(var(--teal-${$q.dark.isActive ? '8' : '10'}-hsl)/0.15)`"
:menu="[
{
icon: 'mdi-office-building-outline',
@ -3454,7 +3456,7 @@ watch(
formDataProduct.status === 'CREATED' ? 'INACTIVE' : 'CREATED';
}
"
:tabsList="
:tabs-list="
$q.screen.gt.sm
? false
: [
@ -3468,7 +3470,7 @@ watch(
},
]
"
v-model:currentTab="productTab"
v-model:current-tab="productTab"
/>
</div>
@ -3563,21 +3565,21 @@ watch(
>
<ProfileBanner
hideFade
:useToggle="actionDisplay"
:use-toggle="actionDisplay"
:active="formDataProduct.status !== 'INACTIVE'"
:title="formDataProduct.name"
:caption="formDataProduct.code"
icon="mdi-shopping-outline"
fallbackImg="/images/product-avatar.png"
fallback-img="/images/product-avatar.png"
color="var(--teal-10)"
:toggleTitle="$t('status.title')"
:toggle-title="$t('status.title')"
:img="
`${baseUrl}/product/${currentIdProduct}/image/${formDataProduct.selectedImage}`.concat(
refreshImageState ? `?ts=${Date.now()}` : '',
) || '/images/product-avatar.png'
"
fallbackCover="/images/product-banner.png"
:bgColor="`hsla(var(--teal-${$q.dark.isActive ? '8' : '10'}-hsl)/0.15)`"
fallback-cover="/images/product-banner.png"
:bg-color="`hsla(var(--teal-${$q.dark.isActive ? '8' : '10'}-hsl)/0.15)`"
:menu="[
{
icon: 'mdi-office-building-outline',
@ -3603,7 +3605,7 @@ watch(
);
}
"
:tabsList="
:tabs-list="
$q.screen.gt.sm
? false
: [
@ -3759,13 +3761,13 @@ watch(
}"
>
<ProfileBanner
hideFade
useToggle
hideActive
:toggleTitle="$t('status.title')"
hide-fade
use-toggle
hide-active
:toggle-title="$t('status.title')"
:img="profileUrl || '/images/service-avatar-add.png'"
fallbackCover="/images/service-banner.png"
:bgColor="`hsla(var(--orange-${$q.dark.isActive ? '6' : '5'}-hsl)/0.15)`"
fallback-cover="/images/service-banner.png"
:bg-color="`hsla(var(--orange-${$q.dark.isActive ? '6' : '5'}-hsl)/0.15)`"
:menu="[
{
icon: 'mdi-office-building-outline',
@ -3794,7 +3796,7 @@ watch(
: 'CREATED';
}
"
:tabsList="
:tabs-list="
$q.screen.gt.sm
? false
: [
@ -3808,7 +3810,7 @@ watch(
},
]
"
v-model:currentTab="serviceTab"
v-model:current-tab="serviceTab"
/>
</div>
@ -3915,7 +3917,7 @@ watch(
:tree-view="serviceTreeView"
:service="formDataProductService"
dense
@addProduct="
@add-product="
async (index) => {
await fetchListOfProductIsAdd(currentIdGrop);
currentWorkIndex = index;
@ -4027,7 +4029,7 @@ watch(
<div class="q-pa-lg full-height">
<WorkNameManagement
ref="workNameRef"
v-model:nameList="workNameItems"
v-model:name-list="workNameItems"
@delete="confirmDeleteWork"
@edit="editWork"
@add="createWork"
@ -4064,20 +4066,20 @@ watch(
}"
>
<ProfileBanner
hideFade
:useToggle="actionDisplay"
hide-fade
:use-toggle="actionDisplay"
:title="formDataProductService.name"
:caption="formDataProductService.code"
:active="formDataProductService.status !== 'INACTIVE'"
:toggleTitle="$t('status.title')"
:toggle-title="$t('status.title')"
:img="
`${baseUrl}/service/${currentIdService}/image/${formDataProductService.selectedImage}`.concat(
refreshImageState ? `?ts=${Date.now()}` : '',
) || '/images/service-avatar.png'
"
fallbackImg="/images/service-avatar.png"
fallbackCover="/images/service-banner.png"
:bgColor="`hsla(var(--orange-${$q.dark.isActive ? '6' : '5'}-hsl)/0.15)`"
fallback-img="/images/service-avatar.png"
fallback-cover="/images/service-banner.png"
:bg-color="`hsla(var(--orange-${$q.dark.isActive ? '6' : '5'}-hsl)/0.15)`"
:menu="[
{
icon: 'mdi-office-building-outline',
@ -4108,7 +4110,7 @@ watch(
);
}
"
:tabsList="
:tabs-list="
$q.screen.gt.sm
? false
: [
@ -4267,8 +4269,8 @@ watch(
:readonly="!infoServiceEdit"
v-model:work-items="workItems"
dense
:priceDisplay="priceDisplay"
@addProduct="
:price-display="priceDisplay"
@add-product="
async (index) => {
await fetchListOfProductIsAdd(currentIdGrop);
currentWorkIndex = index;
@ -4451,7 +4453,7 @@ watch(
<ImageUploadDialog
ref="refImageUpload"
v-model:dialogState="imageDialog"
v-model:dialog-state="imageDialog"
v-model:file="profileFileImg"
v-model:image-url="profileUrl as string"
v-model:data-list="imageList"