@@ -6,14 +6,12 @@ import Row from "react-bootstrap/Row";
|
||||
import TextInput from "../../pageElements/TextInput";
|
||||
import Modal from "react-bootstrap/Modal";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
import { collection, setDoc, updateDoc, doc } from "firebase/firestore";
|
||||
import { AppContext } from "../../Hooks/useContext/appContext.js";
|
||||
import { db } from "../../firebase";
|
||||
import { objectMap } from "../../Utils/Object";
|
||||
import { createCaseFields as fields } from "../../Constants/Fields/CreateCaseFields.js";
|
||||
import { createCaseAdditionalFields as additionalFields } from "../../Constants/Fields/CreateCaseFields.js";
|
||||
|
||||
import { floridaCourts } from "../../Constants/Fields/CreateCaseFields.js";
|
||||
import "../../styles/modals.scss";
|
||||
import {
|
||||
getFormDataDefaults,
|
||||
@@ -32,6 +30,7 @@ const CreateModal = ({ setShowModal, caseData }) => {
|
||||
const editCaseId = caseData?.id;
|
||||
const isEditing = typeof editCaseId !== "undefined";
|
||||
const [isBusy, setIsBusy] = useState(false);
|
||||
const [venueArray, setVenueArray] = useState();
|
||||
const [newCaseId, setNewCaseId] = useState();
|
||||
const state = group?.state[0].code ? group?.state[0].code : null;
|
||||
console.log("state", state);
|
||||
@@ -40,8 +39,26 @@ const CreateModal = ({ setShowModal, caseData }) => {
|
||||
getFormDataDefaults(fields, isEditing ? caseData : undefined)
|
||||
);
|
||||
|
||||
function selectVenueValues(data) {
|
||||
const result = floridaCourts.filter((court) => {
|
||||
let val;
|
||||
const target = data?.jurisdiction?.value?.split(" ")[0];
|
||||
if (court?.circuit === target) {
|
||||
return court?.counties;
|
||||
}
|
||||
});
|
||||
const count = result[0]?.counties;
|
||||
return count;
|
||||
}
|
||||
|
||||
const handleChangeInput = (e, name) => {
|
||||
let venArr;
|
||||
const newData = handleFormDataChange(e, name, data, fields);
|
||||
if (state === "fl") {
|
||||
venArr = selectVenueValues(newData);
|
||||
}
|
||||
|
||||
setVenueArray(venArr);
|
||||
if (newData !== null) {
|
||||
setData(newData);
|
||||
}
|
||||
@@ -198,6 +215,8 @@ const CreateModal = ({ setShowModal, caseData }) => {
|
||||
name={"venue"}
|
||||
value={data.venue.value}
|
||||
error={data.venue.error}
|
||||
type={state === "fl" ? "select" : "text"}
|
||||
values={venueArray}
|
||||
message={data.venue.message}
|
||||
disabled={isBusy}
|
||||
onChange={(e) => handleChangeInput(e, "venue")}
|
||||
@@ -241,9 +260,12 @@ const CreateModal = ({ setShowModal, caseData }) => {
|
||||
<TextInput
|
||||
key={"jurisdiction"}
|
||||
name={"jurisdiction"}
|
||||
state={state}
|
||||
value={data.jurisdiction.value}
|
||||
values={floridaCourts}
|
||||
error={data.jurisdiction.error}
|
||||
message={data.jurisdiction.message}
|
||||
type={state === "fl" ? "select" : "text"}
|
||||
disabled={isBusy}
|
||||
onChange={(e) => handleChangeInput(e, "jurisdiction")}
|
||||
label={
|
||||
|
||||
@@ -20,3 +20,101 @@ export const createCaseAdditionalFields = {
|
||||
billingCode: { required: true, maxLength: 45 },
|
||||
leadAttorneys: { required: true, maxLength: 45 },
|
||||
};
|
||||
|
||||
export const floridaCourts = [
|
||||
{
|
||||
circuit: "First",
|
||||
counties: ["Escambia", "Okaloosa", "Santa Rosa", "Walton"],
|
||||
},
|
||||
{
|
||||
circuit: "Second",
|
||||
counties: [
|
||||
"Franklin",
|
||||
"Gadsden",
|
||||
"Jefferson",
|
||||
"Leon",
|
||||
"Liberty",
|
||||
"Wakulla",
|
||||
],
|
||||
},
|
||||
{
|
||||
circuit: "Third",
|
||||
counties: [
|
||||
"Columbia",
|
||||
"Dixie",
|
||||
"Hamilton",
|
||||
"Lafayette",
|
||||
"Madison",
|
||||
"Suwannee",
|
||||
"Taylor",
|
||||
],
|
||||
},
|
||||
{
|
||||
circuit: "Fourth",
|
||||
counties: ["Clay", "Duval", "Nassau"],
|
||||
},
|
||||
{
|
||||
circuit: "Fifth",
|
||||
counties: ["Citrus", "Hernando", "Lake", "Marion", "Sumter"],
|
||||
},
|
||||
{
|
||||
circuit: "Sixth",
|
||||
counties: ["Pasco", "Pinellas"],
|
||||
},
|
||||
{
|
||||
circuit: "Seventh",
|
||||
counties: ["Flagler", "Putnam", "St. Johns", "Volusia"],
|
||||
},
|
||||
{
|
||||
circuit: "Eigth",
|
||||
counties: ["Alachua", "Baker", "Bradford", "Gilchrist", "Levy", "Union"],
|
||||
},
|
||||
{
|
||||
circuit: "Ninth",
|
||||
counties: ["Orange", "Osceola"],
|
||||
},
|
||||
{
|
||||
circuit: "Tenth",
|
||||
counties: ["Hardee", "Highlands", "Polk"],
|
||||
},
|
||||
{
|
||||
circuit: "Eleventh",
|
||||
counties: ["Miami-Dade"],
|
||||
},
|
||||
{
|
||||
circuit: "Twelfth",
|
||||
counties: ["DeSoto", "Manatee", "Sarasota"],
|
||||
},
|
||||
{
|
||||
circuit: "Thirteenth",
|
||||
counties: ["Hillsborough"],
|
||||
},
|
||||
{
|
||||
circuit: "Fourteenth",
|
||||
counties: ["Bay", "Calhoun", "Gulf", "Holmes", "Jackson", "Washington"],
|
||||
},
|
||||
{
|
||||
circuit: "Fifteenth",
|
||||
counties: ["Palm Beach"],
|
||||
},
|
||||
{
|
||||
circuit: "Sixteenth",
|
||||
counties: ["Monroe"],
|
||||
},
|
||||
{
|
||||
circuit: "Seventeenth",
|
||||
counties: ["Broward"],
|
||||
},
|
||||
{
|
||||
circuit: "Eighteenth",
|
||||
counties: ["Brevard", "Seminole"],
|
||||
},
|
||||
{
|
||||
circuit: "Nineteenth",
|
||||
counties: ["Indian River", "Martin", "Okeechobee", "St. Lucie"],
|
||||
},
|
||||
{
|
||||
circuit: "Twentieth",
|
||||
counties: ["Charlotte", "Collier", "Glades", "Hendry", "Lee"],
|
||||
},
|
||||
];
|
||||
|
||||
@@ -12,9 +12,11 @@ const TextInput = (props) => {
|
||||
values,
|
||||
onChange,
|
||||
id,
|
||||
state,
|
||||
type,
|
||||
disabled,
|
||||
} = props;
|
||||
const isFlorida = state === "fl";
|
||||
|
||||
return (
|
||||
<div
|
||||
@@ -45,15 +47,19 @@ const TextInput = (props) => {
|
||||
className={`select-option`}
|
||||
value=""
|
||||
></option>
|
||||
{values.map((item, i) => (
|
||||
{values && values != undefined ? (
|
||||
values.map((item, i) => (
|
||||
<option
|
||||
id="ddlProducts"
|
||||
className={`select-option`}
|
||||
key={`item${i}`}
|
||||
>
|
||||
{item}
|
||||
{isFlorida ? `${item.circuit} Judicial Circuit` : item}
|
||||
</option>
|
||||
))}
|
||||
))
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
</select>
|
||||
) : (
|
||||
<input
|
||||
|
||||
Reference in New Issue
Block a user