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 (
<>
Jurisdiction:
{jurisdiction}
{caseType ? (
) : (
<>>
)}
Index number:
{caseNumber}
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}
{caseNumber}
onClick(caseId)}
labelText={labelText}
className="btn btn-primary view-button"
/>
);
};
export const DocCard = (props) => {
const {
title,
parentCaseNumber,
parentCaseName,
parentCaseId,
documentId,
dateServed,
docType,
displayDeleteButton,
handleNavigate,
responseGenerations,
confirmDelete,
createdAt,
} = 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;
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 requests"
: "Discovery responses";
const isOutbound = docType === "interrogatories-out";
const buttonText =
docType === "interrogatories" && responseGenerations > 0
? "Edit Request"
: docType === "interrogatories-out"
? "Edit Response"
: "Generate Response";
return (
{documentTitle}{" "}
{disabled && isReportable ? : <>>}
{disabled && !isReportable ? (
) : (
<>>
)}
{dateServed ? (
Served: {dateServed}
) : (
<>>
)}
{disabled && isReportable ? (
report(documentId, docType)}
/>
) : (
{parentCaseNumber}
)}
{displayDeleteButton ? (
confirmDelete(documentId, docType, responseGenerations)
}
labelText="Delete"
className="btn btn-primary view-button delete-one"
/>
) : (
<>>
)}
documentId &&
handleNavigate(
documentId,
responseGenerations,
parentCaseId,
docType
)
}
labelText={buttonText}
/>
);
};
/*
{disabled ? (
isReportable ? (
) : (
)
) : (
<>>
)}
*/