diff --git a/package.json b/package.json index 78d6670..0807c41 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "@emotion/styled": "^11.13.0", "@hookform/resolvers": "^3.9.0", "@mui/icons-material": "^6.1.5", - "@mui/material": "^6.1.2", + "@mui/material": "^6.1.3", "@mui/material-nextjs": "^6.1.2", "@mui/x-date-pickers": "^7.21.0", "libphonenumber-js": "^1.11.12", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b8d20ff..bbf1c31 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -24,7 +24,7 @@ importers: specifier: ^6.1.5 version: 6.1.5(@mui/material@6.1.3(@emotion/react@11.13.3(@types/react@18.3.11)(react@18.3.1))(@emotion/styled@11.13.0(@emotion/react@11.13.3(@types/react@18.3.11)(react@18.3.1))(@types/react@18.3.11)(react@18.3.1))(@types/react@18.3.11)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@types/react@18.3.11)(react@18.3.1) '@mui/material': - specifier: ^6.1.2 + specifier: ^6.1.3 version: 6.1.3(@emotion/react@11.13.3(@types/react@18.3.11)(react@18.3.1))(@emotion/styled@11.13.0(@emotion/react@11.13.3(@types/react@18.3.11)(react@18.3.1))(@types/react@18.3.11)(react@18.3.1))(@types/react@18.3.11)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@mui/material-nextjs': specifier: ^6.1.2 diff --git a/src/components/InvitationInfoModal/index.tsx b/src/components/InvitationInfoModal/index.tsx new file mode 100644 index 0000000..7cf8116 --- /dev/null +++ b/src/components/InvitationInfoModal/index.tsx @@ -0,0 +1,151 @@ +"use client"; + +import InfoIcon from "@mui/icons-material/Info"; +import Box from "@mui/material/Box"; +import Button from "@mui/material/Button"; +import Fade from "@mui/material/Fade"; +import Modal from "@mui/material/Modal"; +import Typography from "@mui/material/Typography"; +import { useState } from "react"; + +import { EnrollmentForm } from "@/types"; + +type InvitationInfoModalProps = { + enrollmentForm: EnrollmentForm; +}; + +// Define the styling for the modal content +const style = { + position: "absolute", + top: "50%", + left: "50%", + transform: "translate(-50%, -50%)", + width: "40vw", + maxHeight: "80vh", + overflowY: "auto", + bgcolor: "background.paper", + boxShadow: 2, + p: 4, +}; + +// Functional component for the Invitation Info Modal +export default function InvitationInfoModal({ + enrollmentForm, +}: InvitationInfoModalProps) { + // State to manage the open/closed status of the modal + const [open, setOpen] = useState(false); + + // Handlers to open and close the modal + const handleOpen = () => setOpen(true); + const handleClose = () => setOpen(false); + + // Array of key-value pairs to simplify rendering + const formFields = [ + { label: "ID", value: enrollmentForm._id }, + { label: "Date Created", value: enrollmentForm.dateCreated }, + { label: "First Name", value: enrollmentForm.firstName }, + { label: "Last Name", value: enrollmentForm.lastName }, + { label: "Email", value: enrollmentForm.email }, + { label: "Address", value: enrollmentForm.address }, + { label: "Phone Number", value: enrollmentForm.phoneNumber }, + { label: "Date of Birth", value: enrollmentForm.dateOfBirth }, + { label: "Health Conditions", value: enrollmentForm.healthConditions }, + { label: "Referral Source", value: enrollmentForm.referralSource }, + { label: "Weight", value: enrollmentForm.healthMetrics?.weight }, + { + label: "Blood Pressure", + value: enrollmentForm.healthMetrics?.bloodPressure, + }, + { label: "Cholesterol", value: enrollmentForm.healthMetrics?.cholesterol }, + { label: "A1C", value: enrollmentForm.healthMetrics?.a1c }, + { + label: "Short Term Health Goal", + value: enrollmentForm.healthGoals?.shortTerm, + }, + { + label: "Long Term Health Goal", + value: enrollmentForm.healthGoals?.longTerm, + }, + ]; + + return ( +