This commit is contained in:
Kenneth Jannette
2024-03-14 23:15:06 -05:00
parent 2604a74160
commit eabc070dbd
2 changed files with 48 additions and 26 deletions

View File

@@ -169,15 +169,6 @@ const CaseDetailsPage = () => {
fetchData();
}, [fbUserId]);
const handleUploadDoc = () => {
if (docsAllowed - docsGenerated > 0) {
setUploadType("discovery");
setShowUploadModal(true);
} else {
setShowConfirmModal(true);
}
};
const handleNavigate = (docId, caseId) => {
getDocument(docId, caseId);
};
@@ -189,6 +180,15 @@ const CaseDetailsPage = () => {
navigate(`/reqedit/${documentId}/interrogatories-out/${caseId}`);
};
const handleUploadDoc = () => {
if (docsAllowed - docsGenerated > 0) {
setUploadType("discovery");
setShowUploadModal(true);
} else {
setShowConfirmModal(true);
}
};
const handleUploadComplaint = () => {
if (docsAllowed - docsGenerated > 0) {
setUploadType("complaint");

View File

@@ -44,7 +44,7 @@ const UploadModal = (props) => {
const [fileToUpload, setFileToUpload] = useState();
const [fileToParse, setFileToParse] = useState("");
const [fileChanged, setFileChanged] = useState();
const [radioValue, setRadioValue] = useState(null);
const [radioValue, setRadioValue] = useState(uploadType);
const [radioValueError, setRadioValueError] = useState("");
const [showFileDetails, setShowFileDetails] = useState("");
const [titleError, setShowTitleError] = useState("");
@@ -52,6 +52,9 @@ const UploadModal = (props) => {
const fileTypes = ["PDF"];
const fileName = fileToParse ? fileToParse.name : undefined;
console.log("uploadType", uploadType);
console.log("radioValue", radioValue);
const currentType =
uploadType === "complaint" ? "complaint" : "discovery request";
const otherType =
uploadType === "complaint" ? "discovery request" : "complaint";
let docType;
@@ -229,7 +232,7 @@ const UploadModal = (props) => {
return (
<Modal show="true" onHide={handleUploadCancel} size="lg">
<Modal.Header closeButton>
<Modal.Title>Document Upload</Modal.Title>
<Modal.Title>Upload {currentType}</Modal.Title>
</Modal.Header>
<Modal.Body>
<div className="modal-header-text-wrapper">
@@ -257,7 +260,7 @@ const UploadModal = (props) => {
marginRight: "8px",
}}
/>
NOTE: YOU ARE UPLOADING A {uploadType.toUpperCase()}
YOU ARE UPLOADING A {currentType.toUpperCase()}
<p className="upload-modal-header-text indent">
If you intended to upload a {otherType} - click "cancel", then
select {otherType}
@@ -273,7 +276,14 @@ const UploadModal = (props) => {
name={"title"}
value={docTitle}
onChange={handleTitleInput}
label={docTitle ? "" : "Title"}
label={
docTitle
? ""
: `${
currentType.split("")[0].toUpperCase() +
currentType.substring(1, 20)
} title`
}
error={!!titleError}
message={titleError}
/>
@@ -284,7 +294,10 @@ const UploadModal = (props) => {
name={"description"}
value={docDescription}
onChange={handleDescInput}
label="Description"
label={`${
currentType.split("")[0].toUpperCase() +
currentType.substring(1, 20)
} description`}
/>
</Col>
</Row>
@@ -295,24 +308,23 @@ const UploadModal = (props) => {
name={"date"}
value={dateServed}
onChange={handleDateInput}
label={dateServed ? "" : "Date Served"}
label={
dateServed
? ""
: `${
currentType.split("")[0].toUpperCase() +
currentType.substring(1, 20)
} date served`
}
/>
</Col>
<Col>
<div className="radio-wrapper">
<Radiogroup
title="Document type"
options={radioOptions}
value={radioValue}
radioError={radioValueError}
onClick={(e) => handleSetRadioValue(e, "documentType")}
/>
</div>
<div></div>
</Col>
</Row>
<Row className="file-upload-row">
<Col className="mb-3">
<Form.Label>Select Document</Form.Label>
<Form.Label>Select {currentType}</Form.Label>
<div className="file-uploader">
<FileUploader
multiple={true}
@@ -323,7 +335,7 @@ const UploadModal = (props) => {
<div className={fileToParse ? "drag-box filled" : "drag-box"}>
{fileToParse
? fileToParse[0]?.name
: "Click to select a file or drag and drop here"}
: "Click to select file or drag and drop here"}
</div>
</FileUploader>
</div>
@@ -353,3 +365,13 @@ const UploadModal = (props) => {
};
export default UploadModal;
/*
<Radiogroup
title="Document type"
options={radioOptions}
value={radioValue}
radioError={radioValueError}
onClick={(e) => handleSetRadioValue(e, "documentType")}
/>
*/