This commit is contained in:
Kenneth Jannette
2024-03-14 04:08:11 -05:00
parent 140f02d47a
commit a9fea52796
2 changed files with 94 additions and 34 deletions

View File

@@ -240,14 +240,54 @@ 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(
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",
@@ -255,14 +295,13 @@ const RequestEditPage = () => {
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);
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);
}
}
*/

View File

@@ -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;
}