more
This commit is contained in:
@@ -3,7 +3,7 @@ import { useNavigate } from "react-router-dom";
|
|||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import { Typeahead } from "react-bootstrap-typeahead";
|
import { Typeahead } from "react-bootstrap-typeahead";
|
||||||
import { AppContext } from "../../Hooks/useContext/appContext.js";
|
import { AppContext } from "../../Hooks/useContext/appContext.js";
|
||||||
import { doc, onSnapshot } from "firebase/firestore";
|
import { updateDoc, doc, onSnapshot } from "firebase/firestore";
|
||||||
import Button from "../../pageElements/Button";
|
import Button from "../../pageElements/Button";
|
||||||
import Radiogroup from "../../pageElements/Radiogroup";
|
import Radiogroup from "../../pageElements/Radiogroup";
|
||||||
import { caseTags } from "../../Constants/Tags/CaseTags";
|
import { caseTags } from "../../Constants/Tags/CaseTags";
|
||||||
@@ -23,7 +23,7 @@ const CaseTypePage = () => {
|
|||||||
const [leadAttorney, setLeadAttorney] = useState("");
|
const [leadAttorney, setLeadAttorney] = useState("");
|
||||||
const [radioValue, setRadioValue] = useState();
|
const [radioValue, setRadioValue] = useState();
|
||||||
const [selectedCaseTags, setSelectedCaseTags] = useState([]);
|
const [selectedCaseTags, setSelectedCaseTags] = useState([]);
|
||||||
|
const [isBusy, setIsBusy] = useState(false);
|
||||||
const typeaheadRef = useRef();
|
const typeaheadRef = useRef();
|
||||||
|
|
||||||
function getCase() {
|
function getCase() {
|
||||||
@@ -63,6 +63,24 @@ const CaseTypePage = () => {
|
|||||||
console.log("handleSave");
|
console.log("handleSave");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
async function saveCaseData() {
|
||||||
|
if (isBusy) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const dataValues = {
|
||||||
|
leadAttorney: leadAttorney,
|
||||||
|
};
|
||||||
|
|
||||||
|
setIsBusy(true);
|
||||||
|
try {
|
||||||
|
await updateDoc(doc(db, "cases", caseId), dataValues);
|
||||||
|
} catch (err) {
|
||||||
|
console.log("Error updating case:", err);
|
||||||
|
}
|
||||||
|
|
||||||
|
setIsBusy(false);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="type-container">
|
<div className="type-container">
|
||||||
<div className="type-row">
|
<div className="type-row">
|
||||||
@@ -142,18 +160,20 @@ const CaseTypePage = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="type-col">
|
<div className="type-col">
|
||||||
<Radiogroup
|
<div className="radio-wrapper">
|
||||||
title="Client position"
|
<Radiogroup
|
||||||
options={radioOptions}
|
title="Client position"
|
||||||
value={radioValue}
|
options={radioOptions}
|
||||||
onClick={(e) => handleSetRadioValue(e, "clientPosition")}
|
value={radioValue}
|
||||||
/>
|
onClick={(e) => handleSetRadioValue(e, "clientPosition")}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="caseType-button-container">
|
<div className="caseType-button-container">
|
||||||
<Button
|
<Button
|
||||||
className="pt-2 pb-2 mr-2 primary-button"
|
className="pt-2 pb-2 mr-2 primary-button"
|
||||||
onClick={handleSave}
|
onClick={saveCaseData}
|
||||||
labelText="Next"
|
labelText="Next"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -76,3 +76,10 @@
|
|||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.radio-wrapper {
|
||||||
|
padding-left: 8px;
|
||||||
|
margin-top: -3px;
|
||||||
|
border: 1px solid #eaeaea;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user