section 8 data display

This commit is contained in:
sonika 2023-09-05 19:26:54 +05:30
parent 10724d86fb
commit 98b486d43c
2 changed files with 27 additions and 15 deletions

View File

@ -24,9 +24,11 @@ interface Patient {
pregnancy:string|undefined,
menstralCycle: any,
)=> void
patientDataDiplay:any;
type:string;
}
export default function OtherDetails8({handleFormSection8Data}:Props){
export default function OtherDetails8({handleFormSection8Data,patientDataDiplay,type}:Props){
const [patient, setPatient] = React.useState<Patient>({
familyHistory: '',
@ -71,7 +73,8 @@ export default function OtherDetails8({handleFormSection8Data}:Props){
multiline
variant="outlined"
label=""
name='explanation'
value={type=='display'?patientDataDiplay.familyHistory:patient.familyHistory}
disabled={type=='display'}
onChange={(event:any) => {
setPatient((prevValues) => ({
...prevValues,
@ -86,6 +89,7 @@ export default function OtherDetails8({handleFormSection8Data}:Props){
<FormLabel>How do you sleep?</FormLabel>
<RadioGroup
sx={{display:'flex', flexDirection:'row'}}
defaultValue={type=='display'?patientDataDiplay.sleep:patient.sleep}
onChange={(event) => {
setPatient((prevValues) => ({
...prevValues,
@ -93,9 +97,9 @@ export default function OtherDetails8({handleFormSection8Data}:Props){
}));
}}
>
<FormControlLabel value="Back" control={<Radio />} label="Back" />
<FormControlLabel value="Side" control={<Radio />} label="Side" />
<FormControlLabel value="Stomach" control={<Radio />} label="Stomach" />
<FormControlLabel disabled={type=='display'} value="Back" control={<Radio />} label="Back" />
<FormControlLabel disabled={type=='display'} value="Side" control={<Radio />} label="Side" />
<FormControlLabel disabled={type=='display'} value="Stomach" control={<Radio />} label="Stomach" />
</RadioGroup>
</FormControl>
</Grid>
@ -105,6 +109,7 @@ export default function OtherDetails8({handleFormSection8Data}:Props){
<FormLabel>Do you use a pillow?</FormLabel>
<RadioGroup
sx={{display:'flex', flexDirection:'row'}}
defaultValue={type=='display'?patientDataDiplay.pillow:patient.pillow}
onChange={(event) => {
setPatient((prevValues) => ({
...prevValues,
@ -112,8 +117,8 @@ export default function OtherDetails8({handleFormSection8Data}:Props){
}));
}}
>
<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>
@ -123,6 +128,7 @@ export default function OtherDetails8({handleFormSection8Data}:Props){
<FormLabel>Do you wear orthotics or arch support?</FormLabel>
<RadioGroup
sx={{display:'flex', flexDirection:'row'}}
defaultValue={type=='display'?patientDataDiplay.orthotics:patient.orthotics}
onChange={(event) => {
setPatient((prevValues) => ({
...prevValues,
@ -130,8 +136,8 @@ export default function OtherDetails8({handleFormSection8Data}:Props){
}));
}}
>
<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>
@ -141,7 +147,8 @@ export default function OtherDetails8({handleFormSection8Data}:Props){
<FormControl>
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DatePicker
value={patient.brestExam}
value={type=='display'?patientDataDiplay.brestExam:patient.brestExam}
disabled={type=='display'}
onChange={(event) => {
const formattedDate = formatDate(event)
setPatient((prevValues) => ({
@ -164,6 +171,7 @@ export default function OtherDetails8({handleFormSection8Data}:Props){
<FormLabel>Possible pregnancy?</FormLabel>
<RadioGroup
sx={{display:'flex', flexDirection:'row'}}
defaultValue={type=='display'?patientDataDiplay.pregnancy:patient.pregnancy}
onChange={(event) => {
setPatient((prevValues) => ({
...prevValues,
@ -171,8 +179,8 @@ export default function OtherDetails8({handleFormSection8Data}:Props){
}));
}}
>
<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>
@ -182,7 +190,8 @@ export default function OtherDetails8({handleFormSection8Data}:Props){
<FormControl>
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DatePicker
value={patient.menstralCycle}
value={type=='display'?patientDataDiplay.menstralCycle:patient.menstralCycle}
disabled={type=='display'}
onChange={(event) => {
const formattedDate = formatDate(event)
setPatient((prevValues) => ({

View File

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