import * as React from 'react'; import { Button, FormControl, FormControlLabel, FormLabel, Grid, Paper, Radio, RadioGroup, TextField } from '@mui/material'; import { LocalizationProvider, DatePicker } from '@mui/x-date-pickers'; import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; import { useEffect } from 'react'; interface Patient { fullName: string; homePhone: string; cellPhone: string; email: string; age: number | string; dateOfBirth: string; socialSecurityNumber: string; mailingAddress: string; city: string; state: string; zipCode: string; gender: string; } type Props = { handleFormSection1Data:( fullName?: string|undefined, homePhone?: string|undefined, cellPhone?: string|undefined, email?: string|undefined, age?: number|undefined|string, dateOfBirth?: string|undefined, socialSecurityNumber?: string|undefined, mailingAddress?: string|undefined, city?: string|undefined, state?: string|undefined, zipCode?: string|undefined, gender?: string|undefined, )=> void patientDataDiplay:any; type:string; } export default function PersonalSection({handleFormSection1Data,patientDataDiplay,type}:Props){ const [birthDateValue, setBirthDateValue] = React.useState(); const [patient, setPatient] = React.useState({ fullName: "", homePhone: "", cellPhone: "", email: "", age: 0, dateOfBirth: birthDateValue, socialSecurityNumber: "", mailingAddress:"", city: "", state: "", zipCode: "", gender: "male", }); useEffect(()=>{ handleFormSection1Data( patient.fullName, patient.homePhone, patient.cellPhone, patient.email, patient.age, birthDateValue, patient.socialSecurityNumber, patient.mailingAddress, patient.city, patient.state, patient.zipCode, patient.gender, ) },[patient]) return( <> { setPatient((prevValues) => ({ ...prevValues, fullName: e.target.value, })); }} required /> { setPatient((prevValues) => ({ ...prevValues, cellPhone: e.target.value, })); }} // onBlur={formik.handleBlur} // error={formik.touched.cellPhone && Boolean(formik.errors.cellPhone)} // helperText={formik.touched.cellPhone && formik.errors.cellPhone} /> { setPatient((prevValues) => ({ ...prevValues, homePhone: e.target.value, })); }} // onBlur={formik.handleBlur} // error={formik.touched.homePhone && Boolean(formik.errors.homePhone)} // helperText={formik.touched.homePhone && formik.errors.homePhone} /> { setPatient((prevValues) => ({ ...prevValues, email: e.target.value, })); }} // onBlur={formik.handleBlur} // error={formik.touched.email && Boolean(formik.errors.email)} // helperText={formik.touched.email && formik.errors.email} /> { setPatient((prevValues) => ({ ...prevValues, age: e.target.value, })); }} // onBlur={formik.handleBlur} // error={formik.touched.age && Boolean(formik.errors.age)} // helperText={formik.touched.age && formik.errors.age} /> { setBirthDateValue(newValue); }} renderInput={(params) => } /> { setPatient((prevValues) => ({ ...prevValues, socialSecurityNumber: e.target.value, })); }} // onBlur={formik.handleBlur} // error={formik.touched.socialSecurityNumber && Boolean(formik.errors.socialSecurityNumber)} // helperText={formik.touched.socialSecurityNumber && formik.errors.socialSecurityNumber} /> { setPatient((prevValues) => ({ ...prevValues, mailingAddress: e.target.value, })); }} // onBlur={formik.handleBlur} // error={formik.touched.mailingAddress && Boolean(formik.errors.mailingAddress)} // helperText={formik.touched.mailingAddress && formik.errors.mailingAddress} /> { setPatient((prevValues) => ({ ...prevValues, state: e.target.value, })); }} // onBlur={formik.handleBlur} // error={formik.touched.state && Boolean(formik.errors.state)} // helperText={formik.touched.state && formik.errors.state} /> { setPatient((prevValues) => ({ ...prevValues, city: e.target.value, })); }} // onBlur={formik.handleBlur} // error={formik.touched.city && Boolean(formik.errors.city)} // helperText={formik.touched.city && formik.errors.city} /> { setPatient((prevValues) => ({ ...prevValues, zipCode: e.target.value, })); }} // onBlur={formik.handleBlur} // error={formik.touched.zipCode && Boolean(formik.errors.zipCode)} // helperText={formik.touched.zipCode && formik.errors.zipCode} /> Gender { setPatient((prevValues) => ({ ...prevValues, gender: e.target.value, })); }} sx={{display:'flex', flexDirection:'row'}} > } label="Male" /> } label="Female" /> ) }