@@ -20,7 +20,8 @@ const CaseDetailsPage = () => {
|
|||||||
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;
|
||||||
const message = "Parsing document. This may take several minutes.";
|
const message =
|
||||||
|
"Parsing document. Please be patient, this may take several minutes.";
|
||||||
|
|
||||||
const handleNavigate = () => {
|
const handleNavigate = () => {
|
||||||
navigate("/documents");
|
navigate("/documents");
|
||||||
|
|||||||
@@ -6,13 +6,16 @@ import { Link, useNavigate } from "react-router-dom";
|
|||||||
import EditElement from "../../pageElements/EditElement";
|
import EditElement from "../../pageElements/EditElement";
|
||||||
import { db } from "../../firebase";
|
import { db } from "../../firebase";
|
||||||
import {
|
import {
|
||||||
|
collection,
|
||||||
updateDoc,
|
updateDoc,
|
||||||
onSnapshot,
|
onSnapshot,
|
||||||
doc,
|
doc,
|
||||||
getDoc,
|
getDoc,
|
||||||
|
setDoc,
|
||||||
increment,
|
increment,
|
||||||
} from "firebase/firestore";
|
} from "firebase/firestore";
|
||||||
import { AppContext } from "../../Hooks/useContext/appContext";
|
import { AppContext } from "../../Hooks/useContext/appContext";
|
||||||
|
|
||||||
import Button from "../../pageElements/Button";
|
import Button from "../../pageElements/Button";
|
||||||
import ConfirmModal from "../Modals/ConfirmModal";
|
import ConfirmModal from "../Modals/ConfirmModal";
|
||||||
import LoadingSpinner from "../../pageElements/LoadingSpinner";
|
import LoadingSpinner from "../../pageElements/LoadingSpinner";
|
||||||
@@ -35,6 +38,8 @@ const DocEditPage = () => {
|
|||||||
const [saveDocumentId, setSaveDocumentId] = useState("");
|
const [saveDocumentId, setSaveDocumentId] = useState("");
|
||||||
const [showSaveModal, setShowSaveModal] = useState(false);
|
const [showSaveModal, setShowSaveModal] = useState(false);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
const [isReport, setIsReport] = useState(false);
|
||||||
|
const [issueText, setIssueText] = useState("");
|
||||||
const [responsesCreated, setResponsesCreated] = useState(
|
const [responsesCreated, setResponsesCreated] = useState(
|
||||||
parseInt(responseGenerations)
|
parseInt(responseGenerations)
|
||||||
);
|
);
|
||||||
@@ -107,7 +112,6 @@ const DocEditPage = () => {
|
|||||||
|
|
||||||
const messages = [
|
const messages = [
|
||||||
"Generating responses. Please be patient, this may take several minutes.",
|
"Generating responses. Please be patient, this may take several minutes.",
|
||||||
'Do not click "back" on your browser.',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -511,6 +515,31 @@ const DocEditPage = () => {
|
|||||||
setShowSaveModal(true);
|
setShowSaveModal(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleReport = () => {
|
||||||
|
setShowSaveModal(false);
|
||||||
|
setIsReport(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleConfirmReport = () => {
|
||||||
|
setShowSaveModal(true);
|
||||||
|
setIsReport(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
async function reportDoc() {
|
||||||
|
const data = {
|
||||||
|
documentId: documentId,
|
||||||
|
caseId: caseId,
|
||||||
|
appUserId: appUserId,
|
||||||
|
issueDescription: issueText,
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
const reportRef = collection(db, "supportrequests");
|
||||||
|
await setDoc(doc(reportRef, documentId), data);
|
||||||
|
} catch (err) {
|
||||||
|
console.log("Error saving case to db:", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const onScrollClick = () => {
|
const onScrollClick = () => {
|
||||||
const bottom = window.document.scrollingElement.scrollHeight;
|
const bottom = window.document.scrollingElement.scrollHeight;
|
||||||
const place = window.scrollY;
|
const place = window.scrollY;
|
||||||
@@ -544,7 +573,7 @@ const DocEditPage = () => {
|
|||||||
fetchedCase?.clientPosition == "Defendant"
|
fetchedCase?.clientPosition == "Defendant"
|
||||||
? fetchedCase?.plaintiffParties
|
? fetchedCase?.plaintiffParties
|
||||||
: fetchedCase?.defendantParties;
|
: fetchedCase?.defendantParties;
|
||||||
console.log("parsedRogs", parsedRogs);
|
|
||||||
const editingContent = () => {
|
const editingContent = () => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -587,6 +616,12 @@ const DocEditPage = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
<div
|
||||||
|
className="docedit-report-container"
|
||||||
|
onClick={() => handleConfirmReport()}
|
||||||
|
>
|
||||||
|
<div className="docedit-report-link">Report an issue</div>
|
||||||
|
</div>
|
||||||
<div className="doc-editing-button-container">
|
<div className="doc-editing-button-container">
|
||||||
<div className="generate-button-box">
|
<div className="generate-button-box">
|
||||||
{/* TODO: add tooltip: "This will save the document and create a .docx file that will (be downloaded? saved somewhere?" */}
|
{/* TODO: add tooltip: "This will save the document and create a .docx file that will (be downloaded? saved somewhere?" */}
|
||||||
@@ -615,7 +650,7 @@ const DocEditPage = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{showSaveModal && documentId !== null ? (
|
{showSaveModal && !isReport && documentId !== null ? (
|
||||||
<ConfirmModal
|
<ConfirmModal
|
||||||
onCancel={handleCancelSave}
|
onCancel={handleCancelSave}
|
||||||
onConfirm={handleSave}
|
onConfirm={handleSave}
|
||||||
@@ -625,6 +660,22 @@ const DocEditPage = () => {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
|
{showSaveModal && isReport && documentId !== null ? (
|
||||||
|
<ConfirmModal
|
||||||
|
isReport={isReport}
|
||||||
|
onCancel={handleCancelSave}
|
||||||
|
onConfirm={handleReport}
|
||||||
|
buttonLabelText="Report Issue"
|
||||||
|
documentId={documentId}
|
||||||
|
caseId={caseId}
|
||||||
|
appUserId={appUserId}
|
||||||
|
issuetext={issueText}
|
||||||
|
setIssueText={setIssueText}
|
||||||
|
modalText={
|
||||||
|
"Date/time and document id automatically logged. Support will address this within 24 hours."
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,19 +1,51 @@
|
|||||||
|
import { useState } from "react";
|
||||||
import Button from "../../pageElements/Button";
|
import Button from "../../pageElements/Button";
|
||||||
import Modal from "react-bootstrap/Modal";
|
import Modal from "react-bootstrap/Modal";
|
||||||
|
import TextInput from "../../pageElements/TextInput";
|
||||||
|
|
||||||
|
import { db } from "../../firebase";
|
||||||
const ConfirmModal = ({
|
const ConfirmModal = ({
|
||||||
onCancel,
|
onCancel,
|
||||||
onConfirm,
|
onConfirm,
|
||||||
buttonLabelText,
|
buttonLabelText,
|
||||||
modalText,
|
modalText,
|
||||||
isBusy,
|
isBusy,
|
||||||
|
isReport,
|
||||||
|
appUserId,
|
||||||
|
caseId,
|
||||||
|
documentId,
|
||||||
|
issueText,
|
||||||
|
setIssueText,
|
||||||
|
reportDoc,
|
||||||
}) => {
|
}) => {
|
||||||
|
console.log("isReport", isReport);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal show="true" onHide={onCancel} size="lg">
|
<Modal show="true" onHide={onCancel} size="lg">
|
||||||
<Modal.Header closeButton>
|
<Modal.Header closeButton>
|
||||||
|
{isReport ? (
|
||||||
|
<Modal.Title>Report an issue</Modal.Title>
|
||||||
|
) : (
|
||||||
<Modal.Title>Confirmation</Modal.Title>
|
<Modal.Title>Confirmation</Modal.Title>
|
||||||
|
)}
|
||||||
</Modal.Header>
|
</Modal.Header>
|
||||||
<Modal.Body>{modalText}</Modal.Body>
|
<Modal.Body>
|
||||||
|
<span>{modalText}</span>
|
||||||
|
{isReport ? (
|
||||||
|
<div style={{ marginTop: "16px" }}>
|
||||||
|
<TextInput
|
||||||
|
key={"captionTwo"}
|
||||||
|
name={"captionTwo"}
|
||||||
|
value={issueText}
|
||||||
|
message={"data.captionTwo.message"}
|
||||||
|
onChange={(e) => setIssueText(e.target.value)}
|
||||||
|
label={issueText ? "" : "Description of issue"}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
|
</Modal.Body>
|
||||||
<Modal.Footer>
|
<Modal.Footer>
|
||||||
<Button
|
<Button
|
||||||
disabled={isBusy}
|
disabled={isBusy}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
margin-top: 1rem;
|
margin-top: 0.6rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.edit-back-button {
|
.edit-back-button {
|
||||||
@@ -359,6 +359,16 @@
|
|||||||
margin-top: 50px;
|
margin-top: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.docedit-report-link {
|
||||||
|
font-size: 0.95rem;
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docedit-report-link:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
@media only screen and (max-width: 1140px) {
|
@media only screen and (max-width: 1140px) {
|
||||||
.scroll-button {
|
.scroll-button {
|
||||||
right: 30px;
|
right: 30px;
|
||||||
|
|||||||
Reference in New Issue
Block a user