more
This commit is contained in:
@@ -126,6 +126,36 @@ const RequestEditPage = () => {
|
|||||||
return req;
|
return req;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getDocx() {
|
||||||
|
const docId = documentId;
|
||||||
|
const reqType = documentType;
|
||||||
|
fetch(`${apiUrl}/getDocx/${docId}/${reqType}`, {
|
||||||
|
method: "GET",
|
||||||
|
}).then((response) => {
|
||||||
|
response.blob().then((blob) => {
|
||||||
|
let url = window.URL.createObjectURL(blob);
|
||||||
|
let a = window.document.createElement("a");
|
||||||
|
a.href = url;
|
||||||
|
a.download = `${reqType}-repsonse.docx`;
|
||||||
|
a.click();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function cleanUpDocx() {
|
||||||
|
const docId = documentId;
|
||||||
|
const reqType = documentType;
|
||||||
|
fetch(`${apiUrl}/cleanUpDocx/${docId}/${reqType}`, {
|
||||||
|
method: "GET",
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
setIsBusy(false);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async function createAndReturnDocx() {
|
async function createAndReturnDocx() {
|
||||||
window.scrollTo({ top: 0 });
|
window.scrollTo({ top: 0 });
|
||||||
setIsBusy(true);
|
setIsBusy(true);
|
||||||
@@ -150,6 +180,58 @@ const RequestEditPage = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
async function handleCreateDocx() {
|
||||||
|
// TODO: compare to see if any changes made before gen, save those
|
||||||
|
const docId = documentId;
|
||||||
|
const leadAttorneys = fetchedCase?.leadAttorneys
|
||||||
|
? fetchedCase?.leadAttorneys
|
||||||
|
: null;
|
||||||
|
const reqType = documentType;
|
||||||
|
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;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch(`${apiUrl}/genDocx/${docId}/${reqType}`, {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
Accept: "application/json",
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
caseCaption1: captionOne,
|
||||||
|
caseCaption2: captionTwo,
|
||||||
|
caseNumber: caseNum,
|
||||||
|
clientPosition: clientPosition,
|
||||||
|
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,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
return response;
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error sending responses to the server:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const handleBlur = (e, i) => {
|
const handleBlur = (e, i) => {
|
||||||
const newSelectedResponses = responses?.map((r) => {
|
const newSelectedResponses = responses?.map((r) => {
|
||||||
if (r.index === i) {
|
if (r.index === i) {
|
||||||
@@ -202,6 +284,15 @@ const RequestEditPage = () => {
|
|||||||
setShowSaveModal(false);
|
setShowSaveModal(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleReport = () => {
|
||||||
|
setShowSaveModal(false);
|
||||||
|
setIsReport(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleConfirmSave = () => {
|
||||||
|
setShowSaveModal(true);
|
||||||
|
};
|
||||||
|
|
||||||
const handleConfirmReport = () => {
|
const handleConfirmReport = () => {
|
||||||
setShowSaveModal(true);
|
setShowSaveModal(true);
|
||||||
setIsReport(true);
|
setIsReport(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user