From 86a715473aca30e277c1857bbcb6e6e9283e13f4 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 7 Aug 2024 15:22:39 +0700
Subject: <iman> update all promo

---
 .../flashSale/components/FlashSaleNonDisplay.jsx   | 66 ++++++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 src/lib/flashSale/components/FlashSaleNonDisplay.jsx

(limited to 'src/lib/flashSale/components/FlashSaleNonDisplay.jsx')

diff --git a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx
new file mode 100644
index 00000000..85807fad
--- /dev/null
+++ b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx
@@ -0,0 +1,66 @@
+import Image from 'next/image';
+import { useEffect, useState } from 'react';
+
+import CountDown from '@/core/components/elements/CountDown/CountDown';
+import productSearchApi from '@/lib/product/api/productSearchApi';
+import ProductSlider from '@/lib/product/components/ProductSlider';
+
+import flashSaleApi from '../api/flashSaleApi';
+import { FlashSaleSkeleton } from '../skeleton/FlashSaleSkeleton';
+
+const FlashSaleNonDisplay = () => {
+  const [flashSales, setFlashSales] = useState(null);
+  const [isLoading, setIsLoading] = useState(true);
+
+  useEffect(() => {
+    const loadFlashSales = async () => {
+      const dataFlashSales = await flashSaleApi();
+      setFlashSales(dataFlashSales);
+      setIsLoading(false);
+    };
+    loadFlashSales();
+  }, []);
+
+  if (isLoading) {
+    return <FlashSaleSkeleton />;
+  }
+
+  return (
+    flashSales?.length > 0 && (
+      <div className='px-4 sm:px-0 grid grid-cols-1 gap-y-8'>
+        {flashSales.map((flashSale, index) => (
+          <div key={index}>
+            <div className='flex gap-x-3 mb-4 justify-between sm:justify-start'>
+              <div className='font-medium sm:text-h-lg mt-1.5'>
+                Penawaran Terbatas
+              </div>
+            </div>
+
+            <div className='relative'>
+              <FlashSaleProduct flashSaleId={flashSale.pricelistId} />
+            </div>
+          </div>
+        ))}
+      </div>
+    )
+  );
+};
+
+const FlashSaleProduct = ({ flashSaleId }) => {
+  const [products, setProducts] = useState(null);
+
+  useEffect(() => {
+    const loadProducts = async () => {
+      const dataProducts = await productSearchApi({
+        query: `fq=-flashsale_id_i:${flashSaleId}&fq=flashsale_price_f:[1 TO *]&limit=500&orderBy=flashsale_discount_f desc`,
+        operation: 'AND',
+      });
+      setProducts(dataProducts.response);
+    };
+    loadProducts();
+  }, [flashSaleId]);
+
+  return <ProductSlider products={products} />;
+};
+
+export default FlashSaleNonDisplay;
-- 
cgit v1.2.3


From 0fc1ee076d3a59b406f79716c343f15301c1066a Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 7 Aug 2024 17:06:58 +0700
Subject: <iman> update all promotion card flashSale

---
 src/lib/flashSale/components/FlashSaleNonDisplay.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/lib/flashSale/components/FlashSaleNonDisplay.jsx')

diff --git a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx
index 85807fad..8dc15b05 100644
--- a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx
+++ b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx
@@ -52,7 +52,7 @@ const FlashSaleProduct = ({ flashSaleId }) => {
   useEffect(() => {
     const loadProducts = async () => {
       const dataProducts = await productSearchApi({
-        query: `fq=-flashsale_id_i:${flashSaleId}&fq=flashsale_price_f:[1 TO *]&limit=500&orderBy=flashsale_discount_f desc`,
+        query: `fq=-flashsale_id_i:${flashSaleId}&fq=flashsale_price_f:[1 TO *]&limit=500&orderBy=flashsale-discount-desc`,
         operation: 'AND',
       });
       setProducts(dataProducts.response);
-- 
cgit v1.2.3


From 8f310309ea811d7524f90ffc43db29c1dd291c1a Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Thu, 15 Aug 2024 11:41:13 +0700
Subject: <iman> update limit penawaran terbatas to 25

---
 src/lib/flashSale/components/FlashSaleNonDisplay.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/lib/flashSale/components/FlashSaleNonDisplay.jsx')

diff --git a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx
index 8dc15b05..3218ab35 100644
--- a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx
+++ b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx
@@ -52,7 +52,7 @@ const FlashSaleProduct = ({ flashSaleId }) => {
   useEffect(() => {
     const loadProducts = async () => {
       const dataProducts = await productSearchApi({
-        query: `fq=-flashsale_id_i:${flashSaleId}&fq=flashsale_price_f:[1 TO *]&limit=500&orderBy=flashsale-discount-desc`,
+        query: `fq=-flashsale_id_i:${flashSaleId}&fq=flashsale_price_f:[1 TO *]&limit=25&orderBy=flashsale-discount-desc`,
         operation: 'AND',
       });
       setProducts(dataProducts.response);
-- 
cgit v1.2.3


From b22c0e52dc08083025330ef0a501e085cbf434df Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 16 Aug 2024 10:00:38 +0700
Subject: <iman> add button lihat semua

---
 src/lib/flashSale/components/FlashSaleNonDisplay.jsx | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

(limited to 'src/lib/flashSale/components/FlashSaleNonDisplay.jsx')

diff --git a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx
index 3218ab35..0068c98d 100644
--- a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx
+++ b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx
@@ -7,33 +7,46 @@ import ProductSlider from '@/lib/product/components/ProductSlider';
 
 import flashSaleApi from '../api/flashSaleApi';
 import { FlashSaleSkeleton } from '../skeleton/FlashSaleSkeleton';
+import Link from 'next/link';
+import { useRouter } from 'next/router'
 
 const FlashSaleNonDisplay = () => {
   const [flashSales, setFlashSales] = useState(null);
   const [isLoading, setIsLoading] = useState(true);
+  const [pencarian, setPencarian] = useState('');
+  const router = useRouter()
 
   useEffect(() => {
     const loadFlashSales = async () => {
       const dataFlashSales = await flashSaleApi();
       setFlashSales(dataFlashSales);
+      setPencarian(`fq=-flashsale_id_i:${dataFlashSales[0]?.pricelistId}&fq=flashsale_price_f:[1 TO *]&orderBy=flashsale-discount-desc`)
       setIsLoading(false);
     };
     loadFlashSales();
   }, []);
 
+  const handleSubmit = () => {
+    router.push(`/shop/search?${pencarian}`)
+  }
+
   if (isLoading) {
     return <FlashSaleSkeleton />;
   }
+ 
 
   return (
     flashSales?.length > 0 && (
       <div className='px-4 sm:px-0 grid grid-cols-1 gap-y-8'>
         {flashSales.map((flashSale, index) => (
           <div key={index}>
-            <div className='flex gap-x-3 mb-4 justify-between sm:justify-start'>
+            <div className='flex items-center mb-4 justify-between '>
               <div className='font-medium sm:text-h-lg mt-1.5'>
                 Penawaran Terbatas
               </div>
+              <div onClick={handleSubmit} className='!text-red-500 font-semibold cursor-pointer'>
+                  Lihat Semua
+              </div>
             </div>
 
             <div className='relative'>
-- 
cgit v1.2.3


From a20fd43f0cafe86444605c3bb8f2a998e1b9dbe6 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 19 Aug 2024 11:03:58 +0700
Subject: <iman> update link lihat semua non display voucher

---
 src/lib/flashSale/components/FlashSaleNonDisplay.jsx | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

(limited to 'src/lib/flashSale/components/FlashSaleNonDisplay.jsx')

diff --git a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx
index 0068c98d..6e379500 100644
--- a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx
+++ b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx
@@ -13,21 +13,19 @@ import { useRouter } from 'next/router'
 const FlashSaleNonDisplay = () => {
   const [flashSales, setFlashSales] = useState(null);
   const [isLoading, setIsLoading] = useState(true);
-  const [pencarian, setPencarian] = useState('');
   const router = useRouter()
 
   useEffect(() => {
     const loadFlashSales = async () => {
       const dataFlashSales = await flashSaleApi();
       setFlashSales(dataFlashSales);
-      setPencarian(`fq=-flashsale_id_i:${dataFlashSales[0]?.pricelistId}&fq=flashsale_price_f:[1 TO *]&orderBy=flashsale-discount-desc`)
       setIsLoading(false);
     };
     loadFlashSales();
   }, []);
 
   const handleSubmit = () => {
-    router.push(`/shop/search?${pencarian}`)
+    router.push(`/shop/search?penawaran=${flashSales[0]?.pricelistId}`)
   }
 
   if (isLoading) {
-- 
cgit v1.2.3


From 22a13e2a115dc76fda0f72efbec57f39055af2a3 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Mon, 18 Nov 2024 08:27:26 +0700
Subject: <iman> fix code no data search

---
 src/lib/flashSale/components/FlashSaleNonDisplay.jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/lib/flashSale/components/FlashSaleNonDisplay.jsx')

diff --git a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx
index c91de2be..4b420fac 100644
--- a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx
+++ b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx
@@ -56,7 +56,7 @@ const FlashSaleProduct = ({ flashSaleId }) => {
   useEffect(() => {
     const loadProducts = async () => {
       const dataProducts = await productSearchApi({
-        query: `fq=-flashsale_id_i:${flashSaleId}&fq=flashsale_price_f:[1 TO *]&limit=25&orderBy=flashsale-discount-desc`,
+        query: `fq=-flashsale_id_i:${flashSaleId}&fq=flashsale_price_f:[1 TO *]&limit=25&orderBy=flashsale-discount-desc&source=similar`,
         operation: 'AND',
       });
       setProducts(dataProducts.response);
-- 
cgit v1.2.3

