section 3 display

This commit is contained in:
sonika 2023-09-05 18:38:53 +05:30
parent c410fbbd95
commit 160f98edfb
3 changed files with 37 additions and 46 deletions

View File

@ -72,8 +72,6 @@ export default function FamilyFormSection({handleFormSection2Data,patientDataDip
) )
},[patient]) },[patient])
console.log(type,"sfsdfsdfsd")
return( return(
<> <>
<Grid container direction="row"> <Grid container direction="row">

View File

@ -18,19 +18,6 @@ interface Patient {
cellPhoneProvider: string |undefined; cellPhoneProvider: string |undefined;
} }
const validationSchema = Yup.object({
familyphysician: Yup.string().required('Required'),
city: Yup.string().required('Required'),
state: Yup.string().required('Required'),
phone: Yup.string().required('Required'),
chiropractorName: Yup.string().required('Required'),
xray: Yup.boolean().required('Required'),
haveChiropractor: Yup.boolean().required('Required'),
reference: Yup.boolean().required('Required'),
visitDetails: Yup.string().required('Required'),
cellPhoneProvider: Yup.string().required('Required'),
});
type Props = { type Props = {
handleFormSection3Data:( handleFormSection3Data:(
physicianname?: string |undefined, physicianname?: string |undefined,
@ -45,9 +32,11 @@ type Props = {
visitDetails?: string |undefined, visitDetails?: string |undefined,
cellPhoneProvider?: string |undefined, cellPhoneProvider?: string |undefined,
)=> void )=> void
patientDataDiplay:any;
type:string;
} }
export default function MedicalHistoryForm({handleFormSection3Data}:Props){ export default function MedicalHistoryForm({handleFormSection3Data,patientDataDiplay,type}:Props){
const [patient, setPatient] = React.useState<Patient>({ const [patient, setPatient] = React.useState<Patient>({
physicianname: '', physicianname: '',
@ -78,6 +67,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
patient.cellPhoneProvider, patient.cellPhoneProvider,
) )
},[patient]) },[patient])
console.log("patientDataDiplay",patientDataDiplay)
return( return(
<> <>
<Grid item xs={12} className='collapsable-form-style '> <Grid item xs={12} className='collapsable-form-style '>
@ -96,8 +87,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
physicianname: e.target.value, physicianname: e.target.value,
})); }));
}} }}
value={patient.physicianname} value={type=='display'?patientDataDiplay.physicianname:patient.physicianname}
// onBlur={formik.handleBlur} disabled={type=='display'}
/> />
</Grid> </Grid>
<Grid item xs={4} className='collapsable-form-style'> <Grid item xs={4} className='collapsable-form-style'>
@ -111,8 +102,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
physiciancity: e.target.value, physiciancity: e.target.value,
})); }));
}} }}
value={patient.physiciancity} value={type=='display'?patientDataDiplay.physiciancity:patient.physiciancity}
// onBlur={formik.handleBlur} disabled={type=='display'}
/> />
</Grid> </Grid>
<Grid item xs={4} className='collapsable-form-style'> <Grid item xs={4} className='collapsable-form-style'>
@ -126,8 +117,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
physicianstate: e.target.value, physicianstate: e.target.value,
})); }));
}} }}
value={patient.physicianstate} value={type=='display'?patientDataDiplay.physicianstate:patient.physicianstate}
// onBlur={formik.handleBlur} disabled={type=='display'}
/> />
</Grid> </Grid>
<Grid item xs={4} className='collapsable-form-style'> <Grid item xs={4} className='collapsable-form-style'>
@ -142,8 +133,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
physicianphone: e.target.value, physicianphone: e.target.value,
})); }));
}} }}
value={patient.physicianphone} value={type=='display'?patientDataDiplay.physicianphone:patient.physicianphone}
// onBlur={formik.handleBlur} disabled={type=='display'}
/> />
</Grid> </Grid>
@ -158,9 +149,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
<FormControl> <FormControl>
<FormLabel>Previous Chiropractic Care:</FormLabel> <FormLabel>Previous Chiropractic Care:</FormLabel>
<RadioGroup <RadioGroup
// value={patient.gender}
aria-labelledby="demo-radio-buttons-group-label" aria-labelledby="demo-radio-buttons-group-label"
// defaultValue="yes" defaultValue={type=='display'?patientDataDiplay.haveChiropractor:patient.haveChiropractor}
name="radio-buttons-group" name="radio-buttons-group"
onChange={(e)=>{ onChange={(e)=>{
setPatient((prevValues) => ({ setPatient((prevValues) => ({
@ -170,8 +160,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
}} }}
sx={{display:'flex', flexDirection:'row'}} sx={{display:'flex', flexDirection:'row'}}
> >
<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>
@ -187,8 +177,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
chiropractorName: e.target.value, chiropractorName: e.target.value,
})); }));
}} }}
value={patient.chiropractorName} value={type=='display'?patientDataDiplay.chiropractorName:patient.chiropractorName}
// onBlur={formik.handleBlur} disabled={type=='display'}
/> />
</Grid> </Grid>
@ -203,8 +193,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
chiropractorState: e.target.value, chiropractorState: e.target.value,
})); }));
}} }}
value={patient.chiropractorState} value={type=='display'?patientDataDiplay.chiropractorState:patient.chiropractorState}
// onBlur={formik.handleBlur} disabled={type=='display'}
/> />
</Grid> </Grid>
</Grid> </Grid>
@ -215,7 +205,7 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
<RadioGroup <RadioGroup
// value={patient.gender} // value={patient.gender}
aria-labelledby="demo-radio-buttons-group-label" aria-labelledby="demo-radio-buttons-group-label"
// defaultValue="yes" defaultValue={type=='display'?patientDataDiplay.xray:patient.xray}
name="radio-buttons-group" name="radio-buttons-group"
onChange={(e)=>{ onChange={(e)=>{
setPatient((prevValues) => ({ setPatient((prevValues) => ({
@ -225,8 +215,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
}} }}
sx={{display:'flex', flexDirection:'row'}} sx={{display:'flex', flexDirection:'row'}}
> >
<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>
@ -237,7 +227,7 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
<RadioGroup <RadioGroup
// value={patient.gender} // value={patient.gender}
aria-labelledby="demo-radio-buttons-group-label" aria-labelledby="demo-radio-buttons-group-label"
// defaultValue="physician" defaultValue={type=='display'?patientDataDiplay.reference:patient.reference}
name="radio-buttons-group" name="radio-buttons-group"
onChange={(e)=>{ onChange={(e)=>{
setPatient((prevValues) => ({ setPatient((prevValues) => ({
@ -247,12 +237,12 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
}} }}
sx={{display:'flex', flexDirection:'row'}} sx={{display:'flex', flexDirection:'row'}}
> >
<FormControlLabel value="friend" control={<Radio />} label="Friend" /> <FormControlLabel disabled={type=='display'} value="friend" control={<Radio />} label="Friend" />
<FormControlLabel value="relative" control={<Radio />} label="Relative" /> <FormControlLabel disabled={type=='display'} value="relative" control={<Radio />} label="Relative" />
<FormControlLabel value="physician" control={<Radio />} label="Physician" /> <FormControlLabel disabled={type=='display'} value="physician" control={<Radio />} label="Physician" />
<FormControlLabel value="instagram" control={<Radio />} label="Instagram" /> <FormControlLabel disabled={type=='display'} value="instagram" control={<Radio />} label="Instagram" />
<FormControlLabel value="google" control={<Radio />} label="Google" /> <FormControlLabel disabled={type=='display'} value="google" control={<Radio />} label="Google" />
<FormControlLabel value="others" control={<Radio />} label="Others" /> <FormControlLabel disabled={type=='display'} value="others" control={<Radio />} label="Others" />
</RadioGroup> </RadioGroup>
</FormControl> </FormControl>
</Grid> </Grid>
@ -263,7 +253,7 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
<RadioGroup <RadioGroup
// value={patient.gender} // value={patient.gender}
aria-labelledby="demo-radio-buttons-group-label" aria-labelledby="demo-radio-buttons-group-label"
// defaultValue="email" defaultValue={type=='display'?patientDataDiplay.cellPhoneProvider:patient.cellPhoneProvider}
name="radio-buttons-group" name="radio-buttons-group"
onChange={(e)=>{ onChange={(e)=>{
setPatient((prevValues) => ({ setPatient((prevValues) => ({
@ -273,8 +263,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){
}} }}
sx={{display:'flex', flexDirection:'row'}} sx={{display:'flex', flexDirection:'row'}}
> >
<FormControlLabel value="email" control={<Radio />} label="Email" /> <FormControlLabel disabled={type=='display'} value="email" control={<Radio />} label="Email" />
<FormControlLabel value="text" control={<Radio />} label="Text" /> <FormControlLabel disabled={type=='display'} value="text" control={<Radio />} label="Text" />
</RadioGroup> </RadioGroup>
</FormControl> </FormControl>
</Grid> </Grid>

View File

@ -418,7 +418,10 @@ export default function PatientForm({type}:Props){
</AccordionSummary> </AccordionSummary>
<AccordionDetails> <AccordionDetails>
<MedicalHistory handleFormSection3Data={handleFormSection3Data}/> <MedicalHistory
patientDataDiplay={patientData.medicalHistory}
type={type}
handleFormSection3Data={handleFormSection3Data}/>
</AccordionDetails> </AccordionDetails>
</Accordion> </Accordion>