Merge pull request #136 from kjannette/tie

Tie
This commit is contained in:
S Jannette
2024-03-07 15:47:48 -06:00
committed by GitHub
4 changed files with 50 additions and 5 deletions

View File

@@ -45,6 +45,7 @@ const DocEditPage = () => {
); );
const [index, setIndex] = useState(0); const [index, setIndex] = useState(0);
const [isBusy, setIsBusy] = useState(false); const [isBusy, setIsBusy] = useState(false);
const fbUserId = group ? group.fbAuthUid : null;
// For document generation: // For document generation:
const state = group?.state[0] ? group.state[0].code : "ny"; const state = group?.state[0] ? group.state[0].code : "ny";
const lawFirm = group ? group?.firm : null; const lawFirm = group ? group?.firm : null;
@@ -287,6 +288,7 @@ const DocEditPage = () => {
}); });
setResponses(result); setResponses(result);
updateRespGenerationCount(documentId); updateRespGenerationCount(documentId);
updateUserAccountDocsGenerated(fbUserId);
setIsLoading(false); setIsLoading(false);
}) })
.catch((err) => console.log(err)); .catch((err) => console.log(err));
@@ -449,7 +451,19 @@ const DocEditPage = () => {
} }
} }
async function updateUserAccountDocsGenerated(fbUserId) {
await updateDoc(doc(db, "users", fbUserId), {
docsGenerated: increment(1),
});
}
async function updateRespGenerationCount(docId) { async function updateRespGenerationCount(docId) {
console.log("updaeeResponseGenerationCount fired");
if (!docId) {
return;
}
console.log("updaeeResponseGenerationCount past if block");
await updateDoc(doc(db, "documents", docId), { await updateDoc(doc(db, "documents", docId), {
responseGenerations: increment(1), responseGenerations: increment(1),
}); });

View File

@@ -281,7 +281,8 @@ export const DocCard = (props) => {
const now = new Date().getTime(); const now = new Date().getTime();
const uploadedAt = new Date(createdAtTime * 1000); const uploadedAt = new Date(createdAtTime * 1000);
const isReportable = Math.round((now - uploadedAt) / 60 / 1000) > 15; const isReportable = Math.round((now - uploadedAt) / 60 / 1000) > 15;
console.log("responseGenerations", responseGenerations);
console.log("docType", docType);
const disabled = docType ? false : true; const disabled = docType ? false : true;
const tooltipText = 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."; "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.";
@@ -297,9 +298,9 @@ export const DocCard = (props) => {
const isOutbound = docType === "interrogatories-out"; const isOutbound = docType === "interrogatories-out";
const buttonText = const buttonText =
docType === "interrogatories-out" docType === "interrogatories" && responseGenerations > 0
? "Edit Request" ? "Edit Request"
: responseGenerations > 1 : docType === "interrogatories-out"
? "Edit Response" ? "Edit Response"
: "Generate Response"; : "Generate Response";
return ( return (

View File

@@ -1,4 +1,4 @@
import { CircleFill, Circle } from "react-bootstrap-icons"; import { CircleFill, Circle, ExclamationTriangle } from "react-bootstrap-icons";
const Radiogroup = (props) => { const Radiogroup = (props) => {
const { const {
@@ -19,7 +19,23 @@ const Radiogroup = (props) => {
return ( return (
<div className="radio-option-container"> <div className="radio-option-container">
<div className="radio-group-title-box">
{title === "Document type" ? (
<div className="checkbox-title-icon-box">
<ExclamationTriangle
style={{
color: "red",
marginRight: "8px",
marginBottom: "6px",
}}
/>
</div>
) : (
<></>
)}
{title && <div className="checkbox-title">{title}</div>} {title && <div className="checkbox-title">{title}</div>}
</div>
<div className="checkbox-option-div"> <div className="checkbox-option-div">
{options && {options &&
options?.length && options?.length &&

View File

@@ -27,6 +27,20 @@
border-radius: 6px; border-radius: 6px;
box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px; box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
} }
.radio-group-title-box {
display: flex;
flex-direction: row;
align-items: center;
justify-content: left;
}
.checkbox-title-icon-box {
margin-top: 3px;
margin-left: 2px;
margin-right: 1px;
}
.checkbox-option-div { .checkbox-option-div {
display: flex; display: flex;
flex-direction: row; flex-direction: row;