feat: สร้าง service

This commit is contained in:
Net 2024-06-21 11:40:18 +07:00
parent 6eea4aea2b
commit 37f1289b76

View file

@ -489,10 +489,23 @@ function clearFormService() {
},
work: [],
};
selectProduct.value = [];
dialogService.value = false;
}
function assignFormDataProductServiceCreate() {
workItems.value.forEach((item) => {
formDataProductService.value.work.push({
name: item.name,
attributes: item.attributes,
productId: item.product.map((productItem) => productItem.id),
});
});
}
async function submitService() {
assignFormDataProductServiceCreate();
const res = await createService(formDataProductService.value);
if (res) {
await fetchListOfService();
@ -1406,6 +1419,16 @@ watch(currentStatus, async () => {
v-model:modal="dialogService"
v-model:tabs-list="serviceTab"
v-model:current-tab="currentServiceTab"
:submit="
() => {
submitService();
}
"
:close="
() => {
dialogService = false;
}
"
>
<template #prepend>
<ProfileUpload
@ -1428,6 +1451,10 @@ watch(currentStatus, async () => {
openPropertiesDialog('service');
}
"
v-model:service-code="formDataProductService.code"
v-model:service-description="formDataProductService.detail"
v-model:service-name-th="formDataProductService.name"
@input-file="inputFile.click()"
/>
<FormServiceWork
v-model:work-items="workItems"