more
This commit is contained in:
11
src/App.js
11
src/App.js
@@ -12,7 +12,7 @@ import DocEditPage from "./Components/Document/DocEditPage";
|
|||||||
import Homepage from "./Components/Home/HomePage";
|
import Homepage from "./Components/Home/HomePage";
|
||||||
import Dashboard from "./Components/Dashboard/Dashboard";
|
import Dashboard from "./Components/Dashboard/Dashboard";
|
||||||
import OptoutPage from "./Components/OptoutPage";
|
import OptoutPage from "./Components/OptoutPage";
|
||||||
import Container from "react-bootstrap/Container";
|
import RequestEditPage from "./Components/Document/ReqEditPage";
|
||||||
import CaseListPage from "./Components/Case/CaseListPage";
|
import CaseListPage from "./Components/Case/CaseListPage";
|
||||||
import CaseDetailsPage from "./Components/Case/CaseDetailsPage";
|
import CaseDetailsPage from "./Components/Case/CaseDetailsPage";
|
||||||
import CaseTypePage from "./Components/Case/CaseTypePage";
|
import CaseTypePage from "./Components/Case/CaseTypePage";
|
||||||
@@ -144,6 +144,15 @@ function App() {
|
|||||||
</PrivateRoute>
|
</PrivateRoute>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
<Route
|
||||||
|
exact
|
||||||
|
path="/reqedit/:documentId/:documentType/:caseId"
|
||||||
|
element={
|
||||||
|
<PrivateRoute>
|
||||||
|
<RequestEditPage />
|
||||||
|
</PrivateRoute>
|
||||||
|
}
|
||||||
|
/>
|
||||||
</Routes>
|
</Routes>
|
||||||
</div>
|
</div>
|
||||||
<Footer />
|
<Footer />
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ const CaseDetailsPage = () => {
|
|||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [docsAllowed, setDocsAllowed] = useState(null);
|
const [docsAllowed, setDocsAllowed] = useState(null);
|
||||||
const [docsGenerated, setDocsGenerated] = useState(null);
|
const [docsGenerated, setDocsGenerated] = useState(null);
|
||||||
|
const [docTypeUploaded, setDocTypeUploaded] = useState();
|
||||||
const { appState } = useContext(AppContext);
|
const { appState } = useContext(AppContext);
|
||||||
const { group } = appState;
|
const { group } = appState;
|
||||||
const appUserId = group ? group.appUserId : null;
|
const appUserId = group ? group.appUserId : null;
|
||||||
@@ -39,6 +39,12 @@ const CaseDetailsPage = () => {
|
|||||||
navigate("/documents");
|
navigate("/documents");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleNavEdit = (documentId, reqType, caseId) => {
|
||||||
|
const documentType = reqType;
|
||||||
|
|
||||||
|
navigate(`/reqedit/${documentId}/${documentType}/${caseId}`);
|
||||||
|
};
|
||||||
|
|
||||||
const handleBack = () => {
|
const handleBack = () => {
|
||||||
navigate("/cases");
|
navigate("/cases");
|
||||||
};
|
};
|
||||||
@@ -102,10 +108,14 @@ const CaseDetailsPage = () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSuccess = () => {
|
const handleSuccess = (docType, docId) => {
|
||||||
updateUserAccountDocsGenerated();
|
updateUserAccountDocsGenerated();
|
||||||
setShowUploadModal(false);
|
setShowUploadModal(false);
|
||||||
setTimeout(handleNavigate, 40000);
|
if (docType === "interrogatories-out") {
|
||||||
|
setTimeout(handleNavEdit, 40000, docId, caseId);
|
||||||
|
} else {
|
||||||
|
setTimeout(handleNavigate, 40000);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const ButtonContent = () => {
|
const ButtonContent = () => {
|
||||||
|
|||||||
50
src/Components/Document/HeaderPicker.js
Normal file
50
src/Components/Document/HeaderPicker.js
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
import NewYorkCaption from "./captionHeaders/newYorkCaption.js";
|
||||||
|
import NewJerseyCaption from "./captionHeaders/newJerseyCaption.js";
|
||||||
|
import FloridaCaption from "./captionHeaders/floridaCaption.js";
|
||||||
|
import { docEditCopy } from "../../Constants/Copy/docEditCopy.js";
|
||||||
|
|
||||||
|
const headerPicker = (state, fetchedCase, onScrollClick) => {
|
||||||
|
const displayCopy =
|
||||||
|
state === "ny"
|
||||||
|
? docEditCopy.NewYork
|
||||||
|
: state === "nj"
|
||||||
|
? docEditCopy.NewJersey
|
||||||
|
: docEditCopy.NewYork;
|
||||||
|
|
||||||
|
switch (state) {
|
||||||
|
case "ny":
|
||||||
|
return (
|
||||||
|
<NewYorkCaption
|
||||||
|
displayCopy={displayCopy}
|
||||||
|
fetchedCase={fetchedCase}
|
||||||
|
onScrollClick={onScrollClick}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
case "nj":
|
||||||
|
return (
|
||||||
|
<NewJerseyCaption
|
||||||
|
displayCopy={displayCopy}
|
||||||
|
fetchedCase={fetchedCase}
|
||||||
|
onScrollClick={onScrollClick}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
case "fl":
|
||||||
|
return (
|
||||||
|
<FloridaCaption
|
||||||
|
displayCopy={displayCopy}
|
||||||
|
fetchedCase={fetchedCase}
|
||||||
|
onScrollClick={onScrollClick}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
return (
|
||||||
|
<NewYorkCaption
|
||||||
|
displayCopy={displayCopy}
|
||||||
|
fetchedCase={fetchedCase}
|
||||||
|
onScrollClick={onScrollClick}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default headerPicker;
|
||||||
100
src/Components/Document/ReqEditPage.js
Normal file
100
src/Components/Document/ReqEditPage.js
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
import { useState, useContext, useEffect } from "react";
|
||||||
|
import headerPicker from "./HeaderPicker";
|
||||||
|
import { useParams } from "react-router-dom";
|
||||||
|
import { Link, useNavigate } from "react-router-dom";
|
||||||
|
import { AppContext } from "../../Hooks/useContext/appContext";
|
||||||
|
import EditElement from "../../pageElements/EditElement";
|
||||||
|
import { db } from "../../firebase";
|
||||||
|
import {
|
||||||
|
collection,
|
||||||
|
updateDoc,
|
||||||
|
onSnapshot,
|
||||||
|
doc,
|
||||||
|
getDoc,
|
||||||
|
setDoc,
|
||||||
|
increment,
|
||||||
|
} from "firebase/firestore";
|
||||||
|
import "../../styles/doclist-page.scss";
|
||||||
|
|
||||||
|
const RequestEditPage = () => {
|
||||||
|
const { documentId, documentType, caseId } = useParams();
|
||||||
|
const { appState } = useContext(AppContext);
|
||||||
|
const { group } = appState;
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const [parsedRogs, setParsedRogs] = useState();
|
||||||
|
const [responses, setResponses] = useState([1]);
|
||||||
|
const [fetchedCase, setFetchedCase] = useState();
|
||||||
|
const [showInputEle, setShowInputEle] = useState(true);
|
||||||
|
const [document, setDocument] = useState(null);
|
||||||
|
const appUserId = group ? group.appUserId : null;
|
||||||
|
const [docId, setDocId] = useState(documentId);
|
||||||
|
const [saveDocumentId, setSaveDocumentId] = useState("");
|
||||||
|
const [showSaveModal, setShowSaveModal] = useState(false);
|
||||||
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
const [isReport, setIsReport] = useState(false);
|
||||||
|
const [issueText, setIssueText] = useState("");
|
||||||
|
const [showErrorModal, setShowErrorModal] = useState(false);
|
||||||
|
|
||||||
|
const state = group.state[0] ? group.state[0].code : "ny";
|
||||||
|
const lawFirm = group ? group?.firm : null;
|
||||||
|
const streetAdd = group ? group?.streetAddress : null;
|
||||||
|
const city = group ? group.city : null;
|
||||||
|
const usState = group.state[0] ? group.state[0].code : "ny";
|
||||||
|
const zipCode = group ? group.zipCode : null;
|
||||||
|
const telephone = group ? group.telephone : null;
|
||||||
|
|
||||||
|
const apiUrl =
|
||||||
|
process.env.NODE_ENV === "development"
|
||||||
|
? process.env.REACT_APP_API_DEV
|
||||||
|
: process.env.REACT_APP_API_PROD;
|
||||||
|
|
||||||
|
const headerString =
|
||||||
|
documentType === "interrogatories" ? (
|
||||||
|
"Response to Interrogatories"
|
||||||
|
) : documentType === "admissions" ? (
|
||||||
|
"Response to Request for Admissions"
|
||||||
|
) : documentType === "production" ? (
|
||||||
|
"Response to Request for Production"
|
||||||
|
) : documentType === "combined-numbered" ? (
|
||||||
|
"Response to Interrogatories and Request for Production"
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!appUserId || !docId) {
|
||||||
|
setDocument(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
getCase(caseId);
|
||||||
|
//getDocument();
|
||||||
|
} catch (err) {
|
||||||
|
console.log("Error:", err);
|
||||||
|
}
|
||||||
|
}, [appUserId, docId, caseId]);
|
||||||
|
|
||||||
|
async function getCase(parentCaseId) {
|
||||||
|
try {
|
||||||
|
const docRef = doc(db, "cases", `${parentCaseId}`);
|
||||||
|
const docSnap = await getDoc(docRef);
|
||||||
|
if (docSnap.exists()) {
|
||||||
|
const _case = docSnap.data();
|
||||||
|
_case.id = docSnap._key.path.segments[1];
|
||||||
|
setFetchedCase(_case);
|
||||||
|
} else {
|
||||||
|
console.log("DB item does not exist");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(`A system error has occurred: ${error}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div> {headerPicker()}</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default RequestEditPage;
|
||||||
@@ -39,7 +39,7 @@ const UploadModal = (props) => {
|
|||||||
const [docError, setShowDocError] = useState("");
|
const [docError, setShowDocError] = useState("");
|
||||||
const fileTypes = ["PDF"];
|
const fileTypes = ["PDF"];
|
||||||
const fileName = fileToParse ? fileToParse.name : undefined;
|
const fileName = fileToParse ? fileToParse.name : undefined;
|
||||||
|
let docType;
|
||||||
const apiUrl =
|
const apiUrl =
|
||||||
process.env.NODE_ENV === "development"
|
process.env.NODE_ENV === "development"
|
||||||
? process.env.REACT_APP_API_DEV
|
? process.env.REACT_APP_API_DEV
|
||||||
@@ -75,7 +75,7 @@ const UploadModal = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (radioValue === "complaint") {
|
if (radioValue === "complaint") {
|
||||||
const docType = "requests-out";
|
docType = "interrogatories-out";
|
||||||
data["docType"] = docType;
|
data["docType"] = docType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,6 +100,7 @@ const UploadModal = (props) => {
|
|||||||
body: file,
|
body: file,
|
||||||
});
|
});
|
||||||
const res = response;
|
const res = response;
|
||||||
|
console.log("-------------------------------->res in uploadFile", res);
|
||||||
return res;
|
return res;
|
||||||
} else {
|
} else {
|
||||||
const response = await fetch(`${apiUrl}/parseNewDoc`, {
|
const response = await fetch(`${apiUrl}/parseNewDoc`, {
|
||||||
@@ -158,18 +159,13 @@ const UploadModal = (props) => {
|
|||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
try {
|
try {
|
||||||
const response = await processFile();
|
const response = await processFile();
|
||||||
console.log("~~~~~~~~~~~~~~~~~~~~~response", response);
|
|
||||||
if (response.res?.status !== 200) {
|
saveToDb(response.uuidName);
|
||||||
saveToDb(response.uuidName);
|
handleSuccess(docType, response.uuidName);
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
saveToDb(response.uuidName);
|
|
||||||
}
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("err", err);
|
console.log("err", err);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSuccess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleUploadCancel = () => {
|
const handleUploadCancel = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user