feature/view-patient-data #3
@ -19,21 +19,6 @@ interface Patient {
|
||||
spousePhone: string | undefined,
|
||||
}
|
||||
|
||||
const validationSchema = yup.object({
|
||||
maritalStatus:yup.string().required("Marital Status is required"),
|
||||
numberOfChildren:yup.string().required("Full name is required"),
|
||||
occupation:yup.string().required("Occupation is required"),
|
||||
// hoursPerWeek: yup.number().required('Required'),
|
||||
// employer:yup.string().required("Full name is required"),
|
||||
// businessPhone:yup.string().required("Full name is required"),
|
||||
spouseName:yup.string().required("Spouse name is required"),
|
||||
// spouseEmployer:yup.string().required("Full name is required"),
|
||||
// spouseBusinessPhone:yup.string().required("Full name is required"),
|
||||
emergencyContact:yup.string().matches(/^\d{10}$/, "Cell phone must be 10 digits"),
|
||||
relationship:yup.string().required("Relationship is required"),
|
||||
spousePhone:yup.string().matches(/^\d{10}$/, "Cell phone must be 10 digits"),
|
||||
});
|
||||
|
||||
type Props = {
|
||||
handleFormSection2Data:(
|
||||
maritalStatus: string | undefined,
|
||||
@ -49,10 +34,12 @@ type Props = {
|
||||
relationship: string | undefined,
|
||||
spousePhone: string | undefined,
|
||||
)=> void
|
||||
patientDataDiplay:any;
|
||||
type:string;
|
||||
}
|
||||
|
||||
|
||||
export default function FamilyFormSection({handleFormSection2Data}:Props){
|
||||
export default function FamilyFormSection({handleFormSection2Data,patientDataDiplay,type}:Props){
|
||||
const [patient, setPatient] = React.useState<Patient>({
|
||||
maritalStatus:'',
|
||||
numberOfChildren:'',
|
||||
@ -85,6 +72,8 @@ export default function FamilyFormSection({handleFormSection2Data}:Props){
|
||||
)
|
||||
},[patient])
|
||||
|
||||
console.log(type,"sfsdfsdfsd")
|
||||
|
||||
return(
|
||||
<>
|
||||
<Grid container direction="row">
|
||||
@ -93,9 +82,8 @@ export default function FamilyFormSection({handleFormSection2Data}:Props){
|
||||
<FormLabel>Marital Status</FormLabel>
|
||||
<RadioGroup
|
||||
aria-labelledby="demo-radio-buttons-group-label"
|
||||
defaultValue="married"
|
||||
name="maritalStatus"
|
||||
value={patient.maritalStatus}
|
||||
defaultValue={type=='display'?patientDataDiplay.maritalStatus:patient.maritalStatus}
|
||||
sx={{display:'flex', flexDirection:'row'}}
|
||||
onChange={(e)=>{
|
||||
setPatient((prevValues:any) => ({
|
||||
@ -103,14 +91,12 @@ export default function FamilyFormSection({handleFormSection2Data}:Props){
|
||||
maritalStatus: e.target.value,
|
||||
}));
|
||||
}}
|
||||
// error={formik.touched.numberOfChildren && Boolean(formik.errors.maritalStatus)}
|
||||
// helperText={formik.touched.numberOfChildren && formik.errors.maritalStatus}
|
||||
>
|
||||
<FormControlLabel value="married" control={<Radio />} label="Married" />
|
||||
<FormControlLabel value="single" control={<Radio />} label="Single" />
|
||||
<FormControlLabel value="widowed" control={<Radio />} label="Widowed" />
|
||||
<FormControlLabel value="seperated" control={<Radio />} label="Seperated" />
|
||||
<FormControlLabel value="divorced" control={<Radio />} label="Divorced" />
|
||||
<FormControlLabel value="married" control={<Radio />} label="Married" disabled={type=='display'}/>
|
||||
<FormControlLabel value="single" control={<Radio />} label="Single" disabled={type=='display'}/>
|
||||
<FormControlLabel value="widowed" control={<Radio />} label="Widowed" disabled={type=='display'}/>
|
||||
<FormControlLabel value="seperated" control={<Radio />} label="Seperated" disabled={type=='display'}/>
|
||||
<FormControlLabel value="divorced" control={<Radio />} label="Divorced" disabled={type=='display'}/>
|
||||
</RadioGroup>
|
||||
|
||||
</FormControl>
|
||||
@ -131,10 +117,8 @@ export default function FamilyFormSection({handleFormSection2Data}:Props){
|
||||
numberOfChildren: e.target.value,
|
||||
}));
|
||||
}}
|
||||
value={patient.numberOfChildren}
|
||||
// onBlur={formik.handleBlur}
|
||||
// error={formik.touched.numberOfChildren && Boolean(formik.errors.numberOfChildren)}
|
||||
// helperText={formik.touched.numberOfChildren && formik.errors.numberOfChildren}
|
||||
value={type=='display'?patientDataDiplay.numberOfChildren:patient.numberOfChildren}
|
||||
disabled={type=='display'}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={4} className='collapsable-form-style '>
|
||||
@ -150,10 +134,8 @@ export default function FamilyFormSection({handleFormSection2Data}:Props){
|
||||
occupation: e.target.value,
|
||||
}));
|
||||
}}
|
||||
value={patient.occupation}
|
||||
// onBlur={formik.handleBlur}
|
||||
// error={formik.touched.occupation && Boolean(formik.errors.occupation)}
|
||||
// helperText={formik.touched.occupation && formik.errors.occupation}
|
||||
value={type=='display'?patientDataDiplay.occupation:patient.occupation}
|
||||
disabled={type=='display'}
|
||||
/>
|
||||
|
||||
</Grid>
|
||||
@ -170,8 +152,8 @@ export default function FamilyFormSection({handleFormSection2Data}:Props){
|
||||
hoursPerWeek: e.target.value,
|
||||
}));
|
||||
}}
|
||||
value={patient.hoursPerWeek}
|
||||
// onBlur={formik.handleBlur}
|
||||
value={type=='display'?patientDataDiplay.hoursPerWeek:patient.hoursPerWeek}
|
||||
disabled={type=='display'}
|
||||
/>
|
||||
|
||||
</Grid>
|
||||
@ -187,8 +169,8 @@ export default function FamilyFormSection({handleFormSection2Data}:Props){
|
||||
employer: e.target.value,
|
||||
}));
|
||||
}}
|
||||
value={patient.employer}
|
||||
// onBlur={formik.handleBlur}
|
||||
value={type=='display'?patientDataDiplay.employer:patient.employer}
|
||||
disabled={type=='display'}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={4} className='collapsable-form-style '>
|
||||
@ -204,8 +186,8 @@ export default function FamilyFormSection({handleFormSection2Data}:Props){
|
||||
businessPhone: e.target.value,
|
||||
}));
|
||||
}}
|
||||
value={patient.businessPhone}
|
||||
// onBlur={formik.handleBlur}
|
||||
value={type=='display'?patientDataDiplay.businessPhone:patient.businessPhone}
|
||||
disabled={type=='display'}
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
@ -227,8 +209,8 @@ export default function FamilyFormSection({handleFormSection2Data}:Props){
|
||||
spouseName: e.target.value,
|
||||
}));
|
||||
}}
|
||||
value={patient.spouseName}
|
||||
// onBlur={formik.handleBlur}
|
||||
value={type=='display'?patientDataDiplay.spouseName:patient.spouseName}
|
||||
disabled={type=='display'}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={4} className='collapsable-form-style '>
|
||||
@ -243,8 +225,8 @@ export default function FamilyFormSection({handleFormSection2Data}:Props){
|
||||
spouseEmployer: e.target.value,
|
||||
}));
|
||||
}}
|
||||
value={patient.spouseEmployer}
|
||||
// onBlur={formik.handleBlur}
|
||||
value={type=='display'?patientDataDiplay.spouseEmployer:patient.spouseEmployer}
|
||||
disabled={type=='display'}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={4} className='collapsable-form-style '>
|
||||
@ -260,8 +242,8 @@ export default function FamilyFormSection({handleFormSection2Data}:Props){
|
||||
spouseBusinessPhone: e.target.value,
|
||||
}));
|
||||
}}
|
||||
value={patient.spouseBusinessPhone}
|
||||
// onBlur={formik.handleBlur}
|
||||
value={type=='display'?patientDataDiplay.spouseBusinessPhone:patient.spouseBusinessPhone}
|
||||
disabled={type=='display'}
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
@ -282,8 +264,8 @@ export default function FamilyFormSection({handleFormSection2Data}:Props){
|
||||
emergencyContact: e.target.value,
|
||||
}));
|
||||
}}
|
||||
value={patient.emergencyContact}
|
||||
// onBlur={formik.handleBlur}
|
||||
value={type=='display'?patientDataDiplay.emergencyContact:patient.emergencyContact}
|
||||
disabled={type=='display'}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={4} className='collapsable-form-style '>
|
||||
@ -298,8 +280,8 @@ export default function FamilyFormSection({handleFormSection2Data}:Props){
|
||||
relationship: e.target.value,
|
||||
}));
|
||||
}}
|
||||
value={patient.relationship}
|
||||
// onBlur={formik.handleBlur}
|
||||
value={type=='display'?patientDataDiplay.relationship:patient.relationship}
|
||||
disabled={type=='display'}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={4} className='collapsable-form-style '>
|
||||
@ -315,8 +297,8 @@ export default function FamilyFormSection({handleFormSection2Data}:Props){
|
||||
spousePhone: e.target.value,
|
||||
}));
|
||||
}}
|
||||
value={patient.spousePhone}
|
||||
// onBlur={formik.handleBlur}
|
||||
value={type=='display'?patientDataDiplay.spousePhone:patient.spousePhone}
|
||||
disabled={type=='display'}
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
@ -404,7 +404,11 @@ export default function PatientForm({type}:Props){
|
||||
</AccordionSummary>
|
||||
|
||||
<AccordionDetails>
|
||||
<FamilyFormSection handleFormSection2Data={handleFormSection2Data}/>
|
||||
<FamilyFormSection
|
||||
handleFormSection2Data={handleFormSection2Data}
|
||||
patientDataDiplay={patientData.familyInformation}
|
||||
type={type}
|
||||
/>
|
||||
</AccordionDetails>
|
||||
</Accordion>
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ export default function PersonalSection({handleFormSection1Data,patientDataDipla
|
||||
)
|
||||
},[patient])
|
||||
|
||||
console.log(type,"sfsdfsdfsd")
|
||||
|
||||
|
||||
return(
|
||||
<>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user