From 2e8dc6577b50f50588a01e5b2d467a3824c15a24 Mon Sep 17 00:00:00 2001 From: Kenneth Jannette Date: Wed, 31 Jan 2024 14:00:05 -0600 Subject: [PATCH 01/14] more --- src/styles/casetype-page.scss | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/styles/casetype-page.scss b/src/styles/casetype-page.scss index 0393544..6f58609 100644 --- a/src/styles/casetype-page.scss +++ b/src/styles/casetype-page.scss @@ -15,11 +15,13 @@ display: flex; border: 1px solid red; height: 300px; + padding-top: 8px; } .tag-container { display: flex; flex-direction: row; + flex-wrap: wrap; height: 50px; justify-content: center; align-items: center; From fd2241e417269278ffa53f32e0a1422d6a3d25dc Mon Sep 17 00:00:00 2001 From: Kenneth Jannette Date: Wed, 31 Jan 2024 14:04:30 -0600 Subject: [PATCH 02/14] more --- src/styles/casetype-page.scss | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/styles/casetype-page.scss b/src/styles/casetype-page.scss index 6f58609..8e1e70a 100644 --- a/src/styles/casetype-page.scss +++ b/src/styles/casetype-page.scss @@ -13,6 +13,8 @@ .case-tag-container { display: flex; + flex-direction: row; + flex-wrap: wrap; border: 1px solid red; height: 300px; padding-top: 8px; @@ -30,7 +32,7 @@ .tag-box { background-color: rgba(224, 224, 224, 0.421); display: flex; - flex-direction: row; + border-radius: 8px; margin: 6px 4px; padding: 6px; @@ -41,9 +43,12 @@ } .tag-ex { + cursor: pointer; margin-top: -7px; font-weight: 500; font-size: 0.88rem; + height: 20px; + background-color: blue; } .casetag-name { From 697f76536c8130d910998e9313162a9d34b6ba61 Mon Sep 17 00:00:00 2001 From: Kenneth Jannette Date: Wed, 31 Jan 2024 14:06:06 -0600 Subject: [PATCH 03/14] more --- src/styles/casetype-page.scss | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/styles/casetype-page.scss b/src/styles/casetype-page.scss index 8e1e70a..545d439 100644 --- a/src/styles/casetype-page.scss +++ b/src/styles/casetype-page.scss @@ -24,7 +24,6 @@ display: flex; flex-direction: row; flex-wrap: wrap; - height: 50px; justify-content: center; align-items: center; } @@ -32,7 +31,6 @@ .tag-box { background-color: rgba(224, 224, 224, 0.421); display: flex; - border-radius: 8px; margin: 6px 4px; padding: 6px; From d294e50022f5100a3d07466b2f65e29ff30f4795 Mon Sep 17 00:00:00 2001 From: Kenneth Jannette Date: Wed, 31 Jan 2024 14:16:44 -0600 Subject: [PATCH 04/14] more --- src/styles/casetype-page.scss | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/styles/casetype-page.scss b/src/styles/casetype-page.scss index 545d439..4386b39 100644 --- a/src/styles/casetype-page.scss +++ b/src/styles/casetype-page.scss @@ -16,15 +16,13 @@ flex-direction: row; flex-wrap: wrap; border: 1px solid red; - height: 300px; padding-top: 8px; } .tag-container { - display: flex; - flex-direction: row; - flex-wrap: wrap; - justify-content: center; + height: 30px; + margin-top: 8px; + margin-bottom: 8px; align-items: center; } @@ -32,7 +30,7 @@ background-color: rgba(224, 224, 224, 0.421); display: flex; border-radius: 8px; - margin: 6px 4px; + margin: 4px 4px; padding: 6px; } From 4fffb6527ba6c6ba1286a527829b265c3a6d1c19 Mon Sep 17 00:00:00 2001 From: Kenneth Jannette Date: Wed, 31 Jan 2024 14:19:27 -0600 Subject: [PATCH 05/14] more --- src/Components/Case/CaseTypePage.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Components/Case/CaseTypePage.js b/src/Components/Case/CaseTypePage.js index f6ab179..c8ca537 100644 --- a/src/Components/Case/CaseTypePage.js +++ b/src/Components/Case/CaseTypePage.js @@ -85,6 +85,10 @@ const CaseTypePage = ({ caseData }) => { return hasErrors ? null : objectMap(({ value }) => value, newData); }; + const handleTagClick = () => { + console.log("handleTagClick"); + }; + const ButtonContent = () => { return (
@@ -141,7 +145,7 @@ const CaseTypePage = ({ caseData }) => { {selectedCaseTags.map((tag, i) => (
-
+
x
{tag}
@@ -255,6 +259,7 @@ const CaseTypePage = ({ caseData }) => { +
); }; From 2a941f643c7678bfa1f0dabd6f8cfb628eacac29 Mon Sep 17 00:00:00 2001 From: Kenneth Jannette Date: Wed, 31 Jan 2024 14:24:01 -0600 Subject: [PATCH 06/14] more --- src/Components/Case/CaseTypePage.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Components/Case/CaseTypePage.js b/src/Components/Case/CaseTypePage.js index c8ca537..a6e92e4 100644 --- a/src/Components/Case/CaseTypePage.js +++ b/src/Components/Case/CaseTypePage.js @@ -72,7 +72,6 @@ const CaseTypePage = ({ caseData }) => { }; const setSelectedTag = (item) => { - console.log("item in setSelectedTag ---------------------->", item); const temp = [...selectedCaseTags, item.tagName]; setSelectedCaseTags(temp); console.log("selectedCaseTags", selectedCaseTags); @@ -85,8 +84,14 @@ const CaseTypePage = ({ caseData }) => { return hasErrors ? null : objectMap(({ value }) => value, newData); }; - const handleTagClick = () => { - console.log("handleTagClick"); + const handleTagClick = (clickedTag) => { + console.log("handleTagClick tag", clickedTag); + console.log("selectedCaseTags", selectedCaseTags); + const temp = selectedCaseTags; + const foo = temp.filter((tag) => { + if (tag != clickedTag) return tag; + }); + setSelectedCaseTags(foo); }; const ButtonContent = () => { @@ -145,7 +150,10 @@ const CaseTypePage = ({ caseData }) => { {selectedCaseTags.map((tag, i) => (
-
+
handleTagClick(tag)} + >
x
{tag}
From a3cea43572e7a6b985e638f28af4b307b97a7f48 Mon Sep 17 00:00:00 2001 From: Kenneth Jannette Date: Wed, 31 Jan 2024 15:14:11 -0600 Subject: [PATCH 07/14] more --- src/Components/Case/CaseTypePage.js | 336 +++------------------------- src/pageElements/TagSelector.js | 43 ++++ src/styles/casetype-page.scss | 12 +- 3 files changed, 74 insertions(+), 317 deletions(-) create mode 100644 src/pageElements/TagSelector.js diff --git a/src/Components/Case/CaseTypePage.js b/src/Components/Case/CaseTypePage.js index a6e92e4..c8a2db0 100644 --- a/src/Components/Case/CaseTypePage.js +++ b/src/Components/Case/CaseTypePage.js @@ -1,318 +1,32 @@ -import { useEffect, useContext, useState, useRef } from "react"; -import { useNavigate } from "react-router-dom"; -import Button from "../../pageElements/Button"; -import Form from "react-bootstrap/Form"; -import Col from "react-bootstrap/Col"; -import Row from "react-bootstrap/Row"; -import TextInput from "../../pageElements/TextInput"; -import Radiogroup from "../../pageElements/Radiogroup"; -import { - getFormDataDefaults, - getValidatedFormData, - handleFormDataChange, - isFormDataHasErrors, -} from "../../Utils/Form"; -import { db } from "../../firebase"; -import * as dJSON from "dirty-json"; -import { useParams } from "react-router-dom"; -import { AppContext } from "../../Hooks/useContext/appContext.js"; -import LoadingSpinner from "../../pageElements/LoadingSpinner"; -import { doc, onSnapshot } from "firebase/firestore"; -import { createCaseAdditionalFields as fields } from "../../Constants/Fields/CreateCaseFields.js"; -import { objectMap } from "../../Utils/Object"; -import { Typeahead } from "react-bootstrap-typeahead"; -import { caseTags } from "../../Constants/Tags/CaseTags"; +import { useState } from "react"; import "../../styles/casetype-page.scss"; - -const CaseTypePage = ({ caseData }) => { - const { caseId } = useParams(); - const navigate = useNavigate(); - const { appState } = useContext(AppContext); - const { group } = appState; - const [isEditing, setFsEditing] = useState(false); - const [subCase, setSubCase] = useState(null); - const [isLoading, setIsLoading] = useState(false); - const [selectedCaseTags, setSelectedCaseTags] = useState([]); - const typeaheadRef = useRef(); - const appUserId = group ? group.appUserId : null; - const [data, setData] = useState( - getFormDataDefaults(fields, isEditing ? caseData : undefined) - ); - const [isBusy, setIsBusy] = useState(false); - - const parsedTags = dJSON.parse(JSON.stringify(caseTags)); - - const handleNavigate = () => { - navigate("/documents"); - }; - - const handleBack = () => { - navigate("/cases"); - }; - - function getCase() { - const docRef = doc(db, "cases", caseId); - const unsub = onSnapshot(docRef, (snapshot) => { - if (snapshot.exists() && snapshot.data().ownerId === appUserId) { - setSubCase({ ...snapshot.data(), id: snapshot.id }); - } else { - setSubCase(null); - } - }); - return unsub; - } - - useEffect(getCase, [caseId, appUserId]); - - const handleChangeInput = (e, name) => { - const newData = handleFormDataChange(e, name, data, fields); - if (newData !== null) { - setData(newData); - } - }; - - const setSelectedTag = (item) => { - const temp = [...selectedCaseTags, item.tagName]; - setSelectedCaseTags(temp); - console.log("selectedCaseTags", selectedCaseTags); - }; - - const validateData = () => { - const newData = getValidatedFormData(data, fields); - const hasErrors = isFormDataHasErrors(newData); - setData(newData); - return hasErrors ? null : objectMap(({ value }) => value, newData); - }; - - const handleTagClick = (clickedTag) => { - console.log("handleTagClick tag", clickedTag); - console.log("selectedCaseTags", selectedCaseTags); - const temp = selectedCaseTags; - const foo = temp.filter((tag) => { - if (tag != clickedTag) return tag; - }); - setSelectedCaseTags(foo); - }; - - const ButtonContent = () => { - return ( -
-
-
-
-
- ); - }; - - const radioOptions = [ - { name: "Plaintiff", label: "Plaintiff", value: "Plaintiff" }, - { name: "Defendant", label: "Defendant", value: "Defendant" }, - ]; - - if (!group) { - return null; - } - +const CaseTypePage = () => { + const [email, setEmail] = useState(""); + const [contactName, setContactName] = useState(""); return ( -
-
- - - {isEditing ? ( -
Case Type
- ) : ( - <> - )} - { - let item = null; - for (const currentItem of selected) { - item = { ...currentItem }; - } - setSelectedTag(item); - typeaheadRef.current.clear(); - }} - /> -
- {selectedCaseTags.map((tag, i) => ( -
-
-
handleTagClick(tag)} - > -
x
-
-
{tag}
-
-
- ))} -
- - - {isEditing ? ( -
Position
- ) : ( - <> - )} - -
- - - {isEditing ? ( -
Lead Attorney
- ) : ( - <> - )} - handleChangeInput(e, "leadAttorneys")} - label={ - data.leadAttorneys.value.length === 0 - ? isEditing - ? caseData.leadAttorneys - : "Lead Attornery(s)" - : "" - } - /> - - - {isEditing ? ( -
Billing code
- ) : ( - <> - )} - handleChangeInput(e, "billingCode")} - label={ - data.billingCode.value.length === 0 - ? isEditing - ? caseData.billingCode - : "Billing Code" - : "" - } - /> - -
- - - {isEditing ? ( -
Contact Name
- ) : ( - <> - )} - handleChangeInput(e, "contactLastName")} - label={ - data.contactName.value.length === 0 - ? isEditing - ? caseData.contactName - : "Contact Name" - : "" - } - /> - - - {isEditing ? ( -
Contact email
- ) : ( - <> - )} - handleChangeInput(e, "contactEmail")} - label={ - data.contactEmail.value.length === 0 - ? isEditing - ? caseData.contactEmail - : "Contact Email" - : "" - } - /> - -
-
- +
+
+ setContactName(e.target.value)} + > +
+
+ setEmail(e.target.value)} + > +
); }; export default CaseTypePage; - -/* - { - let item = null; - for (const currentItem of selected) { - item = { ...currentItem }; - } - setSelectedTag(item); - typeaheadRef.current.clear(); - }} - /> -
- {selectedCaseTags.map((tag, i) => ( -
-
-
-
x
-
-
{tag}
-
-
- ))} -
- - - - handleChangeInput(e, "clientPosition")} - /> - - */ diff --git a/src/pageElements/TagSelector.js b/src/pageElements/TagSelector.js new file mode 100644 index 0000000..79f5751 --- /dev/null +++ b/src/pageElements/TagSelector.js @@ -0,0 +1,43 @@ +/* + { + let item = null; + for (const currentItem of selected) { + item = { ...currentItem }; + } + setSelectedTag(item); + typeaheadRef.current.clear(); + }} + /> +
+ {selectedCaseTags.map((tag, i) => ( +
+
+
+
x
+
+
{tag}
+
+
+ ))} +
+ + + + handleChangeInput(e, "clientPosition")} + /> + + */ + */ \ No newline at end of file diff --git a/src/styles/casetype-page.scss b/src/styles/casetype-page.scss index 4386b39..59c2d81 100644 --- a/src/styles/casetype-page.scss +++ b/src/styles/casetype-page.scss @@ -1,14 +1,14 @@ -.casetype-container { - width: 920px; +.type-row { display: flex; - flex-direction: column; + flex-direction: row; + justify-content: center; margin-left: auto; margin-right: auto; - align-items: center; } -.casetype-form { - width: 100%; +.type-col { + display: flex; + flex-direction: column; } .case-tag-container { From c3e0ae5a149d6b02a100d35ef103f5024150e575 Mon Sep 17 00:00:00 2001 From: Kenneth Jannette Date: Wed, 31 Jan 2024 15:17:48 -0600 Subject: [PATCH 08/14] more --- src/Components/Case/CaseTypePage.js | 67 ++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 20 deletions(-) diff --git a/src/Components/Case/CaseTypePage.js b/src/Components/Case/CaseTypePage.js index c8a2db0..52303f6 100644 --- a/src/Components/Case/CaseTypePage.js +++ b/src/Components/Case/CaseTypePage.js @@ -3,29 +3,56 @@ import "../../styles/casetype-page.scss"; const CaseTypePage = () => { const [email, setEmail] = useState(""); const [contactName, setContactName] = useState(""); + const [billingCode, setBillingCode] = useState(""); + const [leadAttorney, setLeadAttorney] = useState(""); + return ( -
-
- setContactName(e.target.value)} - > + <> +
+
+ setLeadAttorney(e.target.value)} + > +
+
+ setBillingCode(e.target.value)} + > +
-
- setEmail(e.target.value)} - > +
+
+ setContactName(e.target.value)} + > +
+
+ setEmail(e.target.value)} + > +
-
+ ); }; From 3ecd07fff84e379432d45a31d93a95f618c038ce Mon Sep 17 00:00:00 2001 From: Kenneth Jannette Date: Wed, 31 Jan 2024 15:21:50 -0600 Subject: [PATCH 09/14] more --- src/Components/Case/CaseTypePage.js | 5 +++-- src/styles/casetype-page.scss | 12 ++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Components/Case/CaseTypePage.js b/src/Components/Case/CaseTypePage.js index 52303f6..8c4c633 100644 --- a/src/Components/Case/CaseTypePage.js +++ b/src/Components/Case/CaseTypePage.js @@ -1,4 +1,5 @@ import { useState } from "react"; + import "../../styles/casetype-page.scss"; const CaseTypePage = () => { const [email, setEmail] = useState(""); @@ -7,7 +8,7 @@ const CaseTypePage = () => { const [leadAttorney, setLeadAttorney] = useState(""); return ( - <> +
{ >
- +
); }; diff --git a/src/styles/casetype-page.scss b/src/styles/casetype-page.scss index 59c2d81..b859d98 100644 --- a/src/styles/casetype-page.scss +++ b/src/styles/casetype-page.scss @@ -1,7 +1,18 @@ +.type-container { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + margin-left: auto; + margin-right: auto; + width: 900px; +} + .type-row { display: flex; flex-direction: row; justify-content: center; + width: 100%; margin-left: auto; margin-right: auto; } @@ -9,6 +20,7 @@ .type-col { display: flex; flex-direction: column; + width: 50%; } .case-tag-container { From f56e255010a31a00a0f66b88b5428c174914a772 Mon Sep 17 00:00:00 2001 From: Kenneth Jannette Date: Wed, 31 Jan 2024 15:40:42 -0600 Subject: [PATCH 10/14] more --- src/Components/Case/CaseTypePage.js | 24 +++++++++++++++++++++++- src/pageElements/TagSelector.js | 4 ++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/Components/Case/CaseTypePage.js b/src/Components/Case/CaseTypePage.js index 8c4c633..89809af 100644 --- a/src/Components/Case/CaseTypePage.js +++ b/src/Components/Case/CaseTypePage.js @@ -1,12 +1,23 @@ import { useState } from "react"; - +import { Typeahead } from "react-bootstrap-typeahead"; +import Radiogroup from "../../pageElements/Radiogroup"; import "../../styles/casetype-page.scss"; + const CaseTypePage = () => { const [email, setEmail] = useState(""); const [contactName, setContactName] = useState(""); const [billingCode, setBillingCode] = useState(""); const [leadAttorney, setLeadAttorney] = useState(""); + const [radioValue, setRadioValue] = useState(); + const radioOptions = [ + { name: "Plaintiff", label: "Plaintiff", value: "Plaintiff" }, + { name: "Defendant", label: "Defendant", value: "Defendant" }, + ]; + const handleSetRadioValue = (e) => { + console.log("e", e); + setRadioValue(e.value); + }; return (
@@ -53,6 +64,17 @@ const CaseTypePage = () => { >
+
+
+
+ handleSetRadioValue(e, "clientPosition")} + /> +
+
); }; diff --git a/src/pageElements/TagSelector.js b/src/pageElements/TagSelector.js index 79f5751..82a726d 100644 --- a/src/pageElements/TagSelector.js +++ b/src/pageElements/TagSelector.js @@ -34,9 +34,9 @@ handleChangeInput(e, "clientPosition")} + onClick={(e) => setRadioValue(e, "clientPosition")} /> */ From 8ce6d29eb70572c9b25012d276d8fd25213b4094 Mon Sep 17 00:00:00 2001 From: Kenneth Jannette Date: Wed, 31 Jan 2024 15:43:15 -0600 Subject: [PATCH 11/14] more --- src/Components/Case/CaseTypePage.js | 3 +++ src/pageElements/TagSelector.js | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Components/Case/CaseTypePage.js b/src/Components/Case/CaseTypePage.js index 89809af..67627f0 100644 --- a/src/Components/Case/CaseTypePage.js +++ b/src/Components/Case/CaseTypePage.js @@ -1,6 +1,7 @@ import { useState } from "react"; import { Typeahead } from "react-bootstrap-typeahead"; import Radiogroup from "../../pageElements/Radiogroup"; +import { caseTags } from "../../Constants/Tags/CaseTags"; import "../../styles/casetype-page.scss"; const CaseTypePage = () => { @@ -9,6 +10,7 @@ const CaseTypePage = () => { const [billingCode, setBillingCode] = useState(""); const [leadAttorney, setLeadAttorney] = useState(""); const [radioValue, setRadioValue] = useState(); + const radioOptions = [ { name: "Plaintiff", label: "Plaintiff", value: "Plaintiff" }, { name: "Defendant", label: "Defendant", value: "Defendant" }, @@ -18,6 +20,7 @@ const CaseTypePage = () => { console.log("e", e); setRadioValue(e.value); }; + return (
diff --git a/src/pageElements/TagSelector.js b/src/pageElements/TagSelector.js index 82a726d..d5c60d2 100644 --- a/src/pageElements/TagSelector.js +++ b/src/pageElements/TagSelector.js @@ -40,4 +40,3 @@ /> */ - */ \ No newline at end of file From bc6172e047df51f8474406961f88cb2a2715f50d Mon Sep 17 00:00:00 2001 From: Kenneth Jannette Date: Wed, 31 Jan 2024 15:45:52 -0600 Subject: [PATCH 12/14] more --- src/Components/Case/CaseTypePage.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Components/Case/CaseTypePage.js b/src/Components/Case/CaseTypePage.js index 67627f0..916f5e4 100644 --- a/src/Components/Case/CaseTypePage.js +++ b/src/Components/Case/CaseTypePage.js @@ -11,6 +11,8 @@ const CaseTypePage = () => { const [leadAttorney, setLeadAttorney] = useState(""); const [radioValue, setRadioValue] = useState(); + const parsedTags = JSON.parse(JSON.stringify(caseTags)); + const radioOptions = [ { name: "Plaintiff", label: "Plaintiff", value: "Plaintiff" }, { name: "Defendant", label: "Defendant", value: "Defendant" }, From 82a09f3f731dbd5f7d2360f66bfa18e710a5ac46 Mon Sep 17 00:00:00 2001 From: Kenneth Jannette Date: Wed, 31 Jan 2024 16:08:12 -0600 Subject: [PATCH 13/14] more --- src/Components/Case/CaseTypePage.js | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/Components/Case/CaseTypePage.js b/src/Components/Case/CaseTypePage.js index 916f5e4..3ce1f48 100644 --- a/src/Components/Case/CaseTypePage.js +++ b/src/Components/Case/CaseTypePage.js @@ -1,18 +1,41 @@ -import { useState } from "react"; +import React, { useEffect, useContext, useState, useRef } from "react"; +import { useNavigate } from "react-router-dom"; +import { useParams } from "react-router-dom"; import { Typeahead } from "react-bootstrap-typeahead"; +import { AppContext } from "../../Hooks/useContext/appContext.js"; +import { doc, onSnapshot } from "firebase/firestore"; import Radiogroup from "../../pageElements/Radiogroup"; import { caseTags } from "../../Constants/Tags/CaseTags"; +import { db } from "../../firebase"; import "../../styles/casetype-page.scss"; const CaseTypePage = () => { + const { caseId } = useParams(); + const navigate = useNavigate(); + const { appState } = useContext(AppContext); + const { group } = appState; + const appUserId = group ? group.appUserId : null; + const [subCase, setSubCase] = useState(); const [email, setEmail] = useState(""); const [contactName, setContactName] = useState(""); const [billingCode, setBillingCode] = useState(""); const [leadAttorney, setLeadAttorney] = useState(""); const [radioValue, setRadioValue] = useState(); - const parsedTags = JSON.parse(JSON.stringify(caseTags)); + function getCase() { + const docRef = doc(db, "cases", caseId); + const unsub = onSnapshot(docRef, (snapshot) => { + if (snapshot.exists() && snapshot.data().ownerId === appUserId) { + setSubCase({ ...snapshot.data(), id: snapshot.id }); + } else { + setSubCase(null); + } + }); + return unsub; + } + const parsedTags = JSON.parse(JSON.stringify(caseTags)); + useEffect(getCase, [caseId, appUserId]); const radioOptions = [ { name: "Plaintiff", label: "Plaintiff", value: "Plaintiff" }, { name: "Defendant", label: "Defendant", value: "Defendant" }, From 06169281feba345a51605fd72e516528e585f9a9 Mon Sep 17 00:00:00 2001 From: Kenneth Jannette Date: Wed, 31 Jan 2024 16:17:15 -0600 Subject: [PATCH 14/14] more --- src/Components/Case/CaseTypePage.js | 44 ++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/src/Components/Case/CaseTypePage.js b/src/Components/Case/CaseTypePage.js index 3ce1f48..00fa0b2 100644 --- a/src/Components/Case/CaseTypePage.js +++ b/src/Components/Case/CaseTypePage.js @@ -21,6 +21,9 @@ const CaseTypePage = () => { const [billingCode, setBillingCode] = useState(""); const [leadAttorney, setLeadAttorney] = useState(""); const [radioValue, setRadioValue] = useState(); + const [selectedCaseTags, setSelectedCaseTags] = useState([]); + + const typeaheadRef = useRef(); function getCase() { const docRef = doc(db, "cases", caseId); @@ -35,7 +38,16 @@ const CaseTypePage = () => { } const parsedTags = JSON.parse(JSON.stringify(caseTags)); + useEffect(getCase, [caseId, appUserId]); + + const setSelectedTag = (item) => { + console.log("item in setSelectedTag ---------------------->", item); + const temp = [...selectedCaseTags, item.tagName]; + setSelectedCaseTags(temp); + console.log("selectedCaseTags", selectedCaseTags); + }; + const radioOptions = [ { name: "Plaintiff", label: "Plaintiff", value: "Plaintiff" }, { name: "Defendant", label: "Defendant", value: "Defendant" }, @@ -93,7 +105,37 @@ const CaseTypePage = () => {
-
+
+ { + let item = null; + for (const currentItem of selected) { + item = { ...currentItem }; + } + setSelectedTag(item); + typeaheadRef.current.clear(); + }} + /> +
+ {selectedCaseTags.map((tag, i) => ( +
+
+
+
x
+
+
{tag}
+
+
+ ))} +
+