diff --git a/src/pages/04_product-service/MainPage.vue b/src/pages/04_product-service/MainPage.vue index a2bf0dab..d9dc9f8f 100644 --- a/src/pages/04_product-service/MainPage.vue +++ b/src/pages/04_product-service/MainPage.vue @@ -139,6 +139,7 @@ const productMode = ref<'group' | 'type' | 'service' | 'product'>('group'); const productGroup = ref(); const productType = ref(); const product = ref<(ProductList & { type: 'product' })[]>(); +const productIsAdd = ref<(ProductList & { type: 'product' })[]>(); const service = ref<(Service & { type: 'service' })[]>(); const resultSearchProduct = ref(); const productAndService = ref([]); @@ -366,6 +367,27 @@ async function fetchListGroups() { } } +async function fetchListOfProductIsAdd(productTypeId: string) { + const res = await fetchListProduct({ + status: + currentStatus.value === 'INACTIVE' + ? 'INACTIVE' + : currentStatus.value === 'ACTIVE' + ? 'ACTIVE' + : undefined, + productTypeId, + }); + + if (res) { + productIsAdd.value = res.result.map((v) => { + return { + ...v, + type: 'product', + }; + }); + } +} + async function fetchListOfProduct(productTypeId: string) { const res = await fetchListProduct({ page: currentPageProduct.value, @@ -1839,7 +1861,7 @@ watch(currentPageService, async () => { :class="`${$q.screen.gt.sm ? 'col-3 ' : $q.screen.gt.xs ? 'col-6' : 'col-12'}`" v-for="i in (!!inputSearchProductAndService ? resultSearchProduct - : product + : productIsAdd )?.filter((i) => { if (i.status === 'INACTIVE') { return false; @@ -2081,7 +2103,7 @@ watch(currentPageService, async () => { dense @addProduct=" async (index) => { - await fetchListOfProduct(currentIdType); + await fetchListOfProductIsAdd(currentIdType); currentWorkIndex = index; dialogTotalProduct = true; }