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