From d953eb482d003694076af851e750c7226d2d2559 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 5 Jun 2024 13:02:27 +0700
Subject: <iman> add Informasi SNI & TKDN

---
 src/lib/product/components/ProductCard.jsx | 109 +++++++++++++++++++++++++++--
 1 file changed, 102 insertions(+), 7 deletions(-)

(limited to 'src/lib/product/components/ProductCard.jsx')

diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx
index 38ed35f8..8dde4dbe 100644
--- a/src/lib/product/components/ProductCard.jsx
+++ b/src/lib/product/components/ProductCard.jsx
@@ -1,7 +1,7 @@
 import clsx from 'clsx';
 import ImageNext from 'next/image';
 import { useRouter } from 'next/router';
-import { useMemo } from 'react';
+import { useMemo, useEffect, useState } from 'react';
 
 import Image from '@/core/components/elements/Image/Image';
 import Link from '@/core/components/elements/Link/Link';
@@ -15,6 +15,47 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
   const router = useRouter();
   const utmSource = useUtmSource();
 
+  const [isSni, setIsSni] = useState(false);
+  const [isTkdn, setTkdn] = useState(false);
+
+  useEffect(() => {
+    // Lakukan pemanggilan API untuk memeriksa isSni
+    const fetchSniData = async () => {
+      try {
+        const response = await fetch('URL_API_SNI');
+        const data = await response.json();
+        if (data && data.sni) {
+          setIsSni(true);
+        } else {
+          setIsSni(false);
+        }
+      } catch (error) {
+        console.error('Error fetching SNI data:', error);
+        setIsSni(false);
+      }
+    };
+
+    // Lakukan pemanggilan API untuk memeriksa isTkdn
+    const fetchTkdnData = async () => {
+      try {
+        const response = await fetch('URL_API_TKDN');
+        const data = await response.json();
+        if (data && data.tkdn) {
+          setTkdn(true);
+        } else {
+          setTkdn(false);
+        }
+      } catch (error) {
+        console.error('Error fetching TKDN data:', error);
+        setTkdn(false);
+      }
+    };
+    fetchSniData();
+    fetchTkdnData();
+    return () => {
+    };
+  }, []);
+
   const callForPriceWhatsapp = whatsappUrl('product', {
     name: product.name,
     manufacture: product.manufacture?.name,
@@ -41,11 +82,39 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
     return (
       <div className='rounded shadow-sm border border-gray_r-4 bg-white h-[300px] md:h-[350px]'>
         <Link href={URL.product} className='border-b border-gray_r-4 relative'>
+        <div className="relative">
           <Image
             src={image}
             alt={product?.name}
-            className='w-full object-contain object-center h-36 sm:h-48'
+            className="gambarA w-full object-contain object-center h-36 sm:h-48"
           />
+          <div className="absolute top-0 right-0 flex  mt-3">
+            <div className="gambarB ">
+              {!isSni && (
+                <ImageNext
+                  src="/images/sni-logo.png"
+                  alt="SNI Logo"
+                  className="w-4 h-5 object-contain object-top   sm:h-6"
+                  width={50}
+                  height={50}
+                />
+              )}
+            </div>
+            <div className="gambarC  ">
+              {!isTkdn && (
+                <ImageNext
+                  src="/images/TKDN.png"
+                  alt="TKDN"
+                  className="w-11 h-6 object-contain object-top  ml-1 mr-1 sm:h-6"
+                  width={50}
+                  height={50}
+                />
+              )}
+            </div>
+          </div>
+        </div>
+
+
           {router.pathname != '/' && product?.flashSale?.id > 0 && (
             <div className='absolute bottom-0 w-full grid'>
               <div className='absolute bottom-0 w-full h-full'>
@@ -171,11 +240,37 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
       <div className='flex bg-white'>
         <div className='w-4/12'>
           <Link href={URL.product} className='relative'>
-            <Image
-              src={image}
-              alt={product?.name}
-              className='w-full object-contain object-center h-36'
-            />
+          <div className="relative">
+          <Image
+            src={image}
+            alt={product?.name}
+            className="gambarA w-full object-contain object-center h-36 sm:h-48"
+          />
+          <div className="absolute top-0 right-0 flex  mt-3">
+            <div className="gambarB ">
+              {!isSni && (
+                <ImageNext
+                  src="/images/sni-logo.png"
+                  alt="SNI Logo"
+                  className="w-4 h-5 object-contain object-top   sm:h-6"
+                  width={50}
+                  height={50}
+                />
+              )}
+            </div>
+            <div className="gambarC  ">
+              {!isTkdn && (
+                <ImageNext
+                  src="/images/TKDN.png"
+                  alt="TKDN"
+                  className="w-11 h-6 object-contain object-top  ml-1 sm:h-6"
+                  width={50}
+                  height={50}
+                />
+              )}
+            </div>
+          </div>
+        </div>
             {product.variantTotal > 1 && (
               <div className='absolute badge-gray bottom-1.5 left-1.5'>
                 {product.variantTotal} Varian
-- 
cgit v1.2.3


From 87432c8627896711167813654dce2969ce45e643 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 5 Jun 2024 13:11:26 +0700
Subject: <iman> add Informasi SNI & TKDN

---
 src/lib/product/components/ProductCard.jsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/lib/product/components/ProductCard.jsx')

diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx
index 8dde4dbe..00edc29d 100644
--- a/src/lib/product/components/ProductCard.jsx
+++ b/src/lib/product/components/ProductCard.jsx
@@ -90,7 +90,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
           />
           <div className="absolute top-0 right-0 flex  mt-3">
             <div className="gambarB ">
-              {!isSni && (
+              {isSni && (
                 <ImageNext
                   src="/images/sni-logo.png"
                   alt="SNI Logo"
@@ -101,7 +101,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
               )}
             </div>
             <div className="gambarC  ">
-              {!isTkdn && (
+              {isTkdn && (
                 <ImageNext
                   src="/images/TKDN.png"
                   alt="TKDN"
-- 
cgit v1.2.3


From f9f1fdf83c2b6ed5c1d85d7418d45aeed9b05c77 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 5 Jun 2024 15:24:42 +0700
Subject: <iman> add feature SNI-TKDR

---
 src/lib/product/components/ProductCard.jsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/lib/product/components/ProductCard.jsx')

diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx
index 00edc29d..8dde4dbe 100644
--- a/src/lib/product/components/ProductCard.jsx
+++ b/src/lib/product/components/ProductCard.jsx
@@ -90,7 +90,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
           />
           <div className="absolute top-0 right-0 flex  mt-3">
             <div className="gambarB ">
-              {isSni && (
+              {!isSni && (
                 <ImageNext
                   src="/images/sni-logo.png"
                   alt="SNI Logo"
@@ -101,7 +101,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
               )}
             </div>
             <div className="gambarC  ">
-              {isTkdn && (
+              {!isTkdn && (
                 <ImageNext
                   src="/images/TKDN.png"
                   alt="TKDN"
-- 
cgit v1.2.3


From 755b61a8a7a082cc13f7ecb4a79807f90e60b3d6 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 5 Jun 2024 16:50:38 +0700
Subject: <iman> add feature SNI-TKDN

---
 src/lib/product/components/ProductCard.jsx | 103 +++++++++--------------------
 1 file changed, 32 insertions(+), 71 deletions(-)

(limited to 'src/lib/product/components/ProductCard.jsx')

diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx
index 8dde4dbe..48a30b51 100644
--- a/src/lib/product/components/ProductCard.jsx
+++ b/src/lib/product/components/ProductCard.jsx
@@ -1,7 +1,7 @@
 import clsx from 'clsx';
 import ImageNext from 'next/image';
 import { useRouter } from 'next/router';
-import { useMemo, useEffect, useState } from 'react';
+import { useMemo} from 'react';
 
 import Image from '@/core/components/elements/Image/Image';
 import Link from '@/core/components/elements/Link/Link';
@@ -15,46 +15,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
   const router = useRouter();
   const utmSource = useUtmSource();
 
-  const [isSni, setIsSni] = useState(false);
-  const [isTkdn, setTkdn] = useState(false);
-
-  useEffect(() => {
-    // Lakukan pemanggilan API untuk memeriksa isSni
-    const fetchSniData = async () => {
-      try {
-        const response = await fetch('URL_API_SNI');
-        const data = await response.json();
-        if (data && data.sni) {
-          setIsSni(true);
-        } else {
-          setIsSni(false);
-        }
-      } catch (error) {
-        console.error('Error fetching SNI data:', error);
-        setIsSni(false);
-      }
-    };
-
-    // Lakukan pemanggilan API untuk memeriksa isTkdn
-    const fetchTkdnData = async () => {
-      try {
-        const response = await fetch('URL_API_TKDN');
-        const data = await response.json();
-        if (data && data.tkdn) {
-          setTkdn(true);
-        } else {
-          setTkdn(false);
-        }
-      } catch (error) {
-        console.error('Error fetching TKDN data:', error);
-        setTkdn(false);
-      }
-    };
-    fetchSniData();
-    fetchTkdnData();
-    return () => {
-    };
-  }, []);
+  
 
   const callForPriceWhatsapp = whatsappUrl('product', {
     name: product.name,
@@ -90,7 +51,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
           />
           <div className="absolute top-0 right-0 flex  mt-3">
             <div className="gambarB ">
-              {!isSni && (
+              {product.isSni && (
                 <ImageNext
                   src="/images/sni-logo.png"
                   alt="SNI Logo"
@@ -101,7 +62,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
               )}
             </div>
             <div className="gambarC  ">
-              {!isTkdn && (
+              {product.isTkdn && (
                 <ImageNext
                   src="/images/TKDN.png"
                   alt="TKDN"
@@ -241,35 +202,35 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
         <div className='w-4/12'>
           <Link href={URL.product} className='relative'>
           <div className="relative">
-          <Image
-            src={image}
-            alt={product?.name}
-            className="gambarA w-full object-contain object-center h-36 sm:h-48"
-          />
-          <div className="absolute top-0 right-0 flex  mt-3">
-            <div className="gambarB ">
-              {!isSni && (
-                <ImageNext
-                  src="/images/sni-logo.png"
-                  alt="SNI Logo"
-                  className="w-4 h-5 object-contain object-top   sm:h-6"
-                  width={50}
-                  height={50}
-                />
-              )}
-            </div>
-            <div className="gambarC  ">
-              {!isTkdn && (
-                <ImageNext
-                  src="/images/TKDN.png"
-                  alt="TKDN"
-                  className="w-11 h-6 object-contain object-top  ml-1 sm:h-6"
-                  width={50}
-                  height={50}
-                />
-              )}
+            <Image
+              src={image}
+              alt={product?.name}
+              className="gambarA w-full object-contain object-center h-36 sm:h-48"
+            />
+            <div className="absolute top-0 right-0 flex  mt-3">
+              <div className="gambarB ">
+                {product.isSni && (
+                  <ImageNext
+                    src="/images/sni-logo.png"
+                    alt="SNI Logo"
+                    className="w-4 h-5 object-contain object-top   sm:h-6"
+                    width={50}
+                    height={50}
+                  />
+                )}
+              </div>
+              <div className="gambarC  ">
+                {product.isTkdn && (
+                  <ImageNext
+                    src="/images/TKDN.png"
+                    alt="TKDN"
+                    className="w-11 h-6 object-contain object-top  ml-1 sm:h-6"
+                    width={50}
+                    height={50}
+                  />
+                )}
+              </div>
             </div>
-          </div>
         </div>
             {product.variantTotal > 1 && (
               <div className='absolute badge-gray bottom-1.5 left-1.5'>
-- 
cgit v1.2.3


From f39f03f4d4e59597ffcc73ddb1b108c233842bf8 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 5 Jun 2024 17:01:12 +0700
Subject: <iman> add feature SNI-TKDN

---
 src/lib/product/components/ProductCard.jsx | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

(limited to 'src/lib/product/components/ProductCard.jsx')

diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx
index 48a30b51..357f3fd9 100644
--- a/src/lib/product/components/ProductCard.jsx
+++ b/src/lib/product/components/ProductCard.jsx
@@ -1,7 +1,7 @@
 import clsx from 'clsx';
 import ImageNext from 'next/image';
 import { useRouter } from 'next/router';
-import { useMemo} from 'react';
+import { useMemo, useEffect, useState } from 'react';
 
 import Image from '@/core/components/elements/Image/Image';
 import Link from '@/core/components/elements/Link/Link';
@@ -15,7 +15,6 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
   const router = useRouter();
   const utmSource = useUtmSource();
 
-  
 
   const callForPriceWhatsapp = whatsappUrl('product', {
     name: product.name,
-- 
cgit v1.2.3

