more
This commit is contained in:
@@ -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),
|
||||
});
|
||||
|
||||
@@ -8,7 +8,13 @@ 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";
|
||||
@@ -30,6 +36,8 @@ const UploadModal = (props) => {
|
||||
handleSuccess,
|
||||
setIsLoading,
|
||||
clientPositiion,
|
||||
handleConfirmDocType,
|
||||
fbUserId,
|
||||
} = props;
|
||||
const { caseId, caseNumber, jurisdiction, caption, captionTwo } = caseData;
|
||||
const [docTitle, setDocTitle] = useState("");
|
||||
@@ -65,6 +73,21 @@ const UploadModal = (props) => {
|
||||
setRadioValue(e.value);
|
||||
};
|
||||
|
||||
async function updateUserAccountDocsGenerated(fbUserId) {
|
||||
await updateDoc(doc(db, "users", fbUserId), {
|
||||
docsGenerated: increment(1),
|
||||
});
|
||||
}
|
||||
|
||||
async function updateRespGenerationCount(docId) {
|
||||
if (!docId) {
|
||||
return;
|
||||
}
|
||||
await updateDoc(doc(db, "documents", docId), {
|
||||
responseGenerations: increment(1),
|
||||
});
|
||||
}
|
||||
|
||||
async function saveToDb(uuidName) {
|
||||
const createdAt = new Date();
|
||||
const data = {
|
||||
@@ -84,6 +107,8 @@ const UploadModal = (props) => {
|
||||
if (radioValue === "complaint") {
|
||||
docType = "interrogatories-out";
|
||||
data["docType"] = docType;
|
||||
updateUserAccountDocsGenerated(fbUserId);
|
||||
updateRespGenerationCount(uuidName);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user