diff --git a/src/components/Documents/DocumentVersionList.jsx b/src/components/Documents/DocumentVersionList.jsx
index ddc6da92..87b4004e 100644
--- a/src/components/Documents/DocumentVersionList.jsx
+++ b/src/components/Documents/DocumentVersionList.jsx
@@ -88,9 +88,8 @@ const DocumentVersionList = ({
{sortedVersions.map((document, index) => (
0 ? "ms-4" : "" // indent only older versions
- }`}
+ className={`list-group-item list-group-item-action d-flex align-items-center cursor-pointer ${index > 0 ? "ms-4" : "" // indent only older versions
+ }`}
>
{" "}
- fileSize: {document.fileSize} Kb
+ File Size: {document.fileSize} Kb
@@ -124,13 +123,36 @@ const DocumentVersionList = ({
lastName={document.uploadedBy?.lastName}
/>
- {`${document.uploadedBy?.firstName ?? ""} ${
- document.uploadedBy?.lastName ?? ""
- }`.trim() || "N/A"}
+ {`${document.uploadedBy?.firstName ?? ""} ${document.uploadedBy?.lastName ?? ""
+ }`.trim() || "N/A"}
+
+ {document?.verifiedAt && (
+ <>
+ {formatUTCToLocalTime(document?.verifiedAt)} |{" "}
+ {document.isVerified
+ ? "Verified by "
+ : "Rejected by "}
+
+
+
+ {`${document.verifiedBy?.firstName ?? ""} ${document.verifiedBy?.lastName ?? ""
+ }`.trim() || "N/A"}
+
+
+ >
+ )}
+
+
+
{document?.updatedAt && (
{formatUTCToLocalTime(document?.updatedAt)} |
@@ -143,9 +165,8 @@ const DocumentVersionList = ({
lastName={document.updatedBy?.lastName}
/>
- {`${document.updatedBy?.firstName ?? ""} ${
- document.updatedBy?.lastName ?? ""
- }`.trim() || "N/A"}
+ {`${document.updatedBy?.firstName ?? ""} ${document.updatedBy?.lastName ?? ""
+ }`.trim() || "N/A"}
@@ -167,4 +188,4 @@ const DocumentVersionList = ({
);
};
-export default DocumentVersionList;
+export default DocumentVersionList;
\ No newline at end of file
diff --git a/src/components/Documents/ManageDocument.jsx b/src/components/Documents/ManageDocument.jsx
index cafdc1e2..30270a08 100644
--- a/src/components/Documents/ManageDocument.jsx
+++ b/src/components/Documents/ManageDocument.jsx
@@ -402,7 +402,15 @@ const ManageDocument = ({ closeModal, Document_Entity, Entity }) => {
{/* Buttons */}
-
+
+
-
diff --git a/src/components/Documents/ViewDocument.jsx b/src/components/Documents/ViewDocument.jsx
index 8a6f1cde..b4e401ce 100644
--- a/src/components/Documents/ViewDocument.jsx
+++ b/src/components/Documents/ViewDocument.jsx
@@ -14,28 +14,27 @@ import {
} from "../../utils/constants";
import Pagination from "../common/Pagination";
import VersionListSkeleton from "./VersionListSkeleton";
+// import DocumentDetailsSkeleton from "./DocumentDetailsSkeleton";
import DocumentDetailsSkeleton from "./DocumentDetailsSkeleton ";
import { useHasUserPermission } from "../../hooks/useHasUserPermission";
import DocumentVersionList from "./DocumentVersionList";
const ViewDocument = () => {
- const { viewDoc, setViewDoc, setOpenDocument } = useDocumentContext();
+ const { viewDoc, setOpenDocument } = useDocumentContext();
const [currentPage, setCurrentPage] = useState(1);
const canVerifyDocument = useHasUserPermission(VERIFY_DOCUMENT);
- const canDownloadDocument = useHasUserPermission(DOWNLOAD_DOCUMENT);
const { data, isLoading, isError, error } = useDocumentDetails(
viewDoc?.document
);
const {
data: versionList,
- isError: isVersionError,
isLoading: versionLoding,
- error: versionError,
} = useDocumentVersionList(
data?.parentAttachmentId,
ITEMS_PER_PAGE - 10,
currentPage
);
+
const paginate = (page) => {
if (page >= 1 && page <= (versionList?.totalPages ?? 1)) {
setCurrentPage(page);
@@ -58,168 +57,120 @@ const ViewDocument = () => {
{error?.response?.status}
);
+
return (
-
-
Document Details
+
+
Document Details
-
-
-
-
- Document Name:
-
- {data.name || "-"}
-
-
-
-
-
- Document ID:
-
- {data.documentId || "-"}
-
-
-
-
- {/* Row 2 */}
-
-
-
-
- Version:
-
- {data.version || "-"}
-
-
-
-
-
- Uploaded At:
-
-
- {formatUTCToLocalTime(data.uploadedAt)}
-
-
-
-
-
- {/* Row 3 */}
-
-
-
- Uploaded By:
-
-
-
-
- {`${data.uploadedBy?.firstName ?? ""} ${
- data.uploadedBy?.lastName ?? ""
- }`.trim() || "N/A"}
-
-
-
+
+
+ Category:
+
+
+ {data.documentType?.documentCategory?.name || "-"}
+
- {data.updatedAt && (
-
-
- Updated At:
-
-
- {formatUTCToLocalTime(data.updatedAt) || "-"}
-
-
- )}{" "}
-
-
-
- {/* Row 4 */}
-
-
-
-
- Category:
-
-
- {data.documentType?.documentCategory?.name || "-"}
-
-
-
-
-
-
- Type:
-
- {data.documentType?.name || "-"}
-
-
-
-
- {/* Row 5 - Tags full width */}
-
-
-
-
- Tags:
-
-
- {data.tags?.length > 0 ? (
- data.tags.map((t, i) => (
-
- {t.name}
-
- ))
- ) : (
- -
- )}
-
-
+
+
+ Type:
+
+ {data.documentType?.name || "-"}
-
-
-
- Description:
-
- {data.description || "-"}
-
+
+
+ Document Name:
+
+ {data.name || "-"}
+
+
+
+ Document ID:
+
+ {data.documentId || "-"}
- {data.isVerified === null && (
-
-
- {" "}
- {isPending ? (
- "Please Wait..."
+
+
+
+
+ Uploaded At:
+
+
+ {formatUTCToLocalTime(data.uploadedAt)}
+
+
+
+
+ Updated At:
+
+
+ {formatUTCToLocalTime(data.updatedAt) || "-"}
+
+
+
+
+
+
+
+ Tags:
+
+
+ {data.tags?.length > 0 ? (
+ data.tags.map((t, i) => (
+
+ {t.name}
+
+ ))
) : (
-
+
-
)}
+
+
+
+
+
+ Description:
+
+ {data.description || "-"}
+
+
+
+ {/* Verify / Reject */}
+ {data.isVerified === null && canVerifyDocument && (
+
+ {isPending ? (
+ Please Wait...
+ ) : (
+ <>
+
+
+ >
+ )}
+
)}
+
+
{
- if (e.key === "Enter" && input.trim()) {
+ if ((e.key === "Enter" || e.key === " ") && input.trim()) {
e.preventDefault();
handleAdd(input.trim());
setInput("");