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: [], work: [],
}; };
selectProduct.value = [];
dialogService.value = false; 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() { async function submitService() {
assignFormDataProductServiceCreate();
const res = await createService(formDataProductService.value); const res = await createService(formDataProductService.value);
if (res) { if (res) {
await fetchListOfService(); await fetchListOfService();
@ -1406,6 +1419,16 @@ watch(currentStatus, async () => {
v-model:modal="dialogService" v-model:modal="dialogService"
v-model:tabs-list="serviceTab" v-model:tabs-list="serviceTab"
v-model:current-tab="currentServiceTab" v-model:current-tab="currentServiceTab"
:submit="
() => {
submitService();
}
"
:close="
() => {
dialogService = false;
}
"
> >
<template #prepend> <template #prepend>
<ProfileUpload <ProfileUpload
@ -1428,6 +1451,10 @@ watch(currentStatus, async () => {
openPropertiesDialog('service'); 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 <FormServiceWork
v-model:work-items="workItems" v-model:work-items="workItems"