import React from "react"; import Button from "../pageElements/Button.js"; 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; const { caseNumber, caption, jurisdiction, judge, venue, caseType, trialDate, filedDate, contactFirstName, contactLastName, contactEmail, attorneys, parties, } = data; const editingContent = () => { return ( <>
Case caption:
onChangeInput(e, "caption")} />
Jurisdiction:
onChangeInput(e, "jurisdiction")} />
Judge:
onChangeInput(e, "judge")} />
Venue:
onChangeInput(e, "venue")} /> {caseType || isEditing ? ( <>
Case type:
onChangeInput(e, "caseType")} />
) : ( <> )}
Trial date:
onChangeInput(e, "trialDate")} />
Index number:
onChangeInput(e, "caseNumber")} />
Date filed:
onChangeInput(e, "filedDate")} />
Contact: onChangeInput(e, "contactFirstName")} /> onChangeInput(e, "contactLastName")} />
Contact email:
onChangeInput(e, "contactEmail")} />
Lead attorneys:
onChangeInput(e, "attorneys")} />
); }; const infoContent = () => { return ( <>
Case caption:

{caption}

Jurisdiction:

{jurisdiction}

Judge:

{judge}

Venue:

{venue}

{caseType ? (
Case type:

{caseType}

) : ( <> )}
Trial date:

{trialDate}

Index number:

{caseNumber}

Date filed:

{filedDate}

Contact:

{contactFirstName} {contactLastName}

Contact email:

{contactEmail}

Lead attorneys:

{attorneys}

); }; return (
{isEditing ? editingContent() : infoContent()}
{isEditing ? ( <>
); }; export const CaseCard = (props) => { const { caption, captionTwo, caseNumber, filedDate, jurisdiction, caseId, onClick, labelText, } = props; return (
{caption} v. {captionTwo}
{jurisdiction}

{`Filed: ${filedDate}`}

{caseNumber}
); }; export const DocCard = (props) => { const { title, parentCaseNumber, parentCaseName, parentCaseId, documentId, dateServed, docType, displayDeleteButton, handleNavigate, responseGenerations, confirmDelete, createdAt, clientPosition, } = props; const createdAtTime = createdAt?.seconds ? createdAt?.seconds : new Date().getTime(); const now = new Date().getTime(); const uploadedAt = new Date(createdAtTime * 1000); const isReportable = Math.round((now - uploadedAt) / 60 / 1000) > 15; function convertDate(dateVar) { const date = new Date(parseInt(dateVar?.seconds) * 1000); const date2 = date.toLocaleString("en-US", { month: "long" }); const temp = String(date).split(" "); return `${date2} ${temp[2]}, ${temp[3]}`; } 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 documentTitle = docType === "interrogatories-out" ? "Outbound request" : "Discovery response"; const isOutbound = docType === "interrogatories-out"; const buttonText = docType === "interrogatories-out" ? "Edit Request" : "Edit Response"; return (
{documentTitle}{" "} {disabled && isReportable ? : <>} {disabled && !isReportable ? ( ) : ( <> )}
{parentCaseName}
{createdAt ? (
Created: {convertDate(createdAt)}
) : ( <> )} {disabled && isReportable ? (
) : (
{parentCaseNumber}
)}
{displayDeleteButton ? (
); }; /* {disabled ? ( isReportable ? ( ) : ( ) ) : ( <> )} */