section 7 display

This commit is contained in:
sonika 2023-09-05 19:21:41 +05:30
parent 3fc6f628bb
commit 10724d86fb
2 changed files with 56 additions and 33 deletions

View File

@ -484,7 +484,10 @@ export default function PatientForm({type}:Props){
</AccordionSummary>
<AccordionDetails>
<RecreationalHobbiesSection7 handleFormSection7Data={handleFormSection7Data}/>
<RecreationalHobbiesSection7
handleFormSection7Data={handleFormSection7Data}
patientDataDiplay={patientData.systemReviewQuestions}
type={type}/>
</AccordionDetails>
</Accordion>

View File

@ -43,9 +43,11 @@ interface Patient {
drugs: string|undefined,
drugsExplanation:string|undefined,
)=> void
patientDataDiplay:any;
type:string;
}
export default function RecreationalHobbiesSection7({handleFormSection7Data}:Props){
export default function RecreationalHobbiesSection7({handleFormSection7Data,patientDataDiplay,type}:Props){
const [patient, setPatient] = React.useState<Patient>({
hobbies: '',
educationLevel: '',
@ -101,7 +103,8 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data}:Pro
multiline
variant="outlined"
label=""
name='explanation'
value={type=='display'?patientDataDiplay.hobbies:patient.hobbies}
disabled={type=='display'}
onChange={(event:any) => {
setPatient((prevValues) => ({
...prevValues,
@ -116,6 +119,7 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data}:Pro
<FormLabel>Your education level:</FormLabel>
<RadioGroup
sx={{display:'flex', flexDirection:'row'}}
defaultValue={type=='display'?patientDataDiplay.educationLevel:patient.educationLevel}
onChange={(event) => {
setPatient((prevValues) => ({
...prevValues,
@ -123,11 +127,11 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data}:Pro
}));
}}
>
<FormControlLabel value="High School" control={<Radio />} label="High School" />
<FormControlLabel value="Some college" control={<Radio />} label="Some college" />
<FormControlLabel value="College Graduate" control={<Radio />} label="College Graduate" />
<FormControlLabel value="Post college" control={<Radio />} label="Post college" />
<FormControlLabel value="Other" control={<Radio />} label="Other" />
<FormControlLabel disabled={type=='display'} value="High School" control={<Radio />} label="High School" />
<FormControlLabel disabled={type=='display'} value="Some college" control={<Radio />} label="Some college" />
<FormControlLabel disabled={type=='display'} value="College Graduate" control={<Radio />} label="College Graduate" />
<FormControlLabel disabled={type=='display'} value="Post college" control={<Radio />} label="Post college" />
<FormControlLabel disabled={type=='display'} value="Other" control={<Radio />} label="Other" />
</RadioGroup>
</FormControl>
</Grid>
@ -138,6 +142,7 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data}:Pro
<RadioGroup
name="painDuration"
sx={{display:'flex', flexDirection:'row'}}
defaultValue={type=='display'?patientDataDiplay.excercise:patient.excercise}
onChange={(event) => {
setPatient((prevValues) => ({
...prevValues,
@ -145,18 +150,19 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data}:Pro
}));
}}
>
<FormControlLabel value="Yes" control={<Radio />} label="Yes" />
<FormControlLabel value="No" control={<Radio />} label="No" />
<FormControlLabel disabled={type=='display'} value="Yes" control={<Radio />} label="Yes" />
<FormControlLabel disabled={type=='display'} value="No" control={<Radio />} label="No" />
</RadioGroup>
</FormControl>
</Grid>
<Grid item xs={6} className='collapsable-form-style-form7'>
<TextField
disabled={patient.excercise!=='Yes'}
disabled={patient.excercise!=='Yes'||type=='display'}
variant="outlined"
label="Times per week?"
name='treatmentGoal'
value={type=='display'?patientDataDiplay.excerciseExplanation:patient.excerciseExplanation}
onChange={(event) => {
setPatient((prevValues) => ({
...prevValues,
@ -172,6 +178,7 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data}:Pro
<RadioGroup
name="painDuration"
sx={{display:'flex', flexDirection:'row'}}
defaultValue={type=='display'?patientDataDiplay.tobacco:patient.tobacco}
onChange={(event) => {
setPatient((prevValues) => ({
...prevValues,
@ -179,22 +186,23 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data}:Pro
}));
}}
>
<FormControlLabel value="Yes" control={<Radio />} label="Yes" />
<FormControlLabel value="No" control={<Radio />} label="No" />
<FormControlLabel disabled={type=='display'} value="Yes" control={<Radio />} label="Yes" />
<FormControlLabel disabled={type=='display'} value="No" control={<Radio />} label="No" />
</RadioGroup>
</FormControl>
</Grid>
<Grid item xs={6} className='collapsable-form-style-form7'>
<TextField
disabled={patient.tobacco!=='Yes'}
disabled={patient.tobacco!=='Yes'||type=='display'}
value={type=='display'?patientDataDiplay.tobaccoExplanation:patient.tobaccoExplanation}
variant="outlined"
label="Packs/Cans per day(If you have quit, when did you quit?)"
name='treatmentGoal'
onChange={(event) => {
setPatient((prevValues) => ({
...prevValues,
excerciseExplanation: event.target.value,
tobaccoExplanation: event.target.value,
}));
}}
/>
@ -206,6 +214,7 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data}:Pro
<RadioGroup
name="painDuration"
sx={{display:'flex', flexDirection:'row'}}
defaultValue={type=='display'?patientDataDiplay.alcohol:patient.alcohol}
onChange={(event) => {
setPatient((prevValues) => ({
...prevValues,
@ -213,15 +222,16 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data}:Pro
}));
}}
>
<FormControlLabel value="Yes" control={<Radio />} label="Yes" />
<FormControlLabel value="No" control={<Radio />} label="No" />
<FormControlLabel disabled={type=='display'} value="Yes" control={<Radio />} label="Yes" />
<FormControlLabel disabled={type=='display'} value="No" control={<Radio />} label="No" />
</RadioGroup>
</FormControl>
</Grid>
<Grid item xs={6} className='collapsable-form-style-form7'>
<TextField
disabled={patient.alcohol!=='Yes'}
disabled={patient.alcohol!=='Yes'||type=='display'}
value={type=='display'?patientDataDiplay.alcoholExplanation:patient.alcoholExplanation}
variant="outlined"
label="How many drinks per week?"
name='treatmentGoal'
@ -240,6 +250,7 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data}:Pro
<RadioGroup
name="painDuration"
sx={{display:'flex', flexDirection:'row'}}
defaultValue={type=='display'?patientDataDiplay.healthyDiet:patient.healthyDiet}
onChange={(event) => {
setPatient((prevValues) => ({
...prevValues,
@ -247,15 +258,16 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data}:Pro
}));
}}
>
<FormControlLabel value="Yes" control={<Radio />} label="Yes" />
<FormControlLabel value="No" control={<Radio />} label="No" />
<FormControlLabel disabled={type=='display'} value="Yes" control={<Radio />} label="Yes" />
<FormControlLabel disabled={type=='display'} value="No" control={<Radio />} label="No" />
</RadioGroup>
</FormControl>
</Grid>
<Grid item xs={6} className='collapsable-form-style-form7'>
<TextField
disabled={patient.healthyDiet!=='No'}
disabled={patient.healthyDiet!=='No'||type=='display'}
value={type=='display'?patientDataDiplay.healthyDietExplanation:patient.healthyDietExplanation}
variant="outlined"
label="If no, explain"
name='treatmentGoal'
@ -274,6 +286,7 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data}:Pro
<RadioGroup
name="painDuration"
sx={{display:'flex', flexDirection:'row'}}
defaultValue={type=='display'?patientDataDiplay.sleep:patient.sleep}
onChange={(event) => {
setPatient((prevValues) => ({
...prevValues,
@ -281,15 +294,16 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data}:Pro
}));
}}
>
<FormControlLabel value="Yes" control={<Radio />} label="Yes" />
<FormControlLabel value="No" control={<Radio />} label="No" />
<FormControlLabel disabled={type=='display'} value="Yes" control={<Radio />} label="Yes" />
<FormControlLabel disabled={type=='display'} value="No" control={<Radio />} label="No" />
</RadioGroup>
</FormControl>
</Grid>
<Grid item xs={6} className='collapsable-form-style-form7'>
<TextField
disabled={patient.sleep!=='No'}
disabled={patient.sleep!=='No'||type=='display'}
value={type=='display'?patientDataDiplay.sleepExplanation:patient.sleepExplanation}
variant="outlined"
label="If no, explain"
name='treatmentGoal'
@ -308,6 +322,7 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data}:Pro
<RadioGroup
name="painDuration"
sx={{display:'flex', flexDirection:'row'}}
defaultValue={type=='display'?patientDataDiplay.workSchool:patient.workSchool}
onChange={(event) => {
setPatient((prevValues) => ({
...prevValues,
@ -315,15 +330,16 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data}:Pro
}));
}}
>
<FormControlLabel value="Yes" control={<Radio />} label="Yes" />
<FormControlLabel value="No" control={<Radio />} label="No" />
<FormControlLabel disabled={type=='display'} value="Yes" control={<Radio />} label="Yes" />
<FormControlLabel disabled={type=='display'} value="No" control={<Radio />} label="No" />
</RadioGroup>
</FormControl>
</Grid>
<Grid item xs={6} className='collapsable-form-style-form7'>
<TextField
disabled={patient.workSchool!=='Yes'}
disabled={patient.workSchool!=='Yes'||type=='display'}
value={type=='display'?patientDataDiplay.workSchool:patient.workSchool}
variant="outlined"
label="If yes, explain"
name='treatmentGoal'
@ -342,6 +358,7 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data}:Pro
<RadioGroup
name="painDuration"
sx={{display:'flex', flexDirection:'row'}}
defaultValue={type=='display'?patientDataDiplay.familyLife:patient.familyLife}
onChange={(event) => {
setPatient((prevValues) => ({
...prevValues,
@ -349,15 +366,16 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data}:Pro
}));
}}
>
<FormControlLabel value="Yes" control={<Radio />} label="Yes" />
<FormControlLabel value="No" control={<Radio />} label="No" />
<FormControlLabel disabled={type=='display'} value="Yes" control={<Radio />} label="Yes" />
<FormControlLabel disabled={type=='display'} value="No" control={<Radio />} label="No" />
</RadioGroup>
</FormControl>
</Grid>
<Grid item xs={6} className='collapsable-form-style-form7'>
<TextField
disabled={patient.familyLife!=='Yes'}
disabled={patient.familyLife!=='Yes'||type=='display'}
value={type=='display'?patientDataDiplay.familyLifeExplanation:patient.familyLifeExplanation}
variant="outlined"
label="If yes, explain"
name='treatmentGoal'
@ -376,6 +394,7 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data}:Pro
<RadioGroup
name="painDuration"
sx={{display:'flex', flexDirection:'row'}}
defaultValue={type=='display'?patientDataDiplay.drugs:patient.drugs}
onChange={(event) => {
setPatient((prevValues) => ({
...prevValues,
@ -383,15 +402,16 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data}:Pro
}));
}}
>
<FormControlLabel value="Yes" control={<Radio />} label="Yes" />
<FormControlLabel value="No" control={<Radio />} label="No" />
<FormControlLabel disabled={type=='display'} value="Yes" control={<Radio />} label="Yes" />
<FormControlLabel disabled={type=='display'} value="No" control={<Radio />} label="No" />
</RadioGroup>
</FormControl>
</Grid>
<Grid item xs={6} className='collapsable-form-style-form7'>
<TextField
disabled={patient.drugs!=='Yes'}
disabled={patient.drugs!=='Yes'||type=='display'}
value={type=='display'?patientDataDiplay.drugsExplanation:patient.drugsExplanation}
variant="outlined"
label="If yes, explain"
name='treatmentGoal'