refactor(04): change service status

This commit is contained in:
puriphatt 2024-08-14 17:48:56 +07:00
parent cb06e3d8c3
commit 99163939e9

View file

@ -672,9 +672,10 @@ async function toggleStatusProduct(id: string, status: Status) {
} }
async function toggleStatusService(id: string, status: Status) { async function toggleStatusService(id: string, status: Status) {
await editService(id, { const res = await editService(id, {
status: status === 'INACTIVE' ? 'ACTIVE' : 'INACTIVE', status: status === 'INACTIVE' ? 'ACTIVE' : 'INACTIVE',
}); });
if (res) formDataProductService.value.status = res.status;
await alternativeFetch(); await alternativeFetch();
flowStore.rotate(); flowStore.rotate();
@ -4196,7 +4197,7 @@ watch(
<!-- edit service --> <!-- edit service -->
<DialogForm <DialogForm
no-address no-address
:edit="!(formDataProductService.status === 'INACTIVE')" edit
height="95vh" height="95vh"
:isEdit="infoServiceEdit" :isEdit="infoServiceEdit"
:title="$t('service')" :title="$t('service')"
@ -4232,7 +4233,7 @@ watch(
<ProfileBanner <ProfileBanner
hideFade hideFade
useToggle useToggle
hideActive :active="formDataProductService.status !== 'INACTIVE'"
:readonly="!infoServiceEdit" :readonly="!infoServiceEdit"
:toggleTitle="$t('formDialogTitleUseStatus')" :toggleTitle="$t('formDialogTitleUseStatus')"
:img="profileUrl || '/images/service-avatar-add.png'" :img="profileUrl || '/images/service-avatar-add.png'"
@ -4250,8 +4251,19 @@ watch(
bgColor: 'var(--surface-1)', bgColor: 'var(--surface-1)',
}, },
]" ]"
v-model:toggle-status="formDataProductService.status"
@view="imageDialog = true" @view="imageDialog = true"
@edit="refImageUpload && refImageUpload.browse()" @edit="refImageUpload && refImageUpload.browse()"
@update:toggle-status="
async () => {
if (formDataProductService.status)
await triggerChangeStatus(
currentIdService,
formDataProductService.status,
'service',
);
}
"
/> />
</div> </div>