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