From ffebc1b10550e10de6cde9b4757dd0d5a4cf644c Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Thu, 4 May 2023 15:00:57 +0700
Subject: fix invoice pagination

---
 src/lib/invoice/components/Invoices.jsx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'src/lib/invoice/components/Invoices.jsx')

diff --git a/src/lib/invoice/components/Invoices.jsx b/src/lib/invoice/components/Invoices.jsx
index 8918fae4..96686bbb 100644
--- a/src/lib/invoice/components/Invoices.jsx
+++ b/src/lib/invoice/components/Invoices.jsx
@@ -24,7 +24,7 @@ const Invoices = () => {
   const router = useRouter()
   const { q = '', page = 1 } = router.query
 
-  const limit = 10
+  const limit = 15
 
   const query = {
     name: q,
@@ -36,7 +36,7 @@ const Invoices = () => {
   const [inputQuery, setInputQuery] = useState(q)
   const [toOthers, setToOthers] = useState(null)
 
-  const pageCount = Math.ceil(invoices?.data?.saleOrderTotal / limit)
+  const pageCount = Math.ceil(invoices?.data?.invoiceTotal / limit)
   let pageQuery = _.omit(query, ['limit', 'offset'])
   pageQuery = _.pickBy(pageQuery, _.identity)
   pageQuery = toQuery(pageQuery)
@@ -235,7 +235,7 @@ const Invoices = () => {
             <Pagination
               pageCount={pageCount}
               currentPage={parseInt(page)}
-              url={`/my/transactions${pageQuery}`}
+              url={`/my/invoices${pageQuery}`}
               className='mt-2 mb-2'
             />
           </div>
-- 
cgit v1.2.3

