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/variant/components/VariantCard.jsx | 72 +++++++++++++++++++++++++++++-
 1 file changed, 71 insertions(+), 1 deletion(-)

(limited to 'src/lib/variant/components/VariantCard.jsx')

diff --git a/src/lib/variant/components/VariantCard.jsx b/src/lib/variant/components/VariantCard.jsx
index 9f1b5733..87e5d68e 100644
--- a/src/lib/variant/components/VariantCard.jsx
+++ b/src/lib/variant/components/VariantCard.jsx
@@ -7,9 +7,51 @@ import { createSlug } from '@/core/utils/slug'
 import currencyFormat from '@/core/utils/currencyFormat'
 import { updateItemCart } from '@/core/utils/cart'
 import whatsappUrl from '@/core/utils/whatsappUrl'
+import ImageNext from 'next/image';
+import { useMemo, useEffect, useState } from 'react';
 
 const VariantCard = ({ product, openOnClick = true, buyMore = false }) => {
   const router = useRouter()
+  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 addItemToCart = () => {
     toast.success('Berhasil menambahkan ke keranjang', { duration: 1500 })
@@ -27,11 +69,39 @@ const VariantCard = ({ product, openOnClick = true, buyMore = false }) => {
   const Card = () => (
     <div className='flex gap-x-3'>
       <div className='w-4/12 flex items-center gap-x-2'>
-        <Image
+       
+      <div className="relative">
+      <Image
           src={product.parent.image}
           alt={product.parent.name}
           className='object-contain object-center border border-gray_r-6 h-32 w-full rounded-md'
         />
+          <div className="absolute top-0 right-4 flex  mt-3">
+            <div className="gambarB ">
+              {!isSni && (
+                <ImageNext
+                  src="/images/sni-logo.png"
+                  alt="SNI Logo"
+                  className="w-2 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-5 h-6 object-contain object-top  ml-1 mr-1 sm:h-6"
+                  width={50}
+                  height={50}
+                />
+              )}
+            </div>
+          </div>
+        </div>
+
       </div>
       <div className='w-8/12 flex flex-col'>
         <p className='product-card__title wrap-line-ellipsis-2'>{product.parent.name}</p>
-- 
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/variant/components/VariantCard.jsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/lib/variant/components/VariantCard.jsx')

diff --git a/src/lib/variant/components/VariantCard.jsx b/src/lib/variant/components/VariantCard.jsx
index 87e5d68e..f5ae4478 100644
--- a/src/lib/variant/components/VariantCard.jsx
+++ b/src/lib/variant/components/VariantCard.jsx
@@ -78,7 +78,7 @@ const VariantCard = ({ product, openOnClick = true, buyMore = false }) => {
         />
           <div className="absolute top-0 right-4 flex  mt-3">
             <div className="gambarB ">
-              {!isSni && (
+              {product.isSni && (
                 <ImageNext
                   src="/images/sni-logo.png"
                   alt="SNI Logo"
@@ -89,7 +89,7 @@ const VariantCard = ({ product, openOnClick = true, buyMore = false }) => {
               )}
             </div>
             <div className="gambarC  ">
-              {!isTkdn && (
+              {product.isTkdn && (
                 <ImageNext
                   src="/images/TKDN.png"
                   alt="TKDN"
-- 
cgit v1.2.3


From 68a3c897edef3f42a339d92ed8d663039f3ddfc7 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Thu, 6 Jun 2024 09:39:01 +0700
Subject: <iman> add feature SNI-TKDN

---
 src/lib/variant/components/VariantCard.jsx | 41 ++----------------------------
 1 file changed, 2 insertions(+), 39 deletions(-)

(limited to 'src/lib/variant/components/VariantCard.jsx')

diff --git a/src/lib/variant/components/VariantCard.jsx b/src/lib/variant/components/VariantCard.jsx
index f5ae4478..9f65fc3c 100644
--- a/src/lib/variant/components/VariantCard.jsx
+++ b/src/lib/variant/components/VariantCard.jsx
@@ -12,46 +12,9 @@ import { useMemo, useEffect, useState } from 'react';
 
 const VariantCard = ({ product, openOnClick = true, buyMore = false }) => {
   const router = useRouter()
-  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 addItemToCart = () => {
     toast.success('Berhasil menambahkan ke keranjang', { duration: 1500 })
-- 
cgit v1.2.3

