From 52b6604cac87d06500597de8dd56be61eb6fad10 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 2 Sep 2024 14:46:44 +0700
Subject: <iman> update category management

---
 src/lib/home/components/CategoryDynamic.jsx | 52 ++++++++++++++---------------
 1 file changed, 26 insertions(+), 26 deletions(-)

(limited to 'src/lib/home/components/CategoryDynamic.jsx')

diff --git a/src/lib/home/components/CategoryDynamic.jsx b/src/lib/home/components/CategoryDynamic.jsx
index 0ab9312a..c257e9f9 100644
--- a/src/lib/home/components/CategoryDynamic.jsx
+++ b/src/lib/home/components/CategoryDynamic.jsx
@@ -13,32 +13,32 @@ import { Navigation, Pagination, Autoplay } from 'swiper';
 
 const CategoryDynamic = () => {
   const { categoryManagement } = useCategoryManagement();
-  const [categoryData, setCategoryData] = useState({});
-  const [subCategoryData, setSubCategoryData] = useState({});
+  // const [categoryData, setCategoryData] = useState({});
+  // const [subCategoryData, setSubCategoryData] = useState({});
   
-  useEffect(() => {
-    const fetchCategoryData = async () => {
-      if (categoryManagement && categoryManagement.data) {
-        const updatedCategoryData = {};
-        const updatedSubCategoryData = {};
+  // useEffect(() => {
+  //   const fetchCategoryData = async () => {
+  //     if (categoryManagement && categoryManagement.data) {
+  //       const updatedCategoryData = {};
+  //       const updatedSubCategoryData = {};
         
-        for (const category of categoryManagement.data) {
-          const countLevel1 = await odooApi('GET', `/api/v1/category/numFound?parent_id=${category.categoryIdI}`);
+  //       for (const category of categoryManagement.data) {
+  //         const countLevel1 = await odooApi('GET', `/api/v1/category/numFound?parent_id=${category.categoryIdI}`);
           
-          updatedCategoryData[category.categoryIdI] = countLevel1?.numFound;
+  //         updatedCategoryData[category.categoryIdI] = countLevel1?.numFound;
           
-          for (const subCategory of countLevel1?.children) {
-            updatedSubCategoryData[subCategory.id] = subCategory?.numFound;
-          }
-        }
+  //         for (const subCategory of countLevel1?.children) {
+  //           updatedSubCategoryData[subCategory.id] = subCategory?.numFound;
+  //         }
+  //       }
 
-        setCategoryData(updatedCategoryData);
-        setSubCategoryData(updatedSubCategoryData);
-      }
-    };
+  //       setCategoryData(updatedCategoryData);
+  //       setSubCategoryData(updatedSubCategoryData);
+  //     }
+  //   };
 
-    fetchCategoryData();
-  }, [categoryManagement.isLoading]);
+  //   fetchCategoryData();
+  // }, [categoryManagement.isLoading]);
 
   const swiperBanner = {
     modules: [Pagination, ],
@@ -54,16 +54,16 @@ const CategoryDynamic = () => {
   return (
     <div>
         {categoryManagement && categoryManagement.data?.map((category) => {
-          const countLevel1 = categoryData[category.categoryIdI] || 0;
+          // const countLevel1 = categoryData[category.categoryIdI] || 0;
           
           return (
             <Skeleton key={category.id} isLoaded={categoryManagement}>
               <div key={category.id}>
                 <div className='bagian-judul flex flex-row justify-start items-center gap-3 mb-4 mt-4'>
                   <div className='font-semibold sm:text-h-lg mr-2'>{category.name}</div>
-                  <Skeleton isLoaded={countLevel1 != 0}>
+                  {/* <Skeleton isLoaded={countLevel1 != 0}>
                     <p className={`text-gray_r-10 text-sm`}>{countLevel1} Produk tersedia</p>
-                  </Skeleton>
+                  </Skeleton> */}
                   <Link href={createSlug('/shop/category/', category?.name, category?.categoryIdI)} className="!text-red-500 font-semibold">Lihat Semua</Link>
                 </div>
                 
@@ -71,7 +71,7 @@ const CategoryDynamic = () => {
                 <Swiper {...swiperBanner}
                 >
                   {category.categories.map((subCategory) => {
-                    const countLevel2 = subCategoryData[subCategory.idLevel2] || 0;
+                    // const countLevel2 = subCategoryData[subCategory.idLevel2] || 0;
 
                     return (
                       <SwiperSlide key={subCategory.id}>
@@ -87,11 +87,11 @@ const CategoryDynamic = () => {
                               />
                               <div className='bagian-judul flex flex-col justify-center items-start gap-2 ml-2'>
                                 <div className='font-semibold text-lg mr-2'>{subCategory?.name}</div>
-                                <Skeleton isLoaded={countLevel2 != 0}>
+                                {/* <Skeleton isLoaded={countLevel2 != 0}>
                                   <p className={`text-gray_r-10 text-sm`}>
                                     {countLevel2} Produk tersedia
                                   </p>
-                                </Skeleton>
+                                </Skeleton> */}
                                 <Link href={createSlug('/shop/category/', subCategory?.name, subCategory?.idLevel2)} className="!text-red-500 font-semibold">Lihat Semua</Link>
                               </div>
                             </div>
-- 
cgit v1.2.3

