section 3 data to main
This commit is contained in:
parent
25c213d1f7
commit
f1527188ed
@ -2,19 +2,20 @@ import * as React from 'react';
|
|||||||
import { Checkbox, FormControlLabel, TextField, FormGroup, Grid, FormControl, FormLabel, Radio, RadioGroup } from '@mui/material';
|
import { Checkbox, FormControlLabel, TextField, FormGroup, Grid, FormControl, FormLabel, Radio, RadioGroup } from '@mui/material';
|
||||||
import { useFormik } from 'formik';
|
import { useFormik } from 'formik';
|
||||||
import * as Yup from 'yup';
|
import * as Yup from 'yup';
|
||||||
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
interface FormValues {
|
interface Patient {
|
||||||
physicianname: string;
|
physicianname: string |undefined;
|
||||||
physiciancity: string;
|
physiciancity: string |undefined;
|
||||||
physicianstate: string;
|
physicianstate: string |undefined;
|
||||||
physicianphone: string;
|
physicianphone: string |undefined;
|
||||||
chiropractorName: string;
|
chiropractorName: string |undefined;
|
||||||
chiropractorState: string;
|
chiropractorState: string |undefined;
|
||||||
xray: boolean;
|
xray: string|undefined;
|
||||||
ctScan: boolean;
|
haveChiropractor: string|undefined;
|
||||||
cdImages: boolean;
|
reference: string|undefined;
|
||||||
visitDetails: string;
|
visitDetails: string |undefined;
|
||||||
cellPhoneProvider: string;
|
cellPhoneProvider: string |undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const validationSchema = Yup.object({
|
const validationSchema = Yup.object({
|
||||||
@ -24,35 +25,61 @@ const validationSchema = Yup.object({
|
|||||||
phone: Yup.string().required('Required'),
|
phone: Yup.string().required('Required'),
|
||||||
chiropractorName: Yup.string().required('Required'),
|
chiropractorName: Yup.string().required('Required'),
|
||||||
xray: Yup.boolean().required('Required'),
|
xray: Yup.boolean().required('Required'),
|
||||||
ctScan: Yup.boolean().required('Required'),
|
haveChiropractor: Yup.boolean().required('Required'),
|
||||||
cdImages: Yup.boolean().required('Required'),
|
reference: Yup.boolean().required('Required'),
|
||||||
visitDetails: Yup.string().required('Required'),
|
visitDetails: Yup.string().required('Required'),
|
||||||
cellPhoneProvider: Yup.string().required('Required'),
|
cellPhoneProvider: Yup.string().required('Required'),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default function MedicalHistoryForm(){
|
type Props = {
|
||||||
const formik = useFormik<FormValues>({
|
handleFormSection3Data:(
|
||||||
initialValues:{
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function MedicalHistoryForm({handleFormSection3Data}:Props){
|
||||||
|
|
||||||
|
const [patient, setPatient] = React.useState<Patient>({
|
||||||
physicianname: '',
|
physicianname: '',
|
||||||
physiciancity: '',
|
physiciancity: '',
|
||||||
physicianstate: '',
|
physicianstate: '',
|
||||||
physicianphone: '',
|
physicianphone: '',
|
||||||
chiropractorName: '',
|
chiropractorName: '',
|
||||||
chiropractorState: '',
|
chiropractorState: '',
|
||||||
xray: false,
|
xray: '',
|
||||||
ctScan: false,
|
haveChiropractor: '',
|
||||||
cdImages: false,
|
reference: '',
|
||||||
visitDetails: '',
|
visitDetails: '',
|
||||||
cellPhoneProvider: '',
|
cellPhoneProvider: '',
|
||||||
},
|
});
|
||||||
validationSchema,
|
|
||||||
onSubmit:(values)=>{
|
useEffect(()=>{
|
||||||
console.log(values);
|
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(
|
return(
|
||||||
<>
|
<>
|
||||||
<form onSubmit={formik.handleSubmit}>
|
|
||||||
<Grid item xs={12} className='collapsable-form-style '>
|
<Grid item xs={12} className='collapsable-form-style '>
|
||||||
<FormLabel sx={{fontWeight:600}}>Physician Hisory Information:</FormLabel>
|
<FormLabel sx={{fontWeight:600}}>Physician Hisory Information:</FormLabel>
|
||||||
</Grid>
|
</Grid>
|
||||||
@ -63,9 +90,14 @@ export default function MedicalHistoryForm(){
|
|||||||
variant="outlined"
|
variant="outlined"
|
||||||
label="Family physician"
|
label="Family physician"
|
||||||
name='physicianname'
|
name='physicianname'
|
||||||
onChange={formik.handleChange}
|
onChange={(e)=>{
|
||||||
value={formik.values.physicianname}
|
setPatient((prevValues) => ({
|
||||||
onBlur={formik.handleBlur}
|
...prevValues,
|
||||||
|
physicianname: e.target.value,
|
||||||
|
}));
|
||||||
|
}}
|
||||||
|
value={patient.physicianname}
|
||||||
|
// onBlur={formik.handleBlur}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={4} className='collapsable-form-style'>
|
<Grid item xs={4} className='collapsable-form-style'>
|
||||||
@ -73,9 +105,14 @@ export default function MedicalHistoryForm(){
|
|||||||
variant="outlined"
|
variant="outlined"
|
||||||
label="City"
|
label="City"
|
||||||
name='physiciancity'
|
name='physiciancity'
|
||||||
onChange={formik.handleChange}
|
onChange={(e)=>{
|
||||||
value={formik.values.physiciancity}
|
setPatient((prevValues) => ({
|
||||||
onBlur={formik.handleBlur}
|
...prevValues,
|
||||||
|
physiciancity: e.target.value,
|
||||||
|
}));
|
||||||
|
}}
|
||||||
|
value={patient.physiciancity}
|
||||||
|
// onBlur={formik.handleBlur}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={4} className='collapsable-form-style'>
|
<Grid item xs={4} className='collapsable-form-style'>
|
||||||
@ -83,9 +120,14 @@ export default function MedicalHistoryForm(){
|
|||||||
variant="outlined"
|
variant="outlined"
|
||||||
label="State"
|
label="State"
|
||||||
name='physicianstate'
|
name='physicianstate'
|
||||||
onChange={formik.handleChange}
|
onChange={(e)=>{
|
||||||
value={formik.values.physicianstate}
|
setPatient((prevValues) => ({
|
||||||
onBlur={formik.handleBlur}
|
...prevValues,
|
||||||
|
physicianstate: e.target.value,
|
||||||
|
}));
|
||||||
|
}}
|
||||||
|
value={patient.physicianstate}
|
||||||
|
// onBlur={formik.handleBlur}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={4} className='collapsable-form-style'>
|
<Grid item xs={4} className='collapsable-form-style'>
|
||||||
@ -94,9 +136,14 @@ export default function MedicalHistoryForm(){
|
|||||||
label="Phone"
|
label="Phone"
|
||||||
type="number"
|
type="number"
|
||||||
name='physicianphone'
|
name='physicianphone'
|
||||||
onChange={formik.handleChange}
|
onChange={(e)=>{
|
||||||
value={formik.values.physicianphone}
|
setPatient((prevValues) => ({
|
||||||
onBlur={formik.handleBlur}
|
...prevValues,
|
||||||
|
physicianphone: e.target.value,
|
||||||
|
}));
|
||||||
|
}}
|
||||||
|
value={patient.physicianphone}
|
||||||
|
// onBlur={formik.handleBlur}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
@ -115,7 +162,12 @@ export default function MedicalHistoryForm(){
|
|||||||
aria-labelledby="demo-radio-buttons-group-label"
|
aria-labelledby="demo-radio-buttons-group-label"
|
||||||
// defaultValue="yes"
|
// defaultValue="yes"
|
||||||
name="radio-buttons-group"
|
name="radio-buttons-group"
|
||||||
onChange={formik.handleChange}
|
onChange={(e)=>{
|
||||||
|
setPatient((prevValues) => ({
|
||||||
|
...prevValues,
|
||||||
|
haveChiropractor: e.target.value,
|
||||||
|
}));
|
||||||
|
}}
|
||||||
sx={{display:'flex', flexDirection:'row'}}
|
sx={{display:'flex', flexDirection:'row'}}
|
||||||
>
|
>
|
||||||
<FormControlLabel value="yes" control={<Radio />} label="Yes" />
|
<FormControlLabel value="yes" control={<Radio />} label="Yes" />
|
||||||
@ -129,9 +181,14 @@ export default function MedicalHistoryForm(){
|
|||||||
variant="outlined"
|
variant="outlined"
|
||||||
label="Chiropractor's Name"
|
label="Chiropractor's Name"
|
||||||
name='chiropractorName'
|
name='chiropractorName'
|
||||||
onChange={formik.handleChange}
|
onChange={(e)=>{
|
||||||
value={formik.values.chiropractorName}
|
setPatient((prevValues) => ({
|
||||||
onBlur={formik.handleBlur}
|
...prevValues,
|
||||||
|
chiropractorName: e.target.value,
|
||||||
|
}));
|
||||||
|
}}
|
||||||
|
value={patient.chiropractorName}
|
||||||
|
// onBlur={formik.handleBlur}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
@ -140,9 +197,14 @@ export default function MedicalHistoryForm(){
|
|||||||
variant="outlined"
|
variant="outlined"
|
||||||
label="City/State"
|
label="City/State"
|
||||||
name='chiropractorState'
|
name='chiropractorState'
|
||||||
onChange={formik.handleChange}
|
onChange={(e)=>{
|
||||||
value={formik.values.chiropractorState}
|
setPatient((prevValues) => ({
|
||||||
onBlur={formik.handleBlur}
|
...prevValues,
|
||||||
|
chiropractorState: e.target.value,
|
||||||
|
}));
|
||||||
|
}}
|
||||||
|
value={patient.chiropractorState}
|
||||||
|
// onBlur={formik.handleBlur}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
@ -155,7 +217,12 @@ export default function MedicalHistoryForm(){
|
|||||||
aria-labelledby="demo-radio-buttons-group-label"
|
aria-labelledby="demo-radio-buttons-group-label"
|
||||||
// defaultValue="yes"
|
// defaultValue="yes"
|
||||||
name="radio-buttons-group"
|
name="radio-buttons-group"
|
||||||
onChange={formik.handleChange}
|
onChange={(e)=>{
|
||||||
|
setPatient((prevValues) => ({
|
||||||
|
...prevValues,
|
||||||
|
xray: e.target.value,
|
||||||
|
}));
|
||||||
|
}}
|
||||||
sx={{display:'flex', flexDirection:'row'}}
|
sx={{display:'flex', flexDirection:'row'}}
|
||||||
>
|
>
|
||||||
<FormControlLabel value="yes" control={<Radio />} label="Yes" />
|
<FormControlLabel value="yes" control={<Radio />} label="Yes" />
|
||||||
@ -172,7 +239,12 @@ export default function MedicalHistoryForm(){
|
|||||||
aria-labelledby="demo-radio-buttons-group-label"
|
aria-labelledby="demo-radio-buttons-group-label"
|
||||||
// defaultValue="physician"
|
// defaultValue="physician"
|
||||||
name="radio-buttons-group"
|
name="radio-buttons-group"
|
||||||
onChange={formik.handleChange}
|
onChange={(e)=>{
|
||||||
|
setPatient((prevValues) => ({
|
||||||
|
...prevValues,
|
||||||
|
reference: e.target.value,
|
||||||
|
}));
|
||||||
|
}}
|
||||||
sx={{display:'flex', flexDirection:'row'}}
|
sx={{display:'flex', flexDirection:'row'}}
|
||||||
>
|
>
|
||||||
<FormControlLabel value="friend" control={<Radio />} label="Friend" />
|
<FormControlLabel value="friend" control={<Radio />} label="Friend" />
|
||||||
@ -193,7 +265,12 @@ export default function MedicalHistoryForm(){
|
|||||||
aria-labelledby="demo-radio-buttons-group-label"
|
aria-labelledby="demo-radio-buttons-group-label"
|
||||||
// defaultValue="email"
|
// defaultValue="email"
|
||||||
name="radio-buttons-group"
|
name="radio-buttons-group"
|
||||||
onChange={formik.handleChange}
|
onChange={(e)=>{
|
||||||
|
setPatient((prevValues) => ({
|
||||||
|
...prevValues,
|
||||||
|
cellPhoneProvider: e.target.value,
|
||||||
|
}));
|
||||||
|
}}
|
||||||
sx={{display:'flex', flexDirection:'row'}}
|
sx={{display:'flex', flexDirection:'row'}}
|
||||||
>
|
>
|
||||||
<FormControlLabel value="email" control={<Radio />} label="Email" />
|
<FormControlLabel value="email" control={<Radio />} label="Email" />
|
||||||
@ -201,7 +278,6 @@ export default function MedicalHistoryForm(){
|
|||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</Grid>
|
</Grid>
|
||||||
</form>
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@ -79,6 +79,7 @@ export default function PatientForm(){
|
|||||||
const [signature,setSignature]=React.useState('');
|
const [signature,setSignature]=React.useState('');
|
||||||
const [section1Data, setSection1Data] = React.useState<any>({});
|
const [section1Data, setSection1Data] = React.useState<any>({});
|
||||||
const [section2Data, setSection2Data] = React.useState<any>({});
|
const [section2Data, setSection2Data] = React.useState<any>({});
|
||||||
|
const [section3Data, setSection3Data] = React.useState<any>({});
|
||||||
|
|
||||||
const handleFormSection1Data = (
|
const handleFormSection1Data = (
|
||||||
fullName?: string|undefined,
|
fullName?: string|undefined,
|
||||||
@ -140,6 +141,34 @@ export default function PatientForm(){
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const 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,
|
||||||
|
) =>{
|
||||||
|
setSection3Data({
|
||||||
|
physicianname,
|
||||||
|
physiciancity,
|
||||||
|
physicianstate,
|
||||||
|
physicianphone,
|
||||||
|
chiropractorName,
|
||||||
|
chiropractorState,
|
||||||
|
xray,
|
||||||
|
haveChiropractor,
|
||||||
|
reference,
|
||||||
|
visitDetails,
|
||||||
|
cellPhoneProvider,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
|
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
};
|
};
|
||||||
@ -153,7 +182,7 @@ export default function PatientForm(){
|
|||||||
setIsChecked(event.target.checked);
|
setIsChecked(event.target.checked);
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(section1Data,"wyeytweevfde",section2Data)
|
console.log(section3Data,"wyeytweevfde",section2Data)
|
||||||
|
|
||||||
|
|
||||||
return(
|
return(
|
||||||
@ -198,7 +227,7 @@ export default function PatientForm(){
|
|||||||
</AccordionSummary>
|
</AccordionSummary>
|
||||||
|
|
||||||
<AccordionDetails>
|
<AccordionDetails>
|
||||||
<MedicalHistory/>
|
<MedicalHistory handleFormSection3Data={handleFormSection3Data}/>
|
||||||
</AccordionDetails>
|
</AccordionDetails>
|
||||||
</Accordion>
|
</Accordion>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user