From 2fbc909c6c320d75963c645b3b510fb8dddec6a5 Mon Sep 17 00:00:00 2001 From: Kenneth Jannette Date: Sat, 3 Feb 2024 17:35:59 -0600 Subject: [PATCH 1/7] more --- src/Components/Modals/CreateModal.js | 7 +++--- src/Constants/Fields/CreateCaseFields.js | 30 ++++++++++++++++++++++++ src/pageElements/TextInput.js | 26 ++++++++++++-------- 3 files changed, 50 insertions(+), 13 deletions(-) diff --git a/src/Components/Modals/CreateModal.js b/src/Components/Modals/CreateModal.js index ef68e26..eb5b340 100644 --- a/src/Components/Modals/CreateModal.js +++ b/src/Components/Modals/CreateModal.js @@ -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, @@ -241,9 +239,12 @@ const CreateModal = ({ setShowModal, caseData }) => { handleChangeInput(e, "jurisdiction")} label={ diff --git a/src/Constants/Fields/CreateCaseFields.js b/src/Constants/Fields/CreateCaseFields.js index 6ed1c15..459c18c 100644 --- a/src/Constants/Fields/CreateCaseFields.js +++ b/src/Constants/Fields/CreateCaseFields.js @@ -20,3 +20,33 @@ 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", + ], + }, +]; diff --git a/src/pageElements/TextInput.js b/src/pageElements/TextInput.js index fe9cdf4..135cc8d 100644 --- a/src/pageElements/TextInput.js +++ b/src/pageElements/TextInput.js @@ -12,10 +12,12 @@ const TextInput = (props) => { values, onChange, id, + state, type, disabled, } = props; - + const isFlorida = state === "fl"; + console.log("values", values); return (
{ className={`select-option`} value="" > - {values.map((item, i) => ( - - ))} + {values && values != undefined ? ( + values.map((item, i) => ( + + )) + ) : ( + <> + )} ) : ( Date: Sat, 3 Feb 2024 18:17:06 -0600 Subject: [PATCH 2/7] more --- src/Components/Modals/CreateModal.js | 19 +++++++++++++++++++ src/pageElements/TextInput.js | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/Components/Modals/CreateModal.js b/src/Components/Modals/CreateModal.js index eb5b340..eb04fa6 100644 --- a/src/Components/Modals/CreateModal.js +++ b/src/Components/Modals/CreateModal.js @@ -30,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); @@ -38,8 +39,24 @@ const CreateModal = ({ setShowModal, caseData }) => { getFormDataDefaults(fields, isEditing ? caseData : undefined) ); + function selectVenueValues(data) { + const result = floridaCourts.filter((court) => { + let val; + console.log("court", court); + const target = data.jurisdiction.value.split(" ")[0]; + if (court.circuit === target) { + console.log("court.counties", court.counties); + val = court.counties; + } + return val; + }); + return result; + } + const handleChangeInput = (e, name) => { const newData = handleFormDataChange(e, name, data, fields); + const venArr = selectVenueValues(newData); + setVenueArray(venArr); if (newData !== null) { setData(newData); } @@ -196,6 +213,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")} diff --git a/src/pageElements/TextInput.js b/src/pageElements/TextInput.js index 135cc8d..e165339 100644 --- a/src/pageElements/TextInput.js +++ b/src/pageElements/TextInput.js @@ -17,7 +17,7 @@ const TextInput = (props) => { disabled, } = props; const isFlorida = state === "fl"; - console.log("values", values); + return (
Date: Sat, 3 Feb 2024 18:23:03 -0600 Subject: [PATCH 3/7] more --- src/Components/Modals/CreateModal.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Components/Modals/CreateModal.js b/src/Components/Modals/CreateModal.js index eb04fa6..109ee5e 100644 --- a/src/Components/Modals/CreateModal.js +++ b/src/Components/Modals/CreateModal.js @@ -42,15 +42,13 @@ const CreateModal = ({ setShowModal, caseData }) => { function selectVenueValues(data) { const result = floridaCourts.filter((court) => { let val; - console.log("court", court); const target = data.jurisdiction.value.split(" ")[0]; if (court.circuit === target) { - console.log("court.counties", court.counties); - val = court.counties; + return court.counties; } - return val; }); - return result; + const count = result[0].counties; + return count; } const handleChangeInput = (e, name) => { From 91c44a32a9172d077544229e27350e221726363f Mon Sep 17 00:00:00 2001 From: Kenneth Jannette Date: Sat, 3 Feb 2024 18:42:51 -0600 Subject: [PATCH 4/7] more --- src/Components/Modals/CreateModal.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Components/Modals/CreateModal.js b/src/Components/Modals/CreateModal.js index 109ee5e..5235680 100644 --- a/src/Components/Modals/CreateModal.js +++ b/src/Components/Modals/CreateModal.js @@ -52,8 +52,12 @@ const CreateModal = ({ setShowModal, caseData }) => { } const handleChangeInput = (e, name) => { + let venArr; const newData = handleFormDataChange(e, name, data, fields); - const venArr = selectVenueValues(newData); + if (state === "fl") { + venArr = selectVenueValues(newData); + } + setVenueArray(venArr); if (newData !== null) { setData(newData); From 81b10bb3fcc5b0b5435fd7bbcafabe6b8f890b87 Mon Sep 17 00:00:00 2001 From: Kenneth Jannette Date: Sat, 3 Feb 2024 18:45:01 -0600 Subject: [PATCH 5/7] more --- src/Components/Modals/CreateModal.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Components/Modals/CreateModal.js b/src/Components/Modals/CreateModal.js index 5235680..93360f9 100644 --- a/src/Components/Modals/CreateModal.js +++ b/src/Components/Modals/CreateModal.js @@ -42,12 +42,12 @@ const CreateModal = ({ setShowModal, caseData }) => { 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 target = data?.jurisdiction?.value?.split(" ")[0]; + if (court?.circuit === target) { + return court?.counties; } }); - const count = result[0].counties; + const count = result[0]?.counties; return count; } From 8a8c0266f634ca27d457d11c2b8a6a3c20d03c3e Mon Sep 17 00:00:00 2001 From: Kenneth Jannette Date: Sat, 3 Feb 2024 18:57:42 -0600 Subject: [PATCH 6/7] more --- src/Constants/Fields/CreateCaseFields.js | 44 ++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/src/Constants/Fields/CreateCaseFields.js b/src/Constants/Fields/CreateCaseFields.js index 459c18c..bc7bafa 100644 --- a/src/Constants/Fields/CreateCaseFields.js +++ b/src/Constants/Fields/CreateCaseFields.js @@ -49,4 +49,48 @@ export const floridaCourts = [ "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"], + }, ]; From ad781af933ebd8a395c048e397959a8d4d3f075b Mon Sep 17 00:00:00 2001 From: Kenneth Jannette Date: Sat, 3 Feb 2024 19:01:58 -0600 Subject: [PATCH 7/7] more --- src/Constants/Fields/CreateCaseFields.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/Constants/Fields/CreateCaseFields.js b/src/Constants/Fields/CreateCaseFields.js index bc7bafa..074169c 100644 --- a/src/Constants/Fields/CreateCaseFields.js +++ b/src/Constants/Fields/CreateCaseFields.js @@ -93,4 +93,28 @@ export const floridaCourts = [ 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"], + }, ];