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

View File

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