import * as React from 'react'; import { Checkbox, FormControlLabel, TextField, FormGroup, Grid, FormControl, FormLabel, Radio, RadioGroup } from '@mui/material'; import { useFormik } from 'formik'; import * as Yup from 'yup'; import { useEffect } from 'react'; interface Patient { physicianname: string |undefined; physiciancity: string |undefined; physicianstate: string |undefined; physicianphone: string |undefined; chiropractorName: string |undefined; chiropractorState: string |undefined; xray: string|undefined; haveChiropractor: string|undefined; reference: string|undefined; visitDetails: string |undefined; cellPhoneProvider: string |undefined; } type Props = { handleFormSection3Data:( physicianname?: string |undefined, physiciancity?: string |undefined, physicianstate?: string |undefined, physicianphone?: string |undefined, chiropractorName?: string |undefined, chiropractorState?: string |undefined, xray?: string|undefined, haveChiropractor?: string|undefined, reference?: string|undefined, visitDetails?: string |undefined, cellPhoneProvider?: string |undefined, )=> void patientDataDiplay:any; type:string; } export default function MedicalHistoryForm({handleFormSection3Data,patientDataDiplay,type}:Props){ const [patient, setPatient] = React.useState({ physicianname: '', physiciancity: '', physicianstate: '', physicianphone: '', chiropractorName: '', chiropractorState: '', xray: '', haveChiropractor: '', reference: '', visitDetails: '', cellPhoneProvider: '', }); useEffect(()=>{ handleFormSection3Data( patient.physicianname, patient.physiciancity, patient.physicianstate, patient.physicianphone, patient.chiropractorName, patient.chiropractorState, patient.xray, patient.haveChiropractor, patient.reference, patient.visitDetails, patient.cellPhoneProvider, ) },[patient]) return( <> Physician Hisory Information: { setPatient((prevValues) => ({ ...prevValues, physicianname: e.target.value, })); }} value={type=='display'? patientDataDiplay && patientDataDiplay.physicianname:patient.physicianname} disabled={type=='display'} /> { setPatient((prevValues) => ({ ...prevValues, physiciancity: e.target.value, })); }} value={type=='display'? patientDataDiplay && patientDataDiplay.physiciancity:patient.physiciancity} disabled={type=='display'} /> { setPatient((prevValues) => ({ ...prevValues, physicianstate: e.target.value, })); }} value={type=='display'? patientDataDiplay && patientDataDiplay.physicianstate:patient.physicianstate} disabled={type=='display'} /> { setPatient((prevValues) => ({ ...prevValues, physicianphone: e.target.value, })); }} value={type=='display'? patientDataDiplay && patientDataDiplay.physicianphone:patient.physicianphone} disabled={type=='display'} /> Chiropractor Information: Previous Chiropractic Care: { setPatient((prevValues) => ({ ...prevValues, haveChiropractor: e.target.value, })); }} sx={{display:'flex', flexDirection:'row'}} > } label="Yes" /> } label="No" /> { setPatient((prevValues) => ({ ...prevValues, chiropractorName: e.target.value, })); }} value={type=='display'? patientDataDiplay && patientDataDiplay.chiropractorName:patient.chiropractorName} disabled={type=='display'} /> { setPatient((prevValues) => ({ ...prevValues, chiropractorState: e.target.value, })); }} value={type=='display'? patientDataDiplay && patientDataDiplay.chiropractorState:patient.chiropractorState} disabled={type=='display'} /> Have you had an X-ray/CT Scan within the last 12 months? If yes, did you bring the CD of images for the doctor to review? { setPatient((prevValues) => ({ ...prevValues, xray: e.target.value, })); }} sx={{display:'flex', flexDirection:'row'}} > } label="Yes" /> } label="No" /> Who can we thank for referring you to our office: { setPatient((prevValues) => ({ ...prevValues, reference: e.target.value, })); }} sx={{display:'flex', flexDirection:'row'}} > } label="Friend" /> } label="Relative" /> } label="Physician" /> } label="Instagram" /> } label="Google" /> } label="Others" /> How do you prefer to be reminded of your appointments? { setPatient((prevValues) => ({ ...prevValues, cellPhoneProvider: e.target.value, })); }} sx={{display:'flex', flexDirection:'row'}} > } label="Email" /> } label="Text" /> )}