import { Button, Checkbox, FormControl, FormControlLabel, FormGroup, FormLabel, Grid, Paper, Radio, RadioGroup, TextField, } from '@mui/material'; import { useFormik } from 'formik'; import * as yup from 'yup'; import { LocalizationProvider, DatePicker } from '@mui/x-date-pickers'; import React, { useEffect } from 'react'; interface Patient { maritalStatus: string | undefined; numberOfChildren: string | undefined; occupation: string | undefined; hoursPerWeek: number | string | undefined; employer: string | undefined; businessPhone: string | undefined; spouseName: string | undefined; spouseEmployer: string | undefined; spouseBusinessPhone: string | undefined; emergencyContact: string | undefined; relationship: string | undefined; spousePhone: string | undefined; } type Props = { handleFormSection2Data: ( maritalStatus: string | undefined, numberOfChildren: string | undefined, occupation: string | undefined, hoursPerWeek: number | string | undefined, employer: string | undefined, businessPhone: string | undefined, spouseName: string | undefined, spouseEmployer: string | undefined, spouseBusinessPhone: string | undefined, emergencyContact: string | undefined, relationship: string | undefined, spousePhone: string | undefined ) => void; patientDataDiplay: any; type: string; }; export default function FamilyFormSection({ handleFormSection2Data, patientDataDiplay, type, }: Props) { const [patient, setPatient] = React.useState({ maritalStatus: '', numberOfChildren: '', occupation: '', hoursPerWeek: '', employer: '', businessPhone: '', spouseName: '', spouseEmployer: '', spouseBusinessPhone: '', emergencyContact: '', relationship: '', spousePhone: '', }); useEffect(() => { handleFormSection2Data( patient.maritalStatus, patient.numberOfChildren, patient.occupation, patient.hoursPerWeek, patient.employer, patient.businessPhone, patient.spouseName, patient.spouseEmployer, patient.spouseBusinessPhone, patient.emergencyContact, patient.relationship, patient.spousePhone ); }, [patient]); return ( <> Marital Status { setPatient((prevValues: any) => ({ ...prevValues, maritalStatus: e.target.value, })); }} > } label='Married' disabled={type == 'display'} /> } label='Single' disabled={type == 'display'} /> } label='Widowed' disabled={type == 'display'} /> } label='Seperated' disabled={type == 'display'} /> } label='Divorced' disabled={type == 'display'} /> { setPatient((prevValues: any) => ({ ...prevValues, numberOfChildren: e.target.value, })); }} value={ type == 'display' ? patientDataDiplay.numberOfChildren : patient.numberOfChildren } disabled={type == 'display'} /> { setPatient((prevValues: any) => ({ ...prevValues, occupation: e.target.value, })); }} value={ type == 'display' ? patientDataDiplay.occupation : patient.occupation } disabled={type == 'display'} /> { setPatient((prevValues: any) => ({ ...prevValues, hoursPerWeek: e.target.value, })); }} value={ type == 'display' ? patientDataDiplay.hoursPerWeek : patient.hoursPerWeek } disabled={type == 'display'} /> { setPatient((prevValues: any) => ({ ...prevValues, employer: e.target.value, })); }} value={ type == 'display' ? patientDataDiplay.employer : patient.employer } disabled={type == 'display'} /> { setPatient((prevValues: any) => ({ ...prevValues, businessPhone: e.target.value, })); }} value={ type == 'display' ? patientDataDiplay.businessPhone : patient.businessPhone } disabled={type == 'display'} /> Spouse's Information: { setPatient((prevValues: any) => ({ ...prevValues, spouseName: e.target.value, })); }} value={ type == 'display' ? patientDataDiplay.spouseName : patient.spouseName } disabled={type == 'display'} /> { setPatient((prevValues: any) => ({ ...prevValues, spouseEmployer: e.target.value, })); }} value={ type == 'display' ? patientDataDiplay.spouseEmployer : patient.spouseEmployer } disabled={type == 'display'} /> { setPatient((prevValues: any) => ({ ...prevValues, spouseBusinessPhone: e.target.value, })); }} value={ type == 'display' ? patientDataDiplay.spouseBusinessPhone : patient.spouseBusinessPhone } disabled={type == 'display'} /> Emergency: { setPatient((prevValues: any) => ({ ...prevValues, emergencyContact: e.target.value, })); }} value={ type == 'display' ? patientDataDiplay.emergencyContact : patient.emergencyContact } disabled={type == 'display'} /> { setPatient((prevValues: any) => ({ ...prevValues, relationship: e.target.value, })); }} value={ type == 'display' ? patientDataDiplay.relationship : patient.relationship } disabled={type == 'display'} /> { setPatient((prevValues: any) => ({ ...prevValues, spousePhone: e.target.value, })); }} value={ type == 'display' ? patientDataDiplay.spousePhone : patient.spousePhone } disabled={type == 'display'} /> ); }