section 7 data to main
This commit is contained in:
parent
9b3444a4f6
commit
867dac8327
@ -83,6 +83,7 @@ export default function PatientForm(){
|
|||||||
const [section4Data, setSection4Data] = React.useState<any>({});
|
const [section4Data, setSection4Data] = React.useState<any>({});
|
||||||
const [section5Data, setSection5Data] = React.useState<any>({});
|
const [section5Data, setSection5Data] = React.useState<any>({});
|
||||||
const [section6Data, setSection6Data] = React.useState<any>({});
|
const [section6Data, setSection6Data] = React.useState<any>({});
|
||||||
|
const [section7Data, setSection7Data] = React.useState<any>({});
|
||||||
|
|
||||||
const handleFormSection1Data = (
|
const handleFormSection1Data = (
|
||||||
fullName?: string|undefined,
|
fullName?: string|undefined,
|
||||||
@ -268,6 +269,49 @@ export default function PatientForm(){
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const handleFormSection7Data = (
|
||||||
|
hobbies: string|undefined,
|
||||||
|
educationLevel: string|undefined,
|
||||||
|
excercise: string|undefined,
|
||||||
|
excerciseExplanation: string|undefined,
|
||||||
|
tobacco: string|undefined,
|
||||||
|
tobaccoExplanation: string|undefined,
|
||||||
|
alcohol: string|undefined,
|
||||||
|
alcoholExplanation: string|undefined,
|
||||||
|
healthyDiet: string|undefined,
|
||||||
|
healthyDietExplanation: string|undefined,
|
||||||
|
sleep: string|undefined,
|
||||||
|
sleepExplanation: string|undefined,
|
||||||
|
workSchool: string|undefined,
|
||||||
|
workSchoolExplanation: string|undefined,
|
||||||
|
familyLife: string|undefined,
|
||||||
|
familyLifeExplanation: string|undefined,
|
||||||
|
drugs: string|undefined,
|
||||||
|
drugsExplanation:string|undefined,
|
||||||
|
) =>{
|
||||||
|
setSection7Data({
|
||||||
|
hobbies,
|
||||||
|
educationLevel,
|
||||||
|
excercise,
|
||||||
|
excerciseExplanation,
|
||||||
|
tobacco,
|
||||||
|
tobaccoExplanation,
|
||||||
|
alcohol,
|
||||||
|
alcoholExplanation,
|
||||||
|
healthyDiet,
|
||||||
|
healthyDietExplanation,
|
||||||
|
sleep,
|
||||||
|
sleepExplanation,
|
||||||
|
workSchool,
|
||||||
|
workSchoolExplanation,
|
||||||
|
familyLife,
|
||||||
|
familyLifeExplanation,
|
||||||
|
drugs,
|
||||||
|
drugsExplanation,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
|
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
};
|
};
|
||||||
@ -281,7 +325,7 @@ export default function PatientForm(){
|
|||||||
setIsChecked(event.target.checked);
|
setIsChecked(event.target.checked);
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log("wyeytweevfde",section6Data)
|
console.log("wyeytweevfde",section7Data)
|
||||||
|
|
||||||
|
|
||||||
return(
|
return(
|
||||||
@ -366,7 +410,7 @@ export default function PatientForm(){
|
|||||||
</AccordionSummary>
|
</AccordionSummary>
|
||||||
|
|
||||||
<AccordionDetails>
|
<AccordionDetails>
|
||||||
<RecreationalHobbiesSection7/>
|
<RecreationalHobbiesSection7 handleFormSection7Data={handleFormSection7Data}/>
|
||||||
</AccordionDetails>
|
</AccordionDetails>
|
||||||
</Accordion>
|
</Accordion>
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { FormControl, FormControlLabel, FormLabel, Grid, Radio, RadioGroup, TextField } from "@mui/material";
|
import { FormControl, FormControlLabel, FormLabel, Grid, Radio, RadioGroup, TextField } from "@mui/material";
|
||||||
import React from "react";
|
import React, { useEffect } from "react";
|
||||||
|
|
||||||
interface FormValues {
|
interface Patient {
|
||||||
hobbies: string;
|
hobbies: string;
|
||||||
educationLevel: string;
|
educationLevel: string;
|
||||||
excercise: string;
|
excercise: string;
|
||||||
@ -22,8 +22,31 @@ interface FormValues {
|
|||||||
drugsExplanation:string;
|
drugsExplanation:string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function RecreationalHobbiesSection7(){
|
type Props = {
|
||||||
const [values, setValues] = React.useState<FormValues>({
|
handleFormSection7Data:(
|
||||||
|
hobbies: string|undefined,
|
||||||
|
educationLevel: string|undefined,
|
||||||
|
excercise: string|undefined,
|
||||||
|
excerciseExplanation: string|undefined,
|
||||||
|
tobacco: string|undefined,
|
||||||
|
tobaccoExplanation: string|undefined,
|
||||||
|
alcohol: string|undefined,
|
||||||
|
alcoholExplanation: string|undefined,
|
||||||
|
healthyDiet: string|undefined,
|
||||||
|
healthyDietExplanation: string|undefined,
|
||||||
|
sleep: string|undefined,
|
||||||
|
sleepExplanation: string|undefined,
|
||||||
|
workSchool: string|undefined,
|
||||||
|
workSchoolExplanation: string|undefined,
|
||||||
|
familyLife: string|undefined,
|
||||||
|
familyLifeExplanation: string|undefined,
|
||||||
|
drugs: string|undefined,
|
||||||
|
drugsExplanation:string|undefined,
|
||||||
|
)=> void
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function RecreationalHobbiesSection7({handleFormSection7Data}:Props){
|
||||||
|
const [patient, setPatient] = React.useState<Patient>({
|
||||||
hobbies: '',
|
hobbies: '',
|
||||||
educationLevel: '',
|
educationLevel: '',
|
||||||
excercise:'',
|
excercise:'',
|
||||||
@ -43,6 +66,31 @@ export default function RecreationalHobbiesSection7(){
|
|||||||
drugs: '',
|
drugs: '',
|
||||||
drugsExplanation:''
|
drugsExplanation:''
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
handleFormSection7Data(
|
||||||
|
patient.hobbies,
|
||||||
|
patient.educationLevel,
|
||||||
|
patient.excercise,
|
||||||
|
patient.excerciseExplanation,
|
||||||
|
patient.tobacco,
|
||||||
|
patient.tobaccoExplanation,
|
||||||
|
patient.alcohol,
|
||||||
|
patient.alcoholExplanation,
|
||||||
|
patient.healthyDiet,
|
||||||
|
patient.healthyDietExplanation,
|
||||||
|
patient.sleep,
|
||||||
|
patient.sleepExplanation,
|
||||||
|
patient.workSchool,
|
||||||
|
patient.workSchoolExplanation,
|
||||||
|
patient.familyLife,
|
||||||
|
patient.familyLifeExplanation,
|
||||||
|
patient.drugs,
|
||||||
|
patient.drugsExplanation
|
||||||
|
)
|
||||||
|
},[patient])
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<>
|
<>
|
||||||
|
|
||||||
@ -55,7 +103,7 @@ export default function RecreationalHobbiesSection7(){
|
|||||||
label=""
|
label=""
|
||||||
name='explanation'
|
name='explanation'
|
||||||
onChange={(event:any) => {
|
onChange={(event:any) => {
|
||||||
setValues((prevValues) => ({
|
setPatient((prevValues) => ({
|
||||||
...prevValues,
|
...prevValues,
|
||||||
hobbies: event.target.value,
|
hobbies: event.target.value,
|
||||||
}));
|
}));
|
||||||
@ -69,7 +117,7 @@ export default function RecreationalHobbiesSection7(){
|
|||||||
<RadioGroup
|
<RadioGroup
|
||||||
sx={{display:'flex', flexDirection:'row'}}
|
sx={{display:'flex', flexDirection:'row'}}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
setValues((prevValues) => ({
|
setPatient((prevValues) => ({
|
||||||
...prevValues,
|
...prevValues,
|
||||||
educationLevel: event.target.value,
|
educationLevel: event.target.value,
|
||||||
}));
|
}));
|
||||||
@ -91,7 +139,7 @@ export default function RecreationalHobbiesSection7(){
|
|||||||
name="painDuration"
|
name="painDuration"
|
||||||
sx={{display:'flex', flexDirection:'row'}}
|
sx={{display:'flex', flexDirection:'row'}}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
setValues((prevValues) => ({
|
setPatient((prevValues) => ({
|
||||||
...prevValues,
|
...prevValues,
|
||||||
excercise: event.target.value,
|
excercise: event.target.value,
|
||||||
}));
|
}));
|
||||||
@ -105,12 +153,12 @@ export default function RecreationalHobbiesSection7(){
|
|||||||
|
|
||||||
<Grid item xs={6} className='collapsable-form-style-form7'>
|
<Grid item xs={6} className='collapsable-form-style-form7'>
|
||||||
<TextField
|
<TextField
|
||||||
disabled={values.excercise!=='Yes'}
|
disabled={patient.excercise!=='Yes'}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
label="Times per week?"
|
label="Times per week?"
|
||||||
name='treatmentGoal'
|
name='treatmentGoal'
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
setValues((prevValues) => ({
|
setPatient((prevValues) => ({
|
||||||
...prevValues,
|
...prevValues,
|
||||||
excerciseExplanation: event.target.value,
|
excerciseExplanation: event.target.value,
|
||||||
}));
|
}));
|
||||||
@ -125,7 +173,7 @@ export default function RecreationalHobbiesSection7(){
|
|||||||
name="painDuration"
|
name="painDuration"
|
||||||
sx={{display:'flex', flexDirection:'row'}}
|
sx={{display:'flex', flexDirection:'row'}}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
setValues((prevValues) => ({
|
setPatient((prevValues) => ({
|
||||||
...prevValues,
|
...prevValues,
|
||||||
tobacco: event.target.value,
|
tobacco: event.target.value,
|
||||||
}));
|
}));
|
||||||
@ -139,12 +187,12 @@ export default function RecreationalHobbiesSection7(){
|
|||||||
|
|
||||||
<Grid item xs={6} className='collapsable-form-style-form7'>
|
<Grid item xs={6} className='collapsable-form-style-form7'>
|
||||||
<TextField
|
<TextField
|
||||||
disabled={values.tobacco!=='Yes'}
|
disabled={patient.tobacco!=='Yes'}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
label="Packs/Cans per day(If you have quit, when did you quit?)"
|
label="Packs/Cans per day(If you have quit, when did you quit?)"
|
||||||
name='treatmentGoal'
|
name='treatmentGoal'
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
setValues((prevValues) => ({
|
setPatient((prevValues) => ({
|
||||||
...prevValues,
|
...prevValues,
|
||||||
excerciseExplanation: event.target.value,
|
excerciseExplanation: event.target.value,
|
||||||
}));
|
}));
|
||||||
@ -159,7 +207,7 @@ export default function RecreationalHobbiesSection7(){
|
|||||||
name="painDuration"
|
name="painDuration"
|
||||||
sx={{display:'flex', flexDirection:'row'}}
|
sx={{display:'flex', flexDirection:'row'}}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
setValues((prevValues) => ({
|
setPatient((prevValues) => ({
|
||||||
...prevValues,
|
...prevValues,
|
||||||
alcohol: event.target.value,
|
alcohol: event.target.value,
|
||||||
}));
|
}));
|
||||||
@ -173,12 +221,12 @@ export default function RecreationalHobbiesSection7(){
|
|||||||
|
|
||||||
<Grid item xs={6} className='collapsable-form-style-form7'>
|
<Grid item xs={6} className='collapsable-form-style-form7'>
|
||||||
<TextField
|
<TextField
|
||||||
disabled={values.alcohol!=='Yes'}
|
disabled={patient.alcohol!=='Yes'}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
label="How many drinks per week?"
|
label="How many drinks per week?"
|
||||||
name='treatmentGoal'
|
name='treatmentGoal'
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
setValues((prevValues) => ({
|
setPatient((prevValues) => ({
|
||||||
...prevValues,
|
...prevValues,
|
||||||
alcoholExplanation: event.target.value,
|
alcoholExplanation: event.target.value,
|
||||||
}));
|
}));
|
||||||
@ -193,7 +241,7 @@ export default function RecreationalHobbiesSection7(){
|
|||||||
name="painDuration"
|
name="painDuration"
|
||||||
sx={{display:'flex', flexDirection:'row'}}
|
sx={{display:'flex', flexDirection:'row'}}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
setValues((prevValues) => ({
|
setPatient((prevValues) => ({
|
||||||
...prevValues,
|
...prevValues,
|
||||||
healthyDiet: event.target.value,
|
healthyDiet: event.target.value,
|
||||||
}));
|
}));
|
||||||
@ -207,12 +255,12 @@ export default function RecreationalHobbiesSection7(){
|
|||||||
|
|
||||||
<Grid item xs={6} className='collapsable-form-style-form7'>
|
<Grid item xs={6} className='collapsable-form-style-form7'>
|
||||||
<TextField
|
<TextField
|
||||||
disabled={values.healthyDiet!=='No'}
|
disabled={patient.healthyDiet!=='No'}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
label="If no, explain"
|
label="If no, explain"
|
||||||
name='treatmentGoal'
|
name='treatmentGoal'
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
setValues((prevValues) => ({
|
setPatient((prevValues) => ({
|
||||||
...prevValues,
|
...prevValues,
|
||||||
healthyDietExplanation: event.target.value,
|
healthyDietExplanation: event.target.value,
|
||||||
}));
|
}));
|
||||||
@ -227,7 +275,7 @@ export default function RecreationalHobbiesSection7(){
|
|||||||
name="painDuration"
|
name="painDuration"
|
||||||
sx={{display:'flex', flexDirection:'row'}}
|
sx={{display:'flex', flexDirection:'row'}}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
setValues((prevValues) => ({
|
setPatient((prevValues) => ({
|
||||||
...prevValues,
|
...prevValues,
|
||||||
sleep: event.target.value,
|
sleep: event.target.value,
|
||||||
}));
|
}));
|
||||||
@ -241,12 +289,12 @@ export default function RecreationalHobbiesSection7(){
|
|||||||
|
|
||||||
<Grid item xs={6} className='collapsable-form-style-form7'>
|
<Grid item xs={6} className='collapsable-form-style-form7'>
|
||||||
<TextField
|
<TextField
|
||||||
disabled={values.sleep!=='No'}
|
disabled={patient.sleep!=='No'}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
label="If no, explain"
|
label="If no, explain"
|
||||||
name='treatmentGoal'
|
name='treatmentGoal'
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
setValues((prevValues) => ({
|
setPatient((prevValues) => ({
|
||||||
...prevValues,
|
...prevValues,
|
||||||
sleepExplanation: event.target.value,
|
sleepExplanation: event.target.value,
|
||||||
}));
|
}));
|
||||||
@ -261,7 +309,7 @@ export default function RecreationalHobbiesSection7(){
|
|||||||
name="painDuration"
|
name="painDuration"
|
||||||
sx={{display:'flex', flexDirection:'row'}}
|
sx={{display:'flex', flexDirection:'row'}}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
setValues((prevValues) => ({
|
setPatient((prevValues) => ({
|
||||||
...prevValues,
|
...prevValues,
|
||||||
workSchool: event.target.value,
|
workSchool: event.target.value,
|
||||||
}));
|
}));
|
||||||
@ -275,12 +323,12 @@ export default function RecreationalHobbiesSection7(){
|
|||||||
|
|
||||||
<Grid item xs={6} className='collapsable-form-style-form7'>
|
<Grid item xs={6} className='collapsable-form-style-form7'>
|
||||||
<TextField
|
<TextField
|
||||||
disabled={values.workSchool!=='Yes'}
|
disabled={patient.workSchool!=='Yes'}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
label="If yes, explain"
|
label="If yes, explain"
|
||||||
name='treatmentGoal'
|
name='treatmentGoal'
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
setValues((prevValues) => ({
|
setPatient((prevValues) => ({
|
||||||
...prevValues,
|
...prevValues,
|
||||||
workSchool: event.target.value,
|
workSchool: event.target.value,
|
||||||
}));
|
}));
|
||||||
@ -295,7 +343,7 @@ export default function RecreationalHobbiesSection7(){
|
|||||||
name="painDuration"
|
name="painDuration"
|
||||||
sx={{display:'flex', flexDirection:'row'}}
|
sx={{display:'flex', flexDirection:'row'}}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
setValues((prevValues) => ({
|
setPatient((prevValues) => ({
|
||||||
...prevValues,
|
...prevValues,
|
||||||
familyLife: event.target.value,
|
familyLife: event.target.value,
|
||||||
}));
|
}));
|
||||||
@ -309,12 +357,12 @@ export default function RecreationalHobbiesSection7(){
|
|||||||
|
|
||||||
<Grid item xs={6} className='collapsable-form-style-form7'>
|
<Grid item xs={6} className='collapsable-form-style-form7'>
|
||||||
<TextField
|
<TextField
|
||||||
disabled={values.familyLife!=='Yes'}
|
disabled={patient.familyLife!=='Yes'}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
label="If yes, explain"
|
label="If yes, explain"
|
||||||
name='treatmentGoal'
|
name='treatmentGoal'
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
setValues((prevValues) => ({
|
setPatient((prevValues) => ({
|
||||||
...prevValues,
|
...prevValues,
|
||||||
familyLifeExplanation: event.target.value,
|
familyLifeExplanation: event.target.value,
|
||||||
}));
|
}));
|
||||||
@ -329,7 +377,7 @@ export default function RecreationalHobbiesSection7(){
|
|||||||
name="painDuration"
|
name="painDuration"
|
||||||
sx={{display:'flex', flexDirection:'row'}}
|
sx={{display:'flex', flexDirection:'row'}}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
setValues((prevValues) => ({
|
setPatient((prevValues) => ({
|
||||||
...prevValues,
|
...prevValues,
|
||||||
drugs: event.target.value,
|
drugs: event.target.value,
|
||||||
}));
|
}));
|
||||||
@ -343,12 +391,12 @@ export default function RecreationalHobbiesSection7(){
|
|||||||
|
|
||||||
<Grid item xs={6} className='collapsable-form-style-form7'>
|
<Grid item xs={6} className='collapsable-form-style-form7'>
|
||||||
<TextField
|
<TextField
|
||||||
disabled={values.drugs!=='Yes'}
|
disabled={patient.drugs!=='Yes'}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
label="If yes, explain"
|
label="If yes, explain"
|
||||||
name='treatmentGoal'
|
name='treatmentGoal'
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
setValues((prevValues) => ({
|
setPatient((prevValues) => ({
|
||||||
...prevValues,
|
...prevValues,
|
||||||
drugsExplanation: event.target.value,
|
drugsExplanation: event.target.value,
|
||||||
}));
|
}));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user