Skip to content

🔥 The free & Open Source DocuSign alternative

fix: pagination issue

prafull-opensignlabs6207e99cc0f6
diff --git a/apps/OpenSign/src/constant/Utils.js b/apps/OpenSign/src/constant/Utils.js
index 4ec3c35d0..54b96e993 100644
--- a/apps/OpenSign/src/constant/Utils.js
+++ b/apps/OpenSign/src/constant/Utils.js
@@ -100,17 +100,19 @@ export async function fetchSubscriptionInfo() {
const planId =
tenatRes.data?.result?.result?.SubscriptionDetails?.data?.subscription
?.subscription_id;
- const plan_code =
- tenatRes.data?.result?.result?.SubscriptionDetails?.data?.subscription
- ?.plan?.plan_code;
+ const plan_code = tenatRes.data?.result?.result?.PlanCode;
const totalAllowedUser = tenatRes.data?.result?.result?.AllowedUsers || 0;
+ const adminId =
+ tenatRes?.data?.result?.result?.ExtUserPtr?.objectId || "";
+
return {
status: "success",
price: price,
totalPrice: totalPrice,
planId: planId,
plan_code: plan_code,
- totalAllowedUser: totalAllowedUser
+ totalAllowedUser: totalAllowedUser,
+ adminId: adminId
};
}
} catch (err) {
diff --git a/apps/OpenSign/src/pages/TeamList.js b/apps/OpenSign/src/pages/TeamList.js
index 4919aaaba..1e8092983 100644
--- a/apps/OpenSign/src/pages/TeamList.js
+++ b/apps/OpenSign/src/pages/TeamList.js
@@ -135,7 +135,7 @@ const TeamList = () => {
const handleFormModal = () => {
setIsModal(!isModal);
};
- // Get current list
+ // to slice out 10 objects from array for current page
const indexOfLastDoc = currentPage * recordperPage;
const indexOfFirstDoc = indexOfLastDoc - recordperPage;
const currentList = teamList?.slice(indexOfFirstDoc, indexOfLastDoc);
@@ -147,7 +147,8 @@ const TeamList = () => {
// Change page
const paginateFront = () => {
- if (currentPage < Math.max(...pageNumbers)) {
+ const lastValue = pageNumbers?.[pageNumbers?.length - 1];
+ if (currentPage < lastValue) {
setCurrentPage(currentPage + 1);
}
};
diff --git a/apps/OpenSign/src/pages/UserList.js b/apps/OpenSign/src/pages/UserList.js
index 3c0513324..1359e0261 100644
--- a/apps/OpenSign/src/pages/UserList.js
+++ b/apps/OpenSign/src/pages/UserList.js
@@ -85,6 +85,10 @@ const UserList = () => {
return pages;
};
const pageNumbers = getPaginationRange();
+ // to slice out 10 objects from array for current page
+ const indexOfLastDoc = currentPage * recordperPage;
+ const indexOfFirstDoc = indexOfLastDoc - recordperPage;
+ const currentList = userList?.slice(indexOfFirstDoc, indexOfLastDoc);
useEffect(() => {
fetchUserList();
// eslint-disable-next-line react-hooks/exhaustive-deps
@@ -129,7 +133,8 @@ const UserList = () => {
// Change page
const paginateFront = () => {
- if (currentPage < Math.max(...pageNumbers)) {
+ const lastValue = pageNumbers?.[pageNumbers?.length - 1];
+ if (currentPage < lastValue) {
setCurrentPage(currentPage + 1);
}
};
@@ -237,7 +242,7 @@ const UserList = () => {
<tbody className="text-[12px]">
{userList?.length > 0 && (
<>
- {userList.map((item, index) => (
+ {currentList.map((item, index) => (
<tr className="border-y-[1px]" key={index}>
{heading.includes("Sr.No") && (
<th className="px-4 py-2">
diff --git a/apps/OpenSign/src/primitives/GetReportDisplay.js b/apps/OpenSign/src/primitives/GetReportDisplay.js
index ad182d9df..c36fc1733 100644
--- a/apps/OpenSign/src/primitives/GetReportDisplay.js
+++ b/apps/OpenSign/src/primitives/GetReportDisplay.js
@@ -373,7 +373,8 @@ const ReportTable = (props) => {
// Change page
const paginateFront = () => {
- if (currentPage < Math.max(...pageNumbers)) {
+ const lastValue = pageNumbers?.[pageNumbers?.length - 1];
+ if (currentPage < lastValue) {
setCurrentPage(currentPage + 1);
}
};