more
This commit is contained in:
@@ -4,6 +4,7 @@ import { DetailCard } from "../../pageElements/DetailCard.js";
|
|||||||
import Button from "../../pageElements/Button";
|
import Button from "../../pageElements/Button";
|
||||||
import CreateModal from "../Modals/CreateModal.js";
|
import CreateModal from "../Modals/CreateModal.js";
|
||||||
import UploadModal from "../Modals/UploadModal.js";
|
import UploadModal from "../Modals/UploadModal.js";
|
||||||
|
import ConfirmModal from "../Modals/ConfirmModal.js";
|
||||||
import { db } from "../../firebase";
|
import { db } from "../../firebase";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import { AppContext } from "../../Hooks/useContext/appContext.js";
|
import { AppContext } from "../../Hooks/useContext/appContext.js";
|
||||||
@@ -17,6 +18,7 @@ const CaseDetailsPage = () => {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [showUploadModal, setShowUploadModal] = useState();
|
const [showUploadModal, setShowUploadModal] = useState();
|
||||||
const [showCreateModal, setShowCreateModal] = useState();
|
const [showCreateModal, setShowCreateModal] = useState();
|
||||||
|
const [showConfirmModal, setShowConfirmModal] = useState();
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const { appState } = useContext(AppContext);
|
const { appState } = useContext(AppContext);
|
||||||
const { group } = appState;
|
const { group } = appState;
|
||||||
@@ -64,12 +66,19 @@ const CaseDetailsPage = () => {
|
|||||||
const allowed = Number(temp.docsAllowed);
|
const allowed = Number(temp.docsAllowed);
|
||||||
const generated = Number(temp.docsGenerated);
|
const generated = Number(temp.docsGenerated);
|
||||||
if (allowed - generated > 0) {
|
if (allowed - generated > 0) {
|
||||||
console.log("greater than do some shit");
|
|
||||||
setShowUploadModal(true);
|
setShowUploadModal(true);
|
||||||
} else {
|
} else {
|
||||||
console.log("fuck you");
|
setShowConfirmModal(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleCancelConfirm = () => {
|
||||||
|
setShowConfirmModal(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleConfirmUpgrade = () => {
|
||||||
|
console.log("handle confirm upgrade");
|
||||||
|
};
|
||||||
const handleSuccess = () => {
|
const handleSuccess = () => {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
setShowUploadModal(false);
|
setShowUploadModal(false);
|
||||||
@@ -127,6 +136,7 @@ const CaseDetailsPage = () => {
|
|||||||
|
|
||||||
const showUp = showUploadModal && subCase !== null ? true : false;
|
const showUp = showUploadModal && subCase !== null ? true : false;
|
||||||
const showCreate = showCreateModal && subCase !== null ? true : false;
|
const showCreate = showCreateModal && subCase !== null ? true : false;
|
||||||
|
const showConfirm = showConfirmModal && subCase !== null ? true : false;
|
||||||
return (
|
return (
|
||||||
<div className="details-container">
|
<div className="details-container">
|
||||||
{isLoading ? <LoadingSpinner message={message} /> : null}
|
{isLoading ? <LoadingSpinner message={message} /> : null}
|
||||||
@@ -146,6 +156,18 @@ const CaseDetailsPage = () => {
|
|||||||
<CreateModal setShowModal={setShowCreateModal} caseData={subCase} />
|
<CreateModal setShowModal={setShowCreateModal} caseData={subCase} />
|
||||||
) : null
|
) : null
|
||||||
) : null}
|
) : null}
|
||||||
|
{!isLoading ? (
|
||||||
|
showConfirm ? (
|
||||||
|
<ConfirmModal
|
||||||
|
setShowModal={setShowConfirmModal}
|
||||||
|
onCancel={handleCancelConfirm}
|
||||||
|
onConfirm={handleConfirmUpgrade}
|
||||||
|
modalText="You have used the maximum documents allowed in your current subscription. Upgrade to get more."
|
||||||
|
titleText="No documents remaining"
|
||||||
|
buttonLabelText="Upgrade"
|
||||||
|
/>
|
||||||
|
) : null
|
||||||
|
) : null}
|
||||||
{!isLoading ? (
|
{!isLoading ? (
|
||||||
subCase !== null ? (
|
subCase !== null ? (
|
||||||
<DetailCard data={subCase} />
|
<DetailCard data={subCase} />
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import Modal from "react-bootstrap/Modal";
|
|||||||
import TextInput from "../../pageElements/TextInput";
|
import TextInput from "../../pageElements/TextInput";
|
||||||
|
|
||||||
import { db } from "../../firebase";
|
import { db } from "../../firebase";
|
||||||
|
|
||||||
const ConfirmModal = ({
|
const ConfirmModal = ({
|
||||||
onCancel,
|
onCancel,
|
||||||
onConfirm,
|
onConfirm,
|
||||||
@@ -17,14 +18,16 @@ const ConfirmModal = ({
|
|||||||
issueText,
|
issueText,
|
||||||
setIssueText,
|
setIssueText,
|
||||||
reportDoc,
|
reportDoc,
|
||||||
|
titleText,
|
||||||
}) => {
|
}) => {
|
||||||
|
const title = titleText ? titleText : "Confirmation";
|
||||||
return (
|
return (
|
||||||
<Modal show="true" onHide={onCancel} size="lg">
|
<Modal show="true" onHide={onCancel} size="lg">
|
||||||
<Modal.Header closeButton>
|
<Modal.Header closeButton>
|
||||||
{isReport ? (
|
{isReport ? (
|
||||||
<Modal.Title>Report an issue</Modal.Title>
|
<Modal.Title>Report an issue</Modal.Title>
|
||||||
) : (
|
) : (
|
||||||
<Modal.Title>Confirmation</Modal.Title>
|
<Modal.Title>{title}</Modal.Title>
|
||||||
)}
|
)}
|
||||||
</Modal.Header>
|
</Modal.Header>
|
||||||
<Modal.Body>
|
<Modal.Body>
|
||||||
|
|||||||
Reference in New Issue
Block a user