From 24a9a71c0401f17f3b913cc804dfe1929e3a7b0d Mon Sep 17 00:00:00 2001
From: sonika <>
Date: Fri, 8 Sep 2023 15:55:04 +0530
Subject: [PATCH] undefined display state handeling
---
src/Components/Helper/SignatureComponent.tsx | 1 -
.../PatientForm/FamilyFormSection2.tsx | 24 ++++++-------
.../PatientForm/MedicalHistorySection3.tsx | 21 ++++++-----
src/Components/PatientForm/OtherDetails8.tsx | 14 ++++----
.../PatientForm/PainAnalysisSection4.tsx | 8 ++---
src/Components/PatientForm/PastTreatment5.tsx | 24 ++++++-------
src/Components/PatientForm/PatientForm.tsx | 4 +--
.../PatientForm/PersonalSection1.tsx | 24 ++++++-------
.../RecreationalHobbiesSection7.tsx | 36 +++++++++----------
.../PatientForm/SyestemReviewSection6.tsx | 34 +++++++++---------
10 files changed, 94 insertions(+), 96 deletions(-)
diff --git a/src/Components/Helper/SignatureComponent.tsx b/src/Components/Helper/SignatureComponent.tsx
index abe196f..123e546 100644
--- a/src/Components/Helper/SignatureComponent.tsx
+++ b/src/Components/Helper/SignatureComponent.tsx
@@ -16,7 +16,6 @@ const SignatureComponent = ({signature,setSignature}:Props) => {
// setSignature(sigCanvas.current.toDataURL());
const save = () => {
- console.log("ajsdjby",sigCanvas.current.toDataURL())
setSignature(sigCanvas.current.toDataURL());
};
diff --git a/src/Components/PatientForm/FamilyFormSection2.tsx b/src/Components/PatientForm/FamilyFormSection2.tsx
index 7839ded..8192372 100644
--- a/src/Components/PatientForm/FamilyFormSection2.tsx
+++ b/src/Components/PatientForm/FamilyFormSection2.tsx
@@ -98,7 +98,7 @@ export default function FamilyFormSection({
name='maritalStatus'
defaultValue={
type == 'display'
- ? patientDataDiplay.maritalStatus
+ ? patientDataDiplay && patientDataDiplay.maritalStatus
: patient.maritalStatus
}
sx={{ display: 'flex', flexDirection: 'row' }}
@@ -167,7 +167,7 @@ export default function FamilyFormSection({
}}
value={
type == 'display'
- ? patientDataDiplay.numberOfChildren
+ ? patientDataDiplay && patientDataDiplay.numberOfChildren
: patient.numberOfChildren
}
disabled={type == 'display'}
@@ -196,7 +196,7 @@ export default function FamilyFormSection({
}}
value={
type == 'display'
- ? patientDataDiplay.occupation
+ ? patientDataDiplay && patientDataDiplay.occupation
: patient.occupation
}
disabled={type == 'display'}
@@ -225,7 +225,7 @@ export default function FamilyFormSection({
}}
value={
type == 'display'
- ? patientDataDiplay.hoursPerWeek
+ ? patientDataDiplay && patientDataDiplay.hoursPerWeek
: patient.hoursPerWeek
}
disabled={type == 'display'}
@@ -251,7 +251,7 @@ export default function FamilyFormSection({
}));
}}
value={
- type == 'display' ? patientDataDiplay.employer : patient.employer
+ type == 'display' ? patientDataDiplay && patientDataDiplay.employer : patient.employer
}
disabled={type == 'display'}
/>
@@ -279,7 +279,7 @@ export default function FamilyFormSection({
}}
value={
type == 'display'
- ? patientDataDiplay.businessPhone
+ ? patientDataDiplay && patientDataDiplay.businessPhone
: patient.businessPhone
}
disabled={type == 'display'}
@@ -322,7 +322,7 @@ export default function FamilyFormSection({
}}
value={
type == 'display'
- ? patientDataDiplay.spouseName
+ ? patientDataDiplay && patientDataDiplay.spouseName
: patient.spouseName
}
disabled={type == 'display'}
@@ -350,7 +350,7 @@ export default function FamilyFormSection({
}}
value={
type == 'display'
- ? patientDataDiplay.spouseEmployer
+ ? patientDataDiplay && patientDataDiplay.spouseEmployer
: patient.spouseEmployer
}
disabled={type == 'display'}
@@ -379,7 +379,7 @@ export default function FamilyFormSection({
}}
value={
type == 'display'
- ? patientDataDiplay.spouseBusinessPhone
+ ? patientDataDiplay && patientDataDiplay.spouseBusinessPhone
: patient.spouseBusinessPhone
}
disabled={type == 'display'}
@@ -412,7 +412,7 @@ export default function FamilyFormSection({
}}
value={
type == 'display'
- ? patientDataDiplay.emergencyContact
+ ? patientDataDiplay && patientDataDiplay.emergencyContact
: patient.emergencyContact
}
disabled={type == 'display'}
@@ -440,7 +440,7 @@ export default function FamilyFormSection({
}}
value={
type == 'display'
- ? patientDataDiplay.relationship
+ ? patientDataDiplay && patientDataDiplay.relationship
: patient.relationship
}
disabled={type == 'display'}
@@ -469,7 +469,7 @@ export default function FamilyFormSection({
}}
value={
type == 'display'
- ? patientDataDiplay.spousePhone
+ ? patientDataDiplay && patientDataDiplay.spousePhone
: patient.spousePhone
}
disabled={type == 'display'}
diff --git a/src/Components/PatientForm/MedicalHistorySection3.tsx b/src/Components/PatientForm/MedicalHistorySection3.tsx
index 67df552..a86c4d1 100644
--- a/src/Components/PatientForm/MedicalHistorySection3.tsx
+++ b/src/Components/PatientForm/MedicalHistorySection3.tsx
@@ -68,7 +68,6 @@ export default function MedicalHistoryForm({handleFormSection3Data,patientDataDi
)
},[patient])
- console.log("patientDataDiplay",patientDataDiplay)
return(
<>
@@ -93,7 +92,7 @@ export default function MedicalHistoryForm({handleFormSection3Data,patientDataDi
physicianname: e.target.value,
}));
}}
- value={type=='display'?patientDataDiplay.physicianname:patient.physicianname}
+ value={type=='display'? patientDataDiplay && patientDataDiplay.physicianname:patient.physicianname}
disabled={type=='display'}
/>
@@ -114,7 +113,7 @@ export default function MedicalHistoryForm({handleFormSection3Data,patientDataDi
physiciancity: e.target.value,
}));
}}
- value={type=='display'?patientDataDiplay.physiciancity:patient.physiciancity}
+ value={type=='display'? patientDataDiplay && patientDataDiplay.physiciancity:patient.physiciancity}
disabled={type=='display'}
/>
@@ -135,7 +134,7 @@ export default function MedicalHistoryForm({handleFormSection3Data,patientDataDi
physicianstate: e.target.value,
}));
}}
- value={type=='display'?patientDataDiplay.physicianstate:patient.physicianstate}
+ value={type=='display'? patientDataDiplay && patientDataDiplay.physicianstate:patient.physicianstate}
disabled={type=='display'}
/>
@@ -157,7 +156,7 @@ export default function MedicalHistoryForm({handleFormSection3Data,patientDataDi
physicianphone: e.target.value,
}));
}}
- value={type=='display'?patientDataDiplay.physicianphone:patient.physicianphone}
+ value={type=='display'? patientDataDiplay && patientDataDiplay.physicianphone:patient.physicianphone}
disabled={type=='display'}
/>
@@ -190,7 +189,7 @@ export default function MedicalHistoryForm({handleFormSection3Data,patientDataDi
Previous Chiropractic Care:
{
setPatient((prevValues) => ({
@@ -223,7 +222,7 @@ export default function MedicalHistoryForm({handleFormSection3Data,patientDataDi
chiropractorName: e.target.value,
}));
}}
- value={type=='display'?patientDataDiplay.chiropractorName:patient.chiropractorName}
+ value={type=='display'? patientDataDiplay && patientDataDiplay.chiropractorName:patient.chiropractorName}
disabled={type=='display'}
/>
@@ -245,7 +244,7 @@ export default function MedicalHistoryForm({handleFormSection3Data,patientDataDi
chiropractorState: e.target.value,
}));
}}
- value={type=='display'?patientDataDiplay.chiropractorState:patient.chiropractorState}
+ value={type=='display'? patientDataDiplay && patientDataDiplay.chiropractorState:patient.chiropractorState}
disabled={type=='display'}
/>
@@ -257,7 +256,7 @@ export default function MedicalHistoryForm({handleFormSection3Data,patientDataDi
{
setPatient((prevValues) => ({
@@ -279,7 +278,7 @@ export default function MedicalHistoryForm({handleFormSection3Data,patientDataDi
{
setPatient((prevValues) => ({
@@ -305,7 +304,7 @@ export default function MedicalHistoryForm({handleFormSection3Data,patientDataDi
{
setPatient((prevValues) => ({
diff --git a/src/Components/PatientForm/OtherDetails8.tsx b/src/Components/PatientForm/OtherDetails8.tsx
index 87b2475..5cf6538 100644
--- a/src/Components/PatientForm/OtherDetails8.tsx
+++ b/src/Components/PatientForm/OtherDetails8.tsx
@@ -92,7 +92,7 @@ export default function OtherDetails8({
label=''
value={
type == 'display'
- ? patientDataDiplay.familyHistory
+ ? patientDataDiplay && patientDataDiplay.familyHistory
: patient.familyHistory
}
disabled={type == 'display'}
@@ -111,7 +111,7 @@ export default function OtherDetails8({
{
setPatient((prevValues) => ({
@@ -148,7 +148,7 @@ export default function OtherDetails8({
{
setPatient((prevValues) => ({
@@ -180,7 +180,7 @@ export default function OtherDetails8({
sx={{ display: 'flex', flexDirection: 'row' }}
defaultValue={
type == 'display'
- ? patientDataDiplay.orthotics
+ ? patientDataDiplay && patientDataDiplay.orthotics
: patient.orthotics
}
onChange={(event) => {
@@ -222,7 +222,7 @@ export default function OtherDetails8({
{
@@ -294,7 +294,7 @@ export default function OtherDetails8({
{
@@ -254,7 +254,7 @@ export default function PastTreatment5({
}
value={
type == 'display'
- ? patientDataDiplay.ifYesOutcome
+ ? patientDataDiplay && patientDataDiplay.ifYesOutcome
: patient.ifYesOutcome
}
onChange={(event) => {
@@ -279,12 +279,12 @@ export default function PastTreatment5({
name='painDuration'
defaultValue={
type == 'display'
- ? patientDataDiplay.strokeBloodclotting
+ ? patientDataDiplay && patientDataDiplay.strokeBloodclotting
: patient.strokeBloodclotting
}
value={
type == 'display'
- ? patientDataDiplay.strokeBloodclotting
+ ? patientDataDiplay && patientDataDiplay.strokeBloodclotting
: patient.strokeBloodclotting
}
sx={{ display: 'flex', flexDirection: 'row' }}
@@ -326,7 +326,7 @@ export default function PastTreatment5({
name='treatmentGoal'
value={
type == 'display'
- ? patientDataDiplay.ifYesstrokeBloodclotting
+ ? patientDataDiplay && patientDataDiplay.ifYesstrokeBloodclotting
: patient.ifYesstrokeBloodclotting
}
disabled={
@@ -356,7 +356,7 @@ export default function PastTreatment5({
sx={{ display: 'flex', flexDirection: 'row' }}
defaultValue={
type == 'display'
- ? patientDataDiplay.dizzinessFetigue
+ ? patientDataDiplay && patientDataDiplay.dizzinessFetigue
: patient.dizzinessFetigue
}
onChange={(event) => {
@@ -398,7 +398,7 @@ export default function PastTreatment5({
disabled={patient.dizzinessFetigue !== 'Yes'}
value={
type == 'display'
- ? patientDataDiplay.ifyesdizzinessFetigue
+ ? patientDataDiplay && patientDataDiplay.ifyesdizzinessFetigue
: patient.ifyesdizzinessFetigue
}
onChange={(event) => {
@@ -425,7 +425,7 @@ export default function PastTreatment5({
sx={{ display: 'flex', flexDirection: 'row' }}
defaultValue={
type == 'display'
- ? patientDataDiplay.antiColligent
+ ? patientDataDiplay && patientDataDiplay.antiColligent
: patient.antiColligent
}
onChange={(event) => {
@@ -465,7 +465,7 @@ export default function PastTreatment5({
name='painDuration'
defaultValue={
type == 'display'
- ? patientDataDiplay.injuriesHospitalization
+ ? patientDataDiplay && patientDataDiplay.injuriesHospitalization
: patient.injuriesHospitalization
}
sx={{ display: 'flex', flexDirection: 'row' }}
@@ -519,7 +519,7 @@ export default function PastTreatment5({
name='treatmentGoal'
defaultValue={
type == 'display'
- ? patientDataDiplay.supplementsOrDrugs
+ ? patientDataDiplay && patientDataDiplay.supplementsOrDrugs
: patient.supplementsOrDrugs
}
disabled={type == 'display'}
diff --git a/src/Components/PatientForm/PatientForm.tsx b/src/Components/PatientForm/PatientForm.tsx
index 52edede..9aad041 100644
--- a/src/Components/PatientForm/PatientForm.tsx
+++ b/src/Components/PatientForm/PatientForm.tsx
@@ -413,7 +413,6 @@ export default function PatientForm({ type }: Props) {
JSON.parse(localStorage.getItem('patientData'))
: [];
-
return (
<>
{alertProps && alertProps.open && (
@@ -653,8 +652,9 @@ export default function PatientForm({ type }: Props) {
{type!=='display'?
<>
+
- Signature:
+ Signature:
diff --git a/src/Components/PatientForm/PersonalSection1.tsx b/src/Components/PatientForm/PersonalSection1.tsx
index 3c6414c..78fc6be 100644
--- a/src/Components/PatientForm/PersonalSection1.tsx
+++ b/src/Components/PatientForm/PersonalSection1.tsx
@@ -109,7 +109,7 @@ export default function PersonalSection({
name='fullName'
placeholder='Please enter your name'
value={
- type == 'display' ? patientDataDiplay.fullName : patient.fullName
+ type == 'display' ? patientDataDiplay && patientDataDiplay.fullName : patient.fullName
}
disabled={type == 'display'}
onChange={(e) => {
@@ -155,7 +155,7 @@ export default function PersonalSection({
placeholder='Please enter your cell Phone number'
value={
type == 'display'
- ? patientDataDiplay.cellPhone
+ ? patientDataDiplay && patientDataDiplay.cellPhone
: patient.cellPhone
}
disabled={type == 'display'}
@@ -208,7 +208,7 @@ export default function PersonalSection({
placeholder='Please enter your home phone'
value={
type == 'display'
- ? patientDataDiplay.homePhone
+ ? patientDataDiplay && patientDataDiplay.homePhone
: patient.homePhone
}
disabled={type == 'display'}
@@ -238,7 +238,7 @@ export default function PersonalSection({
label='Email'
name='email'
placeholder='Please enter your email'
- value={type == 'display' ? patientDataDiplay.email : patient.email}
+ value={type == 'display' ? patientDataDiplay && patientDataDiplay.email : patient.email}
disabled={type == 'display'}
onChange={(e) => {
setPatient((prevValues: any) => ({
@@ -281,7 +281,7 @@ export default function PersonalSection({
name='age'
type='number'
placeholder='Please enter your age'
- value={type == 'display' ? patientDataDiplay.age : patient.age}
+ value={type == 'display' ? patientDataDiplay && patientDataDiplay.age : patient.age}
disabled={type == 'display'}
onChange={(e) => {
setPatient((prevValues: any) => ({
@@ -322,7 +322,7 @@ export default function PersonalSection({
label='Date of Birth'
value={
type == 'display'
- ? patientDataDiplay.dateOfBirth
+ ? patientDataDiplay && patientDataDiplay.dateOfBirth
: birthDateValue
}
disabled={type == 'display'}
@@ -352,7 +352,7 @@ export default function PersonalSection({
name='socialSecurityNumber'
value={
type == 'display'
- ? patientDataDiplay.socialSecurityNumber
+ ? patientDataDiplay && patientDataDiplay.socialSecurityNumber
: patient.socialSecurityNumber
}
disabled={type == 'display'}
@@ -384,7 +384,7 @@ export default function PersonalSection({
name='mailingAddress'
value={
type == 'display'
- ? patientDataDiplay.mailingAddress
+ ? patientDataDiplay && patientDataDiplay.mailingAddress
: patient.mailingAddress
}
disabled={type == 'display'}
@@ -429,7 +429,7 @@ export default function PersonalSection({
variant='outlined'
label='State'
name='state'
- value={type == 'display' ? patientDataDiplay.state : patient.state}
+ value={type == 'display' ? patientDataDiplay && patientDataDiplay.state : patient.state}
disabled={type == 'display'}
onChange={(e) => {
setPatient((prevValues: any) => ({
@@ -453,7 +453,7 @@ export default function PersonalSection({
variant='outlined'
label='City'
name='city'
- value={type == 'display' ? patientDataDiplay.city : patient.city}
+ value={type == 'display' ? patientDataDiplay && patientDataDiplay.city : patient.city}
disabled={type == 'display'}
onChange={(e) => {
setPatient((prevValues: any) => ({
@@ -478,7 +478,7 @@ export default function PersonalSection({
label='Zip Code'
name='zipCode'
value={
- type == 'display' ? patientDataDiplay.zipCode : patient.zipCode
+ type == 'display' ? patientDataDiplay && patientDataDiplay.zipCode : patient.zipCode
}
disabled={type == 'display'}
onChange={(e) => {
@@ -507,7 +507,7 @@ export default function PersonalSection({
{
diff --git a/src/Components/PatientForm/RecreationalHobbiesSection7.tsx b/src/Components/PatientForm/RecreationalHobbiesSection7.tsx
index f57278f..6078b78 100644
--- a/src/Components/PatientForm/RecreationalHobbiesSection7.tsx
+++ b/src/Components/PatientForm/RecreationalHobbiesSection7.tsx
@@ -103,7 +103,7 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data,pati
multiline
variant="outlined"
label=""
- value={type=='display'?patientDataDiplay.hobbies:patient.hobbies}
+ value={type=='display'?patientDataDiplay && patientDataDiplay.hobbies:patient.hobbies}
disabled={type=='display'}
onChange={(event:any) => {
setPatient((prevValues) => ({
@@ -119,7 +119,7 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data,pati
Your education level:
{
setPatient((prevValues) => ({
...prevValues,
@@ -146,7 +146,7 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data,pati
{
setPatient((prevValues) => ({
...prevValues,
@@ -170,7 +170,7 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data,pati
variant="outlined"
label="Times per week?"
name='treatmentGoal'
- value={type=='display'?patientDataDiplay.excerciseExplanation:patient.excerciseExplanation}
+ value={type=='display'?patientDataDiplay && patientDataDiplay.excerciseExplanation:patient.excerciseExplanation}
onChange={(event) => {
setPatient((prevValues) => ({
...prevValues,
@@ -190,7 +190,7 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data,pati
{
setPatient((prevValues) => ({
...prevValues,
@@ -211,7 +211,7 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data,pati
sm={12} className='collapsable-form-style-form7'>
{
setPatient((prevValues) => ({
...prevValues,
@@ -255,7 +255,7 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data,pati
sm={12} className='collapsable-form-style-form7'>
{
setPatient((prevValues) => ({
...prevValues,
@@ -299,7 +299,7 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data,pati
sm={12} className='collapsable-form-style-form7'>
{
setPatient((prevValues) => ({
...prevValues,
@@ -343,7 +343,7 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data,pati
sm={12} className='collapsable-form-style-form7'>
{
setPatient((prevValues) => ({
...prevValues,
@@ -387,7 +387,7 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data,pati
sm={12} className='collapsable-form-style-form7'>
{
setPatient((prevValues) => ({
...prevValues,
@@ -431,7 +431,7 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data,pati
sm={12} className='collapsable-form-style-form7'>
{
setPatient((prevValues) => ({
...prevValues,
@@ -475,7 +475,7 @@ export default function RecreationalHobbiesSection7({handleFormSection7Data,pati
sm={12} className='collapsable-form-style-form7'>
{
@@ -161,7 +161,7 @@ export default function SystemReviewSection6({
name='painDuration'
defaultValue={
type == 'display'
- ? patientDataDiplay.IntestinesBowls
+ ? patientDataDiplay && patientDataDiplay.IntestinesBowls
: patient.IntestinesBowls
}
sx={{ display: 'flex', flexDirection: 'row' }}
@@ -202,7 +202,7 @@ export default function SystemReviewSection6({
name='painDuration'
defaultValue={
type == 'display'
- ? patientDataDiplay.jointsBones
+ ? patientDataDiplay && patientDataDiplay.jointsBones
: patient.jointsBones
}
sx={{ display: 'flex', flexDirection: 'row' }}
@@ -243,7 +243,7 @@ export default function SystemReviewSection6({
name='painDuration'
defaultValue={
type == 'display'
- ? patientDataDiplay.allergies
+ ? patientDataDiplay && patientDataDiplay.allergies
: patient.allergies
}
sx={{ display: 'flex', flexDirection: 'row' }}
@@ -284,7 +284,7 @@ export default function SystemReviewSection6({
name='painDuration'
defaultValue={
type == 'display'
- ? patientDataDiplay.earsNoseMouth
+ ? patientDataDiplay && patientDataDiplay.earsNoseMouth
: patient.earsNoseMouth
}
sx={{ display: 'flex', flexDirection: 'row' }}
@@ -324,7 +324,7 @@ export default function SystemReviewSection6({
{
@@ -363,7 +363,7 @@ export default function SystemReviewSection6({
{
@@ -403,7 +403,7 @@ export default function SystemReviewSection6({
name='painDuration'
defaultValue={
type == 'display'
- ? patientDataDiplay.psychological
+ ? patientDataDiplay && patientDataDiplay.psychological
: patient.psychological
}
sx={{ display: 'flex', flexDirection: 'row' }}
@@ -443,7 +443,7 @@ export default function SystemReviewSection6({
{
@@ -482,7 +482,7 @@ export default function SystemReviewSection6({
{
@@ -522,7 +522,7 @@ export default function SystemReviewSection6({
name='painDuration'
defaultValue={
type == 'display'
- ? patientDataDiplay.internalOrgans
+ ? patientDataDiplay && patientDataDiplay.internalOrgans
: patient.internalOrgans
}
sx={{ display: 'flex', flexDirection: 'row' }}
@@ -563,7 +563,7 @@ export default function SystemReviewSection6({
name='painDuration'
defaultValue={
type == 'display'
- ? patientDataDiplay.gynecological
+ ? patientDataDiplay && patientDataDiplay.gynecological
: patient.gynecological
}
sx={{ display: 'flex', flexDirection: 'row' }}
@@ -605,7 +605,7 @@ export default function SystemReviewSection6({
name='painDuration'
defaultValue={
type == 'display'
- ? patientDataDiplay.lungsBreathing
+ ? patientDataDiplay && patientDataDiplay.lungsBreathing
: patient.lungsBreathing
}
sx={{ display: 'flex', flexDirection: 'row' }}
@@ -645,7 +645,7 @@ export default function SystemReviewSection6({
{
@@ -684,7 +684,7 @@ export default function SystemReviewSection6({
{
@@ -724,7 +724,7 @@ export default function SystemReviewSection6({
name='painDuration'
defaultValue={
type == 'display'
- ? patientDataDiplay.prostate
+ ? patientDataDiplay && patientDataDiplay.prostate
: patient.prostate
}
sx={{ display: 'flex', flexDirection: 'row' }}
@@ -768,7 +768,7 @@ export default function SystemReviewSection6({
name='explanation'
value={
type == 'display'
- ? patientDataDiplay.explanation
+ ? patientDataDiplay && patientDataDiplay.explanation
: patient.explanation
}
disabled={type == 'display'}