fix: pagination issue

This commit is contained in:
prafull-opensignlabs
2024-09-10 16:41:08 +05:30
parent a43d95afc3
commit df91363ff4
3 changed files with 35 additions and 54 deletions
+12 -2
View File
@@ -146,8 +146,18 @@ const TeamList = () => {
};
// Change page
const paginateFront = () => setCurrentPage(currentPage + 1);
const paginateBack = () => setCurrentPage(currentPage - 1);
const paginateFront = () => {
if (currentPage < Math.max(...pageNumbers)) {
setCurrentPage(currentPage + 1);
}
};
const paginateBack = () => {
if (startIndex > 0) {
setCurrentPage(currentPage - 1);
}
};
const handleActionBtn = (act, item) => {
if (act.action === "edit") {
setIsEditModal({ [item.objectId]: true });
+12 -50
View File
@@ -128,13 +128,18 @@ const UserList = () => {
};
// Change page
const paginateFront = () => setCurrentPage(currentPage + 1);
const paginateBack = () => setCurrentPage(currentPage - 1);
// const handleActionBtn = (act, item) => {
// if (act.action === "delete") {
// setIsDeleteModal({ [item.objectId]: true });
// }
// };
const paginateFront = () => {
if (currentPage < Math.max(...pageNumbers)) {
setCurrentPage(currentPage + 1);
}
};
const paginateBack = () => {
if (startIndex > 0) {
setCurrentPage(currentPage - 1);
}
};
const handleUserData = (userData) => {
setUserList((prev) => [userData, ...prev]);
};
@@ -296,49 +301,6 @@ const UserList = () => {
)}
</td>
)}
{/* <td className="px-3 py-2 text-white grid grid-cols-2">
{actions?.length > 0 &&
actions.map((act, index) => (
<button
key={index}
onClick={() => handleActionBtn(act, item)}
title={act.hoverLabel}
className={`${
act?.btnColor ? act.btnColor : ""
} op-btn op-btn-sm`}
>
<i className={act.btnIcon}></i>
</button>
))}
{isDeleteModal[item.objectId] && (
<ModalUi
isOpen
title={t("delete-user")}
handleClose={handleClose}
>
<div className="m-[20px]">
<div className="text-lg font-normal text-black">
{t( "are-you-sure")} {t("delete")} {t("this-user")}?
</div>
<hr className="bg-[#ccc] mt-4 " />
<div className="flex items-center mt-3 gap-2 text-white">
<button
onClick={() => handleDelete(item)}
className="op-btn op-btn-primary"
>
{t("yes")}
</button>
<button
onClick={handleClose}
className="op-btn op-btn-secondary"
>
{('no)}
</button>
</div>
</div>
</ModalUi>
)}
</td> */}
</tr>
))}
</>
@@ -372,8 +372,17 @@ const ReportTable = (props) => {
const currentList = props.List?.slice(indexOfFirstDoc, indexOfLastDoc);
// Change page
const paginateFront = () => setCurrentPage(currentPage + 1);
const paginateBack = () => setCurrentPage(currentPage - 1);
const paginateFront = () => {
if (currentPage < Math.max(...pageNumbers)) {
setCurrentPage(currentPage + 1);
}
};
const paginateBack = () => {
if (startIndex > 0) {
setCurrentPage(currentPage - 1);
}
};
const handleContactFormModal = () => {
setIsContactform(!isContactform);