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> </AccordionSummary>
<AccordionDetails> <AccordionDetails>
<RecreationalHobbiesSection7 handleFormSection7Data={handleFormSection7Data}/> <RecreationalHobbiesSection7
handleFormSection7Data={handleFormSection7Data}
patientDataDiplay={patientData.systemReviewQuestions}
type={type}/>
</AccordionDetails> </AccordionDetails>
</Accordion> </Accordion>

View File

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