@@ -98,6 +98,11 @@ const CaseDetailsPage = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const handleConfirmDocType = (docType) => {
|
||||
console.log("docType", docType);
|
||||
setShowConfirmModal(true);
|
||||
};
|
||||
|
||||
const handleCancelConfirm = () => {
|
||||
setShowConfirmModal(false);
|
||||
};
|
||||
@@ -108,14 +113,7 @@ const CaseDetailsPage = () => {
|
||||
navigate(`/signup/${isUpgrade}/${currentPlan}`);
|
||||
};
|
||||
|
||||
async function updateUserAccountDocsGenerated() {
|
||||
await updateDoc(doc(db, "users", fbUserId), {
|
||||
docsGenerated: increment(1),
|
||||
});
|
||||
}
|
||||
|
||||
const handleSuccess = (docType, docId) => {
|
||||
updateUserAccountDocsGenerated();
|
||||
setShowUploadModal(false);
|
||||
if (docType === "interrogatories-out") {
|
||||
setTimeout(handleNavEdit, 40000, docId, caseId);
|
||||
@@ -187,6 +185,8 @@ const CaseDetailsPage = () => {
|
||||
setIsLoading={setIsLoading}
|
||||
handleSuccess={handleSuccess}
|
||||
caseData={subCase}
|
||||
handleConfirmDocType={handleConfirmDocType}
|
||||
fbUserId={fbUserId}
|
||||
/>
|
||||
) : null
|
||||
) : null}
|
||||
|
||||
@@ -458,12 +458,9 @@ const DocEditPage = () => {
|
||||
}
|
||||
|
||||
async function updateRespGenerationCount(docId) {
|
||||
console.log("updaeeResponseGenerationCount fired");
|
||||
if (!docId) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("updaeeResponseGenerationCount past if block");
|
||||
await updateDoc(doc(db, "documents", docId), {
|
||||
responseGenerations: increment(1),
|
||||
});
|
||||
|
||||
@@ -7,13 +7,17 @@ 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 {
|
||||
collection,
|
||||
setDoc,
|
||||
doc,
|
||||
updateDoc,
|
||||
increment,
|
||||
} 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";
|
||||
|
||||
const MAX_LENGTH_TITLE = 27;
|
||||
@@ -30,6 +34,8 @@ const UploadModal = (props) => {
|
||||
handleSuccess,
|
||||
setIsLoading,
|
||||
clientPositiion,
|
||||
handleConfirmDocType,
|
||||
fbUserId,
|
||||
} = props;
|
||||
const { caseId, caseNumber, jurisdiction, caption, captionTwo } = caseData;
|
||||
const [docTitle, setDocTitle] = useState("");
|
||||
@@ -65,8 +71,20 @@ const UploadModal = (props) => {
|
||||
setRadioValue(e.value);
|
||||
};
|
||||
|
||||
async function updateUserAccountDocsGenerated(fbUserId) {
|
||||
await updateDoc(doc(db, "users", fbUserId), {
|
||||
docsGenerated: increment(1),
|
||||
});
|
||||
}
|
||||
|
||||
async function saveToDb(uuidName) {
|
||||
const createdAt = new Date();
|
||||
let respGenVal;
|
||||
if (radioValue === "complaint") {
|
||||
respGenVal = 1;
|
||||
} else {
|
||||
respGenVal = 0;
|
||||
}
|
||||
const data = {
|
||||
ownerId: appUserId,
|
||||
createdAt: createdAt,
|
||||
@@ -78,12 +96,13 @@ const UploadModal = (props) => {
|
||||
parentCaseName: `${caption} v. ${captionTwo}`,
|
||||
parentCaseNumber: caseNumber,
|
||||
parentCaseJurisdiction: jurisdiction,
|
||||
responseGenerations: 0,
|
||||
responseGenerations: respGenVal,
|
||||
};
|
||||
|
||||
if (radioValue === "complaint") {
|
||||
docType = "interrogatories-out";
|
||||
data["docType"] = docType;
|
||||
updateUserAccountDocsGenerated(fbUserId);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user