From deeb6283ee6603fb9462f9359ae998e7124ec441 Mon Sep 17 00:00:00 2001 From: Net <93821485+somnetsak123@users.noreply.github.com> Date: Tue, 18 Jun 2024 16:08:50 +0700 Subject: [PATCH] feat: submitService/clearFormService /fetchListOfService --- src/pages/04_product-service/MainPage.vue | 33 +++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/pages/04_product-service/MainPage.vue b/src/pages/04_product-service/MainPage.vue index 39f73043..86a65439 100644 --- a/src/pages/04_product-service/MainPage.vue +++ b/src/pages/04_product-service/MainPage.vue @@ -50,7 +50,9 @@ const { fetchListProduct, createProduct, + fetchListService, fetchListServiceById, + createService, } = productServiceStore; import ItemCard from 'src/components/ItemCard.vue'; @@ -93,6 +95,7 @@ const productMode = ref<'group' | 'type' | 'service' | 'product'>('group'); const productGroup = ref(); const productType = ref(); const product = ref(); +const service = ref(); const productAndServiceTab = ref('all'); const previousValue = ref(); @@ -215,6 +218,14 @@ async function fetchListOfProduct(productTypeId: string) { } } +async function fetchListOfService() { + const res = await fetchListService({ productTypeId: currentIdType.value }); + + if (res) { + service.value = res.result; + } +} + async function searchType() { const res = await await fetchListProductServiceType({ query: inputSearch.value, @@ -379,6 +390,28 @@ function clearFormProduct() { dialogProduct.value = false; } +function clearFormService() { + formDataProductService.value = { + code: '', + name: '', + detail: '', + attributes: { + additional: [], + }, + work: [], + }; + dialogService.value = false; +} + +async function submitService() { + const res = await createService(formDataProductService.value); + if (res) { + await fetchListOfService(); + } + + clearFormService(); +} + async function submitProduct() { formDataProduct.value.productTypeId = currentIdType.value; if (profileSubmit.value) {