diff --git a/src/components/Documents/DocumentsList.jsx b/src/components/Documents/DocumentsList.jsx
index 69e7d0d1..3fe39a49 100644
--- a/src/components/Documents/DocumentsList.jsx
+++ b/src/components/Documents/DocumentsList.jsx
@@ -1,4 +1,4 @@
-import React, { useEffect } from "react";
+import React, { useEffect, useState } from "react";
import { useDocumentListByEntityId } from "../../hooks/useDocument";
import { ITEMS_PER_PAGE } from "../../utils/constants";
import Avatar from "../common/Avatar";
@@ -6,25 +6,10 @@ import { formatUTCToLocalTime } from "../../utils/dateUtils";
import Loader from "../common/Loader";
import { useDebounce } from "../../utils/appUtils";
import { DocumentTableSkeleton } from "./DocumentSkeleton";
-import { useDocumentContext } from "./Documents";
+import { getDocuementsStatus, useDocumentContext } from "./Documents";
+import Pagination from "../common/Pagination";
+
-export const getDocuementsStatus = (status) => {
- switch (status) {
- case true:
- return (
- Verified
- );
- case false:
- return (
- Rejected
- );
- case null:
- default:
- return (
- Pending
- );
- }
-};
const DocumentsList = ({
Document_Entity,
Entity,
@@ -34,12 +19,13 @@ const DocumentsList = ({
setRefetchFn,
}) => {
const debouncedSearch = useDebounce(searchText, 500);
+ const [currentPage,setCurrentPage] = useState(1)
const { data, isError, isLoading, error, refetch, isFetching } =
useDocumentListByEntityId(
Document_Entity,
Entity,
ITEMS_PER_PAGE,
- 1,
+ currentPage,
filters,
debouncedSearch
);
@@ -54,14 +40,18 @@ const DocumentsList = ({
setIsRefetching(isFetching);
}, [isFetching, setIsRefetching]);
- const {setManageDoc} = useDocumentContext()
+ const {setManageDoc,setViewDoc} = useDocumentContext()
// check no data scenarios
- const noData = !isLoading && !isError && data?.length === 0;
+ const noData = !isLoading && !isError && data?.data.length === 0;
const isSearchEmpty = noData && !!debouncedSearch;
const isFilterEmpty = noData && false;
const isInitialEmpty = noData && !debouncedSearch;
-
+ const paginate = (page) => {
+ if (page >= 1 && page <= (data?.totalPages ?? 1)) {
+ setCurrentPage(page);
+ }
+ };
if (isLoading || isFetching) return