From b4a595eaa8600e7bd1bafcef38abe4c01a5b664c Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 12 Mar 2025 16:59:18 +0700
Subject: <iman> fix transaction

---
 src/lib/transaction/components/Transactions.jsx | 28 +++++++------------------
 1 file changed, 7 insertions(+), 21 deletions(-)

(limited to 'src/lib/transaction/components/Transactions.jsx')

diff --git a/src/lib/transaction/components/Transactions.jsx b/src/lib/transaction/components/Transactions.jsx
index d93c9aef..ece97734 100644
--- a/src/lib/transaction/components/Transactions.jsx
+++ b/src/lib/transaction/components/Transactions.jsx
@@ -80,7 +80,6 @@ const Transactions = ({ context = '' }) => {
   const [isOpenCalender, setIsOpenCalender] = useState(false);
 
   const parseDate = (date) => {
-    console.log('masuk sini', date);
     if (null || 'null') return null;
     if (!date) return null;
     if (date instanceof Date) return date; // Jika sudah Date, langsung return
@@ -95,19 +94,6 @@ const Transactions = ({ context = '' }) => {
       key: 'selection',
     },
   ]);
-  console.log('startDate', startDate);
-  console.log('state', state);
-  // useEffect(() => {
-  //   if (state[0].startDate != null) {
-  //     setState([
-  //       {
-  //         startDate: parseDate(startDate),
-  //         endDate: parseDate(endDate),
-  //         key: 'selection',
-  //       },
-  //     ]);
-  //   }
-  // }, [startDate, endDate]);
 
   const query = {
     name: q,
@@ -369,7 +355,7 @@ const Transactions = ({ context = '' }) => {
     }
 
     if (status === 'all') {
-      router.push('/my/transactions');
+      router.push(`${router.pathname}`);
     } else {
       setPageNew(1);
     }
@@ -384,7 +370,7 @@ const Transactions = ({ context = '' }) => {
       },
     ]);
     setIsOpenCalender(false);
-    router.push('/my/transactions');
+    router.push(`${router.pathname}`);
   };
 
   const formatDate = (dateString) => {
@@ -649,7 +635,7 @@ const Transactions = ({ context = '' }) => {
                               />
                             ))}
                           <Link
-                            href={`/my/quotations/${saleOrder?.id}`}
+                            href={`${router.pathname}/${saleOrder?.id}`}
                             className=' text-red-500 text-nowrap'
                           >
                             {saleOrder.products?.length > 6
@@ -730,7 +716,7 @@ const Transactions = ({ context = '' }) => {
             pageCount={pageCount}
             currentPage={parseInt(pageNew)}
             // url={router.pathname + pageQuery}
-            url={`/my/transactions?${toQuery(_.omit(query, ['page']))}`}
+            url={`${router.pathname}?${toQuery(_.omit(query, ['page']))}`}
             className='mt-2 mb-2'
           />
 
@@ -997,7 +983,7 @@ const Transactions = ({ context = '' }) => {
                         className='border py-2 px-4 hover:border-red-500 w-full rounded-lg'
                       >
                         <Link
-                          href={`/my/transactions/${saleOrder?.id}`}
+                          href={`${router.pathname}/${saleOrder?.id}`}
                           className='hover:border-red-500 block w-full'
                         >
                           <div className='flex flex-row justify-between items-center py-2'>
@@ -1068,7 +1054,7 @@ const Transactions = ({ context = '' }) => {
                                             />
                                           ))}
                                         <Link
-                                          href={`/my/quotations/${saleOrder?.id}`}
+                                          href={`${router.pathname}/${saleOrder?.id}`}
                                           className='text-sm text-red-500 text-nowrap'
                                         >
                                           {saleOrder.products?.length > 6
@@ -1182,7 +1168,7 @@ const Transactions = ({ context = '' }) => {
               pageCount={pageCount}
               currentPage={parseInt(pageNew)}
               // url={router.pathname + (pageQuery ? `?${pageQuery}` : '')}
-              url={`/my/transactions?${toQuery(_.omit(query, ['page']))}`}
+              url={`${router.pathname}?${toQuery(_.omit(query, ['page']))}`}
               className='mt-2 mb-2'
             />
           </div>
-- 
cgit v1.2.3

