Min
diff --git a/src/Components/Login/Login.js b/src/Components/Login/Login.js
index 7a061e1..dc92567 100644
--- a/src/Components/Login/Login.js
+++ b/src/Components/Login/Login.js
@@ -20,12 +20,14 @@ const Login = () => {
}
setIsBusy(true);
setNotice("");
+
try {
const userCredential = await signInWithEmailAndPassword(
auth,
email,
password
);
+
// Signed in
userCredential?.user && navigate("/dashboard");
} catch (error) {
diff --git a/src/Components/Modals/UploadModal.js b/src/Components/Modals/UploadModal.js
index 1f1fa10..9c0e968 100644
--- a/src/Components/Modals/UploadModal.js
+++ b/src/Components/Modals/UploadModal.js
@@ -6,11 +6,13 @@ import Button from "../../pageElements/Button";
import Form from "react-bootstrap/Form";
import Row from "react-bootstrap/Row";
import Col from "react-bootstrap/Col";
+import Radiogroup from "../../pageElements/Radiogroup";
import { useNavigate } from "react-router-dom";
import { collection, setDoc, doc } from "firebase/firestore";
import { db } from "../../firebase";
import { v4 as uuidv4 } from "uuid";
import TextInput from "../../pageElements/TextInput";
+import { ExclamationTriangle } from "react-bootstrap-icons";
import Radio from "../../pageElements/Radio";
import "../../styles/modals.scss";
@@ -30,6 +32,8 @@ const UploadModal = (props) => {
const [fileToUpload, setFileToUpload] = useState();
const [fileToParse, setFileToParse] = useState("");
const [fileChanged, setFileChanged] = useState();
+ const [radioValue, setRadioValue] = useState(null);
+ const [radioValueError, setRadioValueError] = useState("");
const [showFileDetails, setShowFileDetails] = useState("");
const [titleError, setShowTitleError] = useState("");
const [docError, setShowDocError] = useState("");
@@ -41,6 +45,19 @@ const UploadModal = (props) => {
? process.env.REACT_APP_API_DEV
: process.env.REACT_APP_API_PROD;
+ const radioOptions = [
+ {
+ name: "Discovery request",
+ label: "Discovery request",
+ value: "discovery-request",
+ },
+ { name: "Complaint", label: "Complaint", value: "complaint" },
+ ];
+
+ const handleSetRadioValue = (e) => {
+ setRadioValue(e.value);
+ };
+
async function saveToDb(uuidName) {
const createdAt = new Date();
const data = {
@@ -72,12 +89,21 @@ const UploadModal = (props) => {
async function uploadFile(file) {
try {
- const response = await fetch(`${apiUrl}/parseNewDoc`, {
- method: "POST",
- body: file,
- });
- const res = response;
- return res;
+ if (radioValue === "complaint") {
+ const response = await fetch(`${apiUrl}/v1/gen-disc-request`, {
+ method: "POST",
+ body: file,
+ });
+ const res = response;
+ return res;
+ } else {
+ const response = await fetch(`${apiUrl}/parseNewDoc`, {
+ method: "POST",
+ body: file,
+ });
+ const res = response;
+ return res;
+ }
} catch (error) {
console.error("Error:", error);
}
@@ -112,9 +138,10 @@ const UploadModal = (props) => {
}
async function handleUpload() {
- if (!docTitle && !fileToParse) {
+ if (!docTitle && !fileToParse && !radioValue) {
setShowDocError("Please select a document to upload.");
setShowTitleError("Please enter a document title");
+ setRadioValueError("Please select document type");
return;
} else if (!docTitle) {
setShowTitleError("Please enter a document title");
@@ -173,17 +200,37 @@ const UploadModal = (props) => {
- Select a document in pdf format for upload. Enter the document title
- below. Document description is optional.
+ Select a .pdf file for upload, then 1. enter title, and 2. choose
+ document type (other fields optional).
- This document will be associated with {caption} v. {captionTwo}
+ The document created will be associated with{" "}
+
+ {caption} v. {captionTwo}
+
{caseNumber ? `, ${caseNumber}` : ""}.
- If that is not the case you want to associate with this document,
- click "cancel", go back and select the intended case from your
- active case list.
+ If that is not the correct case: 1. click cancel 2. click back, then
+ 3. select correct case from active cases.
+
+
+
+
+ NOTE: Selecting incorrect document type may result in errors.
+
+ Clicking upload begins document creation.
+
+
+
+
+ Document credit will be debited from account.