From 160f98edfb9312b2a6fdc84ae1e892b1e2ad7869 Mon Sep 17 00:00:00 2001 From: sonika <> Date: Tue, 5 Sep 2023 18:38:53 +0530 Subject: [PATCH] section 3 display --- .../PatientForm/FamilyFormSection2.tsx | 2 - .../PatientForm/MedicalHistorySection3.tsx | 76 ++++++++----------- src/Components/PatientForm/PatientForm.tsx | 5 +- 3 files changed, 37 insertions(+), 46 deletions(-) diff --git a/src/Components/PatientForm/FamilyFormSection2.tsx b/src/Components/PatientForm/FamilyFormSection2.tsx index 4216d62..f1ad09c 100644 --- a/src/Components/PatientForm/FamilyFormSection2.tsx +++ b/src/Components/PatientForm/FamilyFormSection2.tsx @@ -72,8 +72,6 @@ export default function FamilyFormSection({handleFormSection2Data,patientDataDip ) },[patient]) - console.log(type,"sfsdfsdfsd") - return( <> diff --git a/src/Components/PatientForm/MedicalHistorySection3.tsx b/src/Components/PatientForm/MedicalHistorySection3.tsx index c6897bb..3f7211d 100644 --- a/src/Components/PatientForm/MedicalHistorySection3.tsx +++ b/src/Components/PatientForm/MedicalHistorySection3.tsx @@ -18,19 +18,6 @@ interface Patient { 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 = { handleFormSection3Data:( physicianname?: string |undefined, @@ -45,9 +32,11 @@ type Props = { visitDetails?: string |undefined, cellPhoneProvider?: string |undefined, )=> void + patientDataDiplay:any; + type:string; } -export default function MedicalHistoryForm({handleFormSection3Data}:Props){ +export default function MedicalHistoryForm({handleFormSection3Data,patientDataDiplay,type}:Props){ const [patient, setPatient] = React.useState({ physicianname: '', @@ -78,6 +67,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){ patient.cellPhoneProvider, ) },[patient]) + + console.log("patientDataDiplay",patientDataDiplay) return( <> @@ -96,8 +87,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){ physicianname: e.target.value, })); }} - value={patient.physicianname} - // onBlur={formik.handleBlur} + value={type=='display'?patientDataDiplay.physicianname:patient.physicianname} + disabled={type=='display'} /> @@ -111,8 +102,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){ physiciancity: e.target.value, })); }} - value={patient.physiciancity} - // onBlur={formik.handleBlur} + value={type=='display'?patientDataDiplay.physiciancity:patient.physiciancity} + disabled={type=='display'} /> @@ -126,8 +117,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){ physicianstate: e.target.value, })); }} - value={patient.physicianstate} - // onBlur={formik.handleBlur} + value={type=='display'?patientDataDiplay.physicianstate:patient.physicianstate} + disabled={type=='display'} /> @@ -142,8 +133,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){ physicianphone: e.target.value, })); }} - value={patient.physicianphone} - // onBlur={formik.handleBlur} + value={type=='display'?patientDataDiplay.physicianphone:patient.physicianphone} + disabled={type=='display'} /> @@ -158,9 +149,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){ Previous Chiropractic Care: { setPatient((prevValues) => ({ @@ -170,8 +160,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){ }} sx={{display:'flex', flexDirection:'row'}} > - } label="Yes" /> - } label="No" /> + } label="Yes" /> + } label="No" /> @@ -187,8 +177,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){ chiropractorName: e.target.value, })); }} - value={patient.chiropractorName} - // onBlur={formik.handleBlur} + value={type=='display'?patientDataDiplay.chiropractorName:patient.chiropractorName} + disabled={type=='display'} /> @@ -203,8 +193,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){ chiropractorState: e.target.value, })); }} - value={patient.chiropractorState} - // onBlur={formik.handleBlur} + value={type=='display'?patientDataDiplay.chiropractorState:patient.chiropractorState} + disabled={type=='display'} /> @@ -215,7 +205,7 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){ { setPatient((prevValues) => ({ @@ -225,8 +215,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){ }} sx={{display:'flex', flexDirection:'row'}} > - } label="Yes" /> - } label="No" /> + } label="Yes" /> + } label="No" /> @@ -237,7 +227,7 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){ { setPatient((prevValues) => ({ @@ -247,12 +237,12 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){ }} sx={{display:'flex', flexDirection:'row'}} > - } label="Friend" /> - } label="Relative" /> - } label="Physician" /> - } label="Instagram" /> - } label="Google" /> - } label="Others" /> + } label="Friend" /> + } label="Relative" /> + } label="Physician" /> + } label="Instagram" /> + } label="Google" /> + } label="Others" /> @@ -263,7 +253,7 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){ { setPatient((prevValues) => ({ @@ -273,8 +263,8 @@ export default function MedicalHistoryForm({handleFormSection3Data}:Props){ }} sx={{display:'flex', flexDirection:'row'}} > - } label="Email" /> - } label="Text" /> + } label="Email" /> + } label="Text" /> diff --git a/src/Components/PatientForm/PatientForm.tsx b/src/Components/PatientForm/PatientForm.tsx index 329811a..20abffc 100644 --- a/src/Components/PatientForm/PatientForm.tsx +++ b/src/Components/PatientForm/PatientForm.tsx @@ -418,7 +418,10 @@ export default function PatientForm({type}:Props){ - +