diff --git a/src/Components/Document/ReqEditPage.js b/src/Components/Document/ReqEditPage.js index 544e40a..e458ad5 100644 --- a/src/Components/Document/ReqEditPage.js +++ b/src/Components/Document/ReqEditPage.js @@ -240,29 +240,68 @@ const RequestEditPage = () => { } } - async function handleCreateDocx() { - const res = await postEditedResponses(); - function sleep(ms) { - return new Promise((resolve) => setTimeout(resolve, ms)); - } - await sleep(2000); + async function handleCreateDocx(docType) { + // TODO: compare to see if any changes made before gen, save those + const docId = documentId; + const leadAttorneys = fetchedCase?.leadAttorneys + ? fetchedCase?.leadAttorneys + : null; + const reqType = docType; + const captionOne = fetchedCase?.caption; + const captionTwo = fetchedCase?.captionTwo; + const caseNum = fetchedCase?.caseNumber; + const plaintiffs = fetchedCase?.plaintiffParties; + const defendants = fetchedCase?.defendantParties; + const venued = fetchedCase?.venue; + const juris = fetchedCase?.jurisdiction; + const judge = fetchedCase?.judge; + const clientPosition = fetchedCase?.clientPosition + ? fetchedCase?.clientPosition + : null; + const currentRequestType = docType; try { - const response = await fetch( - `${apiUrl}/v1/generate-request-docx/${docId}`, - { - method: "POST", - headers: { - Accept: "application/json", - "Content-Type": "application/json", - }, - body: JSON.stringify({ - docId: docId, - }), - } - ); - return response; - } catch (error) { - console.error("Error sending requests to the server:", error); + const response = await fetch(`${apiUrl}/v1/store-docx-data/${docId}`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + caseCaption1: captionOne, + caseCaption2: captionTwo, + caseNumber: caseNum, + clientPosition: clientPosition, + currentRequestType: currentRequestType, + defendant: defendants, + firm: lawFirm, + firmCity: city, + firmState: usState.code, + firmStreetAddress: streetAdd, + firmZip: zipCode, + judge: judge, + jurisdiction: juris, + leadAttorneys: leadAttorneys, + plaintiff: plaintiffs, + state: state, + tel: telephone, + venue: venued, + }), + }); + if (response.status === 200) { + const resp = await fetch( + `${apiUrl}/v1/generate-request-docx/${docId}`, + { + method: "POST", + headers: { + Accept: "application/json", + "Content-Type": "application/json", + }, + } + ); + + return resp; + } + } catch (err) { + console.log("err in postDocxData", err); } } @@ -537,3 +576,32 @@ const RequestEditPage = () => { }; export default RequestEditPage; + +/* + + async function handleCreateDocx() { + const res = await postEditedResponses(); + function sleep(ms) { + return new Promise((resolve) => setTimeout(resolve, ms)); + } + await sleep(2000); + try { + const response = await fetch( + `${apiUrl}/v1/generate-request-docx/${docId}`, + { + method: "POST", + headers: { + Accept: "application/json", + "Content-Type": "application/json", + }, + body: JSON.stringify({ + docId: docId, + }), + } + ); + return response; + } catch (error) { + console.error("Error sending requests to the server:", error); + } + } + */ diff --git a/src/styles/docedit-page.scss b/src/styles/docedit-page.scss index f3f681f..3ea26ee 100644 --- a/src/styles/docedit-page.scss +++ b/src/styles/docedit-page.scss @@ -30,19 +30,13 @@ display: flex; flex-direction: column; justify-content: center; - margin-left: auto; - margin-right: auto; + margin-bottom: 25px; } .req-editing-sub-wrapper { display: flex; flex-direction: column; - justify-content: center; - margin-left: auto; - margin-right: auto; - margin-bottom: 25px; - min-width: 700px; } .doc-editing-instructions-header { @@ -69,7 +63,7 @@ } .req-item-inner-div { - min-width: 700px; + min-width: 720px; } .doc-editing-button-container { @@ -334,10 +328,7 @@ .request-text-up { color: #a2a2a2; - margin-top: 6px; - margin-bottom: 12px; - line-height: 2; - padding: 0px 5px; + margin-top: 5px; text-align: justify; &.reqq { max-width: 24px; @@ -385,6 +376,7 @@ text-align: justify; } .req-edit-comesnow-box { + min-width: 740px; margin-bottom: 18px; }