diff --git a/src/Components/Account/AccountPage.js b/src/Components/Account/AccountPage.js index 1ff370b..49613f5 100644 --- a/src/Components/Account/AccountPage.js +++ b/src/Components/Account/AccountPage.js @@ -6,6 +6,7 @@ import Button from "../../pageElements/Button"; import { AppContext } from "../../Hooks/useContext/appContext"; import { AuthContext } from "../../Context/AuthProvider"; import ProgressBar from "../../pageElements/ProgressBar"; +import ConfirmModal from "../Modals/ConfirmModal"; const AccountPage = () => { const navigate = useNavigate(); @@ -15,7 +16,7 @@ const AccountPage = () => { const [docsGenerated, setDocsGenerated] = useState(null); const [docsAllowed, setDocsAllowed] = useState(10); const appUserId = group ? group.appUserId : null; - + const [showModal, setShowModal] = useState(false); function getDocumentsCount() { if (!appUserId) { return; @@ -36,6 +37,15 @@ const AccountPage = () => { return null; } + const handleCancelSub = () => { + setShowModal(true); + try { + //API call(s) + } catch (err) { + console.log(err); + } + setShowModal(false); + }; const handleSupport = () => { const supReq = "5ac45d12"; navigate(`/requestpage/${supReq}`); @@ -178,7 +188,11 @@ const AccountPage = () => { ) : null}
-
@@ -194,6 +208,14 @@ const AccountPage = () => {
{telNumberFormat(group.telephone)}
+ {showModal ? ( + setShowModal(false)} + onConfirm={handleCancelSub} + buttonLabelText="Confirm Cancel" + modalText="Are you sure? Your subscription will end at the conclusion of the current billing period." + /> + ) : null} ); }; diff --git a/src/Components/Document/DocEditPage.js b/src/Components/Document/DocEditPage.js index c7917eb..e3183b4 100644 --- a/src/Components/Document/DocEditPage.js +++ b/src/Components/Document/DocEditPage.js @@ -584,7 +584,7 @@ const DocEditPage = () => { const editingContent = () => { return ( <> - {headerPicker()} +
{headerPicker()}
{headerString}
diff --git a/src/Components/Document/DocumentListPage.js b/src/Components/Document/DocumentListPage.js index 3120e46..981183d 100644 --- a/src/Components/Document/DocumentListPage.js +++ b/src/Components/Document/DocumentListPage.js @@ -171,7 +171,7 @@ const DocumentListPage = ({ perPage }) => { if (!group) { return null; } - + console.log("allDocs", allDocs); const DesktopContent = () => { return ( <> @@ -204,6 +204,7 @@ const DocumentListPage = ({ perPage }) => { parentCaseNumber={doc.parentCaseNumber} parentCaseName={doc.parentCaseName} parentCaseId={doc.parentCaseId} + createdAt={doc.createdAt} docType={doc.docType} documentId={doc.documentId} dateServed={doc.dateServed} diff --git a/src/Components/Document/captionHeaders/newYorkCaption.js b/src/Components/Document/captionHeaders/newYorkCaption.js index 4ff9ae8..c8ecae0 100644 --- a/src/Components/Document/captionHeaders/newYorkCaption.js +++ b/src/Components/Document/captionHeaders/newYorkCaption.js @@ -12,7 +12,11 @@ const NewYorkCaption = (props) => {
{fetchedCase?.jurisdiction} {fetchedCase?.venue} -
+
+
+ -----------------------------------------------------------------------X +
+
@@ -44,7 +48,11 @@ const NewYorkCaption = (props) => {
Defendant(s)
-
+
+
+ ----------------------------------------------------------------------------X +
+
diff --git a/src/Components/Modals/CreateModal.js b/src/Components/Modals/CreateModal.js index 776c6c3..d5e341f 100644 --- a/src/Components/Modals/CreateModal.js +++ b/src/Components/Modals/CreateModal.js @@ -11,6 +11,7 @@ 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 "../../styles/modals.scss"; import { getFormDataDefaults, @@ -28,29 +29,10 @@ const CreateModal = ({ setShowModal, caseData }) => { const appUserId = group.appUserId; const editCaseId = caseData?.id; const isEditing = typeof editCaseId !== "undefined"; - - const fields = { - caption: { required: true, maxLength: 45 }, - captionTwo: { required: true, maxLength: 45 }, - caseNumber: { required: true, maxLength: 45 }, - judge: { required: true, maxLength: 45 }, - plaintiffParties: { required: true, maxLength: 45 }, - defendantParties: { required: true, maxLength: 45 }, - jurisdiction: { required: true, maxLength: 45 }, - billingCode: { required: true, maxLength: 45 }, - venue: { required: true, maxLength: 45 }, - caseType: { required: true, maxLength: 45 }, - trialDate: { required: true, maxLength: 45, type: "date" }, - filedDate: { required: true, maxLength: 45, type: "date" }, - contactFirstName: { required: true, maxLength: 45 }, - contactLastName: { required: true, maxLength: 45 }, - contactEmail: { required: true, maxLength: 45, type: "email" }, - leadAttorneys: { required: true, maxLength: 45 }, - lawFirm: { required: false, maxLength: 45 }, - clientPosition: { required: true, default: "Defendant" }, - }; - const [isBusy, setIsBusy] = useState(false); + const [newCaseId, setNewCaseId] = useState(); + const caseNumCopy = + group.state == "New York" ? "Index Number" : "Case Number"; const [data, setData] = useState( getFormDataDefaults(fields, isEditing ? caseData : undefined) ); @@ -69,10 +51,8 @@ const CreateModal = ({ setShowModal, caseData }) => { return hasErrors ? null : objectMap(({ value }) => value, newData); }; - async function saveCaseData() { - const dataValues = validateData(); - - if (dataValues === null) { + async function saveCaseData(dataValues) { + if (isBusy) { return; } setIsBusy(true); @@ -95,6 +75,7 @@ const CreateModal = ({ setShowModal, caseData }) => { const casesRef = collection(db, "cases"); await setDoc(doc(casesRef, `${caseId}`), caseData); setShowModal(false); + return caseId; } catch (err) { console.log("Error creating case:", err); } @@ -110,11 +91,26 @@ const CreateModal = ({ setShowModal, caseData }) => { } }; - const handleCreate = () => { - if (!isBusy) { - void saveCaseData(); + const handleCreateCaseNavigation = (caseId) => { + // console.log("caseId in handleCreateCaseNavigation", caseId); + }; + + const handleCreateCase = (e) => { + e.preventDefault(); + const dataValues = validateData(); + let caseId; + if (dataValues === null) { + return; + } else { + try { + saveCaseData(dataValues).then((res) => { + const caseId = res; + navigate(`/casedetails/${caseId}`); + }); + } catch (err) { + console.log(err); + } } - navigate("/dashboard"); }; const radioOptions = [ @@ -180,7 +176,7 @@ const CreateModal = ({ setShowModal, caseData }) => { {isEditing ? ( -
Index number
+
{caseNumCopy}
) : ( <> )} @@ -548,7 +544,7 @@ const CreateModal = ({ setShowModal, caseData }) => {
diff --git a/src/Constants/Fields/CreateCaseFields.js b/src/Constants/Fields/CreateCaseFields.js new file mode 100644 index 0000000..01e7b0d --- /dev/null +++ b/src/Constants/Fields/CreateCaseFields.js @@ -0,0 +1,20 @@ +export const createCaseFields = { + caption: { required: true, maxLength: 45 }, + captionTwo: { required: true, maxLength: 45 }, + caseNumber: { required: true, maxLength: 45 }, + judge: { required: true, maxLength: 45 }, + plaintiffParties: { required: true, maxLength: 45 }, + defendantParties: { required: true, maxLength: 45 }, + jurisdiction: { required: true, maxLength: 45 }, + billingCode: { required: true, maxLength: 45 }, + venue: { required: true, maxLength: 45 }, + caseType: { required: true, maxLength: 45 }, + trialDate: { required: true, maxLength: 45, type: "date" }, + filedDate: { required: true, maxLength: 45, type: "date" }, + contactFirstName: { required: true, maxLength: 45 }, + contactLastName: { required: true, maxLength: 45 }, + contactEmail: { required: true, maxLength: 45, type: "email" }, + leadAttorneys: { required: true, maxLength: 45 }, + lawFirm: { required: false, maxLength: 45 }, + clientPosition: { required: true, default: "Plaintiff" }, +}; diff --git a/src/Utils/Form.js b/src/Utils/Form.js index 3e44f77..0ac9d9e 100644 --- a/src/Utils/Form.js +++ b/src/Utils/Form.js @@ -96,8 +96,10 @@ export const handleFormDataChange = (e, name, data, fields) => { return null; }; -export const isFormDataHasErrors = (data) => - Object.values(data).reduce( +export const isFormDataHasErrors = (data) => { + console.log("data", data); + return Object.values(data).reduce( (hasErrors, { error }) => hasErrors || error, false ); +}; diff --git a/src/pageElements/Cards.js b/src/pageElements/Cards.js index 90377e8..965e9f7 100644 --- a/src/pageElements/Cards.js +++ b/src/pageElements/Cards.js @@ -4,7 +4,7 @@ import { FileEarmarkText } from "react-bootstrap-icons"; import TextInput from "../pageElements/TextInput"; import Tooltip from "../pageElements/Tooltip"; import { InfoCircle } from "react-bootstrap-icons"; - +import { toDate } from "firebase/firestore"; export const InfoCard = (props) => { const { data, onEdit, onCancel, onSave, onChangeInput, isEditing, isBusy } = props; @@ -273,15 +273,20 @@ export const DocCard = (props) => { handleNavigate, responseGenerations, confirmDelete, + createdAt, } = props; - + const now = new Date().getTime(); + const uploadedAt = createdAt.toDate(); + const isReportable = Math.round((now - uploadedAt) / 60 / 1000) > 15; + const disabled = docType ? false : true; + const tooltipText = + "Parsing is taking a bit longer than usual. This usually resolves within 15 minutes. If it does not, click “report” and support will address the issue within 24 hours."; + const pendingText = + "Parsing in process, please be patient. This should resolve within 10 minutes."; const report = (documentId, docType) => { console.log("report documentId, docType", documentId, docType); }; - const tooltipText = - "Parsing is taking a bit longer than usual. This usually resolves within 10 - 15 minutes. If it does not, click “report” and support will address the issue within 24 hours."; - const disabled = docType ? false : true; return (
@@ -289,7 +294,13 @@ export const DocCard = (props) => {
- {title} {disabled ? : <>} + {title}{" "} + {disabled && isReportable ? : <>} + {disabled && !isReportable ? ( + + ) : ( + <> + )}
{dateServed ? (
Served: {dateServed}
@@ -299,7 +310,7 @@ export const DocCard = (props) => {
{parentCaseName}
- {disabled ? ( + {disabled && isReportable ? (
); }; + +/* + + {disabled ? ( + isReportable ? ( + + ) : ( + + ) + ) : ( + <> + )} + + */ diff --git a/src/pageElements/Tooltip.js b/src/pageElements/Tooltip.js index ba6aa7c..bd10aa8 100644 --- a/src/pageElements/Tooltip.js +++ b/src/pageElements/Tooltip.js @@ -1,18 +1,23 @@ import { useState } from "react"; import "../styles/tooltip.scss"; -import { InfoCircle } from "react-bootstrap-icons"; +import { InfoCircle, Clock } from "react-bootstrap-icons"; function Tooltip(props) { - const [show, setShow] = useState(false); - const { text } = props; + const [showMessage, setShowMessage] = useState(false); + const { text, iconStyle } = props; + const showClock = iconStyle === "clock"; return (
setShow(true)} - onMouseLeave={() => setShow(false)} + onMouseEnter={() => setShowMessage(true)} + onMouseLeave={() => setShowMessage(false)} > - - {show ? {text} : <>} + {showClock ? ( + + ) : ( + + )} + {showMessage ? {text} : <>}
); } diff --git a/src/styles/account-page.scss b/src/styles/account-page.scss index 13e1ed1..7a143bb 100644 --- a/src/styles/account-page.scss +++ b/src/styles/account-page.scss @@ -87,6 +87,10 @@ $account-support-title-padding: 10px; } } +.cancel-sub-button { + width: 165px; +} + .account-support { display: grid; grid-template-columns: 2fr 1fr; diff --git a/src/styles/docedit-page.scss b/src/styles/docedit-page.scss index 6031ef6..12d3818 100644 --- a/src/styles/docedit-page.scss +++ b/src/styles/docedit-page.scss @@ -90,7 +90,8 @@ .docedit-header-row { display: flex; flex-direction: row; - height: 210px; + height: 230px; + margin-bottom: 12px; color: #000000; font-weight: 500; overflow: hidden; @@ -247,7 +248,7 @@ justify-content: center; align-items: center; width: 60%; - margin: 22px auto; + margin: 6px auto; color: #4e4e4e; }