diff --git a/src/Components/Case/CaseDetailsPage.js b/src/Components/Case/CaseDetailsPage.js index 344f3ad..2919093 100644 --- a/src/Components/Case/CaseDetailsPage.js +++ b/src/Components/Case/CaseDetailsPage.js @@ -43,7 +43,6 @@ const CaseDetailsPage = () => { //documentId, responseGenerations, caseId, documentType console.log("handle navigate fired docId", docId); let docType = "interrogatories"; - navigate(`/documents/${docId}/${docType}/${caseId}`); }; @@ -51,7 +50,9 @@ const CaseDetailsPage = () => { if (!documentId || !caseId) { return; } - + console.log( + "hit handleNavEdit----------------------------------------------------------" + ); navigate(`/reqedit/${documentId}/interrogatories-out/${caseId}`); }; @@ -144,11 +145,7 @@ const CaseDetailsPage = () => { ); if (docType === "complaint") { const clientPosition = subCase.clientPosition; - const res = await generateOutgoingDiscoveryRequests( - docId, - radioValue, - clientPosition - ); + generateOutgoingDiscoveryRequests(docId, radioValue, clientPosition); setTimeout(handleNavEdit, 20000, docId, caseId); } else { // try to kick off parsing here diff --git a/src/Components/Document/ReqEditPage.js b/src/Components/Document/ReqEditPage.js index 23d1617..d981bbb 100644 --- a/src/Components/Document/ReqEditPage.js +++ b/src/Components/Document/ReqEditPage.js @@ -9,7 +9,6 @@ import { docEditCopy, outgoingComesNow, } from "../../Constants/Copy/docEditCopy.js"; -import ConfirmModal from "../Modals/ConfirmModal"; import Button from "../../pageElements/Button"; import { rogInstructions, @@ -18,15 +17,7 @@ import { standardProd, } from "../../Constants/Copy/reqEditCopy.js"; import { db } from "../../firebase"; -import { - collection, - updateDoc, - onSnapshot, - doc, - getDoc, - setDoc, - increment, -} from "firebase/firestore"; +import { doc, getDoc } from "firebase/firestore"; import "../../styles/doclist-page.scss"; const RequestEditPage = () => { @@ -83,12 +74,14 @@ const RequestEditPage = () => { } getOutgoingRequests(documentId) .then((data) => { - const merged = [...foundationRogs, ...data[0].requests]; - const resp = merged.map((item, index) => { - // NEVER CHANGE THIS: - return { showInputEle: false, text: item.text, index: index }; - }); - setRequests(resp); + const resp = [...foundationRogs, ...data[0].requests].map( + (item, index) => { + // NEVER CHANGE THIS: + return { showInputEle: false, text: item.text, index: index }; + } + ); + const calld = [...resp]; + setRequests(calld); setProdReq(standardProd); }) .catch((err) => console.log(err)); @@ -111,6 +104,9 @@ const RequestEditPage = () => { } async function getOutgoingRequests(documentId) { + if (!documentId) { + return; + } const docType = String(documentType); const docId = String(documentId); const response = await fetch( @@ -178,8 +174,10 @@ const RequestEditPage = () => { }; async function postEditedResponses() { + if (!requests && requests.length > 1) { + return; + } const mergedRequests = [...requests, ...prodReq]; - const docId = documentId; const leadAttorneys = fetchedCase?.leadAttorneys ? fetchedCase?.leadAttorneys @@ -385,7 +383,7 @@ const RequestEditPage = () => { fetchedCase?.clientPosition === "Defendant" ? fetchedCase?.plaintiffParties : fetchedCase?.defendantParties; - console.log("state", state); + console.log("final requests", requests); const editingContent = () => { return ( <> @@ -418,29 +416,32 @@ const RequestEditPage = () => {
diff --git a/src/Constants/Copy/docEditCopy.js b/src/Constants/Copy/docEditCopy.js index ac52dee..e8b540e 100644 --- a/src/Constants/Copy/docEditCopy.js +++ b/src/Constants/Copy/docEditCopy.js @@ -59,33 +59,23 @@ export const docEditCopy = { export const outgoingComesNow = (state, fetchedCase) => { let copyString; - const position = fetchedCase ? fetchedCase?.clientPosition : <>>; - const parties = fetchedCase ? ( - fetchedCase?.clientPosition === "Plaintiff" ? ( - fetchedCase?.plaintiffParties - ) : ( - fetchedCase?.defendantParties - ) - ) : ( - <>> - ); - const adversary = fetchedCase ? ( - fetchedCase?.clientPosition === "Plaintiff" ? ( - fetchedCase?.defendantParties - ) : ( - fetchedCase?.plaintiffParties - ) - ) : ( - <>> - ); + + const servingParty = + fetchedCase?.clientPosition === "Plaintiff" + ? fetchedCase?.plaintiffParties + : fetchedCase?.defendantParties; + const respondingParty = + servingParty === fetchedCase?.plaintiffParties + ? fetchedCase?.defendantParties + : fetchedCase?.plaintiffParties; if (state === "ny") { - copyString = `COMES NOW, ${position}, ${parties}, through counsel, and hereby propounds these Interrogatories and Requests for Production on ${adversary}, to be answered under oath, in writing, in accordance with NY CPLR 3120 - 3130.`; + copyString = `COMES NOW, ${fetchedCase?.clientPosition}, ${servingParty}, through counsel, and hereby propounds these Interrogatories and Requests for Production on ${respondingParty}, to be answered under oath, in writing, in accordance with NY CPLR 3120 - 3130.`; } else if (state === "fl") { - copyString = `COMES NOW, ${position}, ${parties}, through counsel, and hereby propounds these Interrogatories and Requests for Production on ${adversary}, to be answered to be answered under oath, in writing, in accordance with Rule 1.340, Florida Rules of Civil Procedure.`; + copyString = `COMES NOW, ${fetchedCase?.clientPosition}, ${servingParty}, through counsel, and hereby propounds these Interrogatories and Requests for Production on ${respondingParty}, to be answered to be answered under oath, in writing, in accordance with Rule 1.340, Florida Rules of Civil Procedure.`; } else if (state === "nj") { copyString = - `Comes now ${position}, ${parties}, through counsel, and hereby propounds these Interrogatories and Requests for Production on ${adversary}, to be answered to be answered under oath, in writing, in accordance with NJ R. 4:17-1 - 4:18-1,` + + `Comes now ${fetchedCase?.clientPosition}, ${servingParty}, through counsel, and hereby propounds these Interrogatories and Requests for Production on ${respondingParty}, to be answered to be answered under oath, in writing, in accordance with NJ R. 4:17-1 - 4:18-1,` +