refactor(04): change product status
This commit is contained in:
parent
cdf1158003
commit
1742a54c47
1 changed files with 19 additions and 5 deletions
|
|
@ -663,9 +663,10 @@ const itemCard = [
|
|||
];
|
||||
|
||||
async function toggleStatusProduct(id: string, status: Status) {
|
||||
await editProduct(id, {
|
||||
const res = await editProduct(id, {
|
||||
status: status === 'INACTIVE' ? 'ACTIVE' : 'INACTIVE',
|
||||
});
|
||||
if (res) formDataProduct.value.status = res.status;
|
||||
|
||||
await alternativeFetch();
|
||||
flowStore.rotate();
|
||||
|
|
@ -726,11 +727,11 @@ async function triggerChangeStatus(
|
|||
await toggleStatusType(id, status as Status)
|
||||
.then(resolve)
|
||||
.catch(reject);
|
||||
} else if (type === 'service' || productMode.value === 'service') {
|
||||
} else if (type === 'service') {
|
||||
await toggleStatusService(id, status as Status)
|
||||
.then(resolve)
|
||||
.catch(reject);
|
||||
} else if (type === 'product' || productMode.value === 'product') {
|
||||
} else if (type === 'product') {
|
||||
await toggleStatusProduct(id, status as Status)
|
||||
.then(resolve)
|
||||
.catch(reject);
|
||||
|
|
@ -3841,8 +3842,9 @@ watch(
|
|||
</DialogForm>
|
||||
|
||||
<!-- edit product -->
|
||||
<!-- :edit="!(formDataProduct.status === 'INACTIVE')" -->
|
||||
<DialogForm
|
||||
:edit="!(formDataProduct.status === 'INACTIVE')"
|
||||
edit
|
||||
:isEdit="infoProductEdit"
|
||||
v-model:modal="dialogProductEdit"
|
||||
noAddress
|
||||
|
|
@ -3894,8 +3896,19 @@ watch(
|
|||
bgColor: 'var(--surface-1)',
|
||||
},
|
||||
]"
|
||||
v-model:toggle-status="formDataProduct.status"
|
||||
@view="imageDialog = true"
|
||||
@edit="refImageUpload && refImageUpload.browse()"
|
||||
@update:toggle-status="
|
||||
async () => {
|
||||
if (formDataProduct.status)
|
||||
await triggerChangeStatus(
|
||||
currentIdProduct,
|
||||
formDataProduct.status,
|
||||
'product',
|
||||
);
|
||||
}
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
@ -4195,9 +4208,10 @@ watch(
|
|||
</DialogForm>
|
||||
|
||||
<!-- edit service -->
|
||||
<!-- :edit="!(formDataProductService.status === 'INACTIVE')" -->
|
||||
<DialogForm
|
||||
no-address
|
||||
edit
|
||||
no-address
|
||||
height="95vh"
|
||||
:isEdit="infoServiceEdit"
|
||||
:title="$t('service')"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue