more
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { useContext, useEffect, useState } from "react";
|
import { useContext, useEffect, useState, useRef } from "react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { AppContext } from "../../Hooks/useContext/appContext";
|
import { AppContext } from "../../Hooks/useContext/appContext";
|
||||||
import SelectDropdown from "../../pageElements/SelectDropdown";
|
import SelectDropdown from "../../pageElements/SelectDropdown";
|
||||||
@@ -21,6 +21,7 @@ import "../../styles/doclist-page.scss";
|
|||||||
const DocumentListPage = ({ perPage }) => {
|
const DocumentListPage = ({ perPage }) => {
|
||||||
const size = window.innerWidth < 440;
|
const size = window.innerWidth < 440;
|
||||||
const [isMobile, setIsMobile] = useState(size);
|
const [isMobile, setIsMobile] = useState(size);
|
||||||
|
const count = useRef(null);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
||||||
const [selectedDocumentId, setSelectedDocumentId] = useState(null);
|
const [selectedDocumentId, setSelectedDocumentId] = useState(null);
|
||||||
@@ -36,6 +37,18 @@ const DocumentListPage = ({ perPage }) => {
|
|||||||
const [selectedDocumentType, setSelectedDocumentType] = useState();
|
const [selectedDocumentType, setSelectedDocumentType] = useState();
|
||||||
const [showModal, setShowModal] = useState(false);
|
const [showModal, setShowModal] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (count.current == null) {
|
||||||
|
setIsMobile(window.innerWidth < 440);
|
||||||
|
}
|
||||||
|
if (count.current < 3) {
|
||||||
|
setIsMobile(window.innerWidth < 440);
|
||||||
|
}
|
||||||
|
return () => {
|
||||||
|
count.current = 1;
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
function getDocuments() {
|
function getDocuments() {
|
||||||
if (!appUserId) {
|
if (!appUserId) {
|
||||||
setAllDocs([]);
|
setAllDocs([]);
|
||||||
@@ -121,17 +134,6 @@ const DocumentListPage = ({ perPage }) => {
|
|||||||
{ label: "Associated case name z - a", value: "parentCaseName2" },
|
{ label: "Associated case name z - a", value: "parentCaseName2" },
|
||||||
];
|
];
|
||||||
|
|
||||||
async function openDoc(docId) {
|
|
||||||
/*
|
|
||||||
may deprecate this functionality
|
|
||||||
try {
|
|
||||||
window.open(`${baseUrl}/Backend/Documents/Uploads/${docId}`, "_blank");
|
|
||||||
} catch (err) {
|
|
||||||
console.log("Error occurred fetching document:", err);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleNavigate(
|
function handleNavigate(
|
||||||
documentId,
|
documentId,
|
||||||
responseGenerations,
|
responseGenerations,
|
||||||
@@ -203,7 +205,6 @@ const DocumentListPage = ({ perPage }) => {
|
|||||||
docType={doc.docType}
|
docType={doc.docType}
|
||||||
documentId={doc.documentId}
|
documentId={doc.documentId}
|
||||||
dateServed={doc.dateServed}
|
dateServed={doc.dateServed}
|
||||||
openDocument={openDoc}
|
|
||||||
confirmDelete={confirmDelete}
|
confirmDelete={confirmDelete}
|
||||||
handleNavigate={handleNavigate}
|
handleNavigate={handleNavigate}
|
||||||
displayDeleteButton={true}
|
displayDeleteButton={true}
|
||||||
@@ -266,7 +267,6 @@ const DocumentListPage = ({ perPage }) => {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
return isMobile ? <MobileContent /> : <DesktopContent />;
|
return isMobile ? <MobileContent /> : <DesktopContent />;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -271,7 +271,6 @@ export const DocCard = (props) => {
|
|||||||
parentCaseId,
|
parentCaseId,
|
||||||
documentId,
|
documentId,
|
||||||
dateServed,
|
dateServed,
|
||||||
openDocument,
|
|
||||||
docType,
|
docType,
|
||||||
displayDeleteButton,
|
displayDeleteButton,
|
||||||
handleNavigate,
|
handleNavigate,
|
||||||
@@ -283,11 +282,7 @@ export const DocCard = (props) => {
|
|||||||
<div className="doc-card-container">
|
<div className="doc-card-container">
|
||||||
<div className="doc-card-input">
|
<div className="doc-card-input">
|
||||||
<div className="card-col-icon">
|
<div className="card-col-icon">
|
||||||
<FileEarmarkText
|
<FileEarmarkText className="doc-file-icon" size="22px" />
|
||||||
className="doc-file-icon"
|
|
||||||
onClick={() => openDocument(documentId)}
|
|
||||||
size="22px"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="doc-col2">{title}</div>
|
<div className="doc-col2">{title}</div>
|
||||||
{dateServed ? (
|
{dateServed ? (
|
||||||
|
|||||||
Reference in New Issue
Block a user