more
This commit is contained in:
@@ -6,13 +6,16 @@ import { Link, useNavigate } from "react-router-dom";
|
||||
import EditElement from "../../pageElements/EditElement";
|
||||
import { db } from "../../firebase";
|
||||
import {
|
||||
collection,
|
||||
updateDoc,
|
||||
onSnapshot,
|
||||
doc,
|
||||
getDoc,
|
||||
setDoc,
|
||||
increment,
|
||||
} from "firebase/firestore";
|
||||
import { AppContext } from "../../Hooks/useContext/appContext";
|
||||
|
||||
import Button from "../../pageElements/Button";
|
||||
import ConfirmModal from "../Modals/ConfirmModal";
|
||||
import LoadingSpinner from "../../pageElements/LoadingSpinner";
|
||||
@@ -36,6 +39,7 @@ const DocEditPage = () => {
|
||||
const [showSaveModal, setShowSaveModal] = useState(false);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [isReport, setIsReport] = useState(false);
|
||||
const [issueText, setIssueText] = useState("");
|
||||
const [responsesCreated, setResponsesCreated] = useState(
|
||||
parseInt(responseGenerations)
|
||||
);
|
||||
@@ -511,10 +515,28 @@ const DocEditPage = () => {
|
||||
setShowSaveModal(true);
|
||||
};
|
||||
|
||||
const handleReport = () => {};
|
||||
|
||||
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 bottom = window.document.scrollingElement.scrollHeight;
|
||||
const place = window.scrollY;
|
||||
@@ -548,7 +570,7 @@ const DocEditPage = () => {
|
||||
fetchedCase?.clientPosition == "Defendant"
|
||||
? fetchedCase?.plaintiffParties
|
||||
: fetchedCase?.defendantParties;
|
||||
console.log("parsedRogs", parsedRogs);
|
||||
|
||||
const editingContent = () => {
|
||||
return (
|
||||
<>
|
||||
@@ -625,7 +647,7 @@ const DocEditPage = () => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{showSaveModal && documentId !== null ? (
|
||||
{showSaveModal && !isReport && documentId !== null ? (
|
||||
<ConfirmModal
|
||||
onCancel={handleCancelSave}
|
||||
onConfirm={handleSave}
|
||||
@@ -637,11 +659,17 @@ const DocEditPage = () => {
|
||||
) : null}
|
||||
{showSaveModal && isReport && documentId !== null ? (
|
||||
<ConfirmModal
|
||||
isReport={isReport}
|
||||
onCancel={handleCancelSave}
|
||||
onConfirm={handleSave}
|
||||
buttonLabelText="Confirm Save"
|
||||
onConfirm={handleReport}
|
||||
buttonLabelText="Report Issue"
|
||||
documentId={documentId}
|
||||
caseId={caseId}
|
||||
appUserId={appUserId}
|
||||
issuetext={issueText}
|
||||
setIssueText={setIssueText}
|
||||
modalText={
|
||||
"Are you sure? This will overrwrite any previously-saved edits."
|
||||
"Please describe the issue. Other pertinent information will be automatically logged."
|
||||
}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
Reference in New Issue
Block a user