From 3a0920be39f21b1be3491e1bcc0a16ef3b02288c Mon Sep 17 00:00:00 2001
From: SakthivelG <sakthivel.govindan@tarento.com>
Date: Mon, 11 Apr 2022 17:25:13 +0530
Subject: [PATCH] fix: defect 57937

---
 src/layouts/Inspector/ConsentFormView.tsx        | 16 ++++++++++++----
 src/layouts/Inspector/FormView.tsx               |  9 ++++++++-
 .../Regulator/ReviewApplicationLayout.tsx        | 14 ++++++++++++--
 3 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/src/layouts/Inspector/ConsentFormView.tsx b/src/layouts/Inspector/ConsentFormView.tsx
index 136b347..540f07d 100644
--- a/src/layouts/Inspector/ConsentFormView.tsx
+++ b/src/layouts/Inspector/ConsentFormView.tsx
@@ -200,13 +200,23 @@ export const ConsentFormView = ({
                     defaultValues: k.defaultValues,
                     fieldType: k.fieldType,
                     isCorrect:
+                      tempArrayTwo &&
+                      tempArrayTwo[n].fields.length &&
                       tempArrayTwo[n].fields[k.label]["value"] === "correct"
                         ? true
                         : false,
                     inspectionValue:
+                      tempArrayTwo &&
+                      tempArrayTwo[n].fields.length &&
                       tempArrayTwo[n].fields[k.label]["inspectionValue"],
-                    comments: tempArrayTwo[n].fields[k.label]["comments"],
-                    attachments: tempArrayTwo[n].fields[k.label]["attachments"],
+                    comments:
+                      tempArrayTwo &&
+                      tempArrayTwo[n].fields.length &&
+                      tempArrayTwo[n].fields[k.label]["comments"],
+                    attachments:
+                      tempArrayTwo &&
+                      tempArrayTwo[n].fields.length &&
+                      tempArrayTwo[n].fields[k.label]["attachments"],
                   });
                 }
               });
@@ -856,13 +866,11 @@ export const ConsentFormView = ({
                                   </div>
 
                                   <div className="mt-3">
-                                   
                                     <InspectCheckOne
                                       label="Is the given information found correct?"
                                       inspectionValue={k.inspectionValue}
                                       disableEdit={true}
                                       showAttachment={false}
-                                      
                                       attachments={k.attachments}
                                       children={
                                         <div className="d-flex flex-row">
diff --git a/src/layouts/Inspector/FormView.tsx b/src/layouts/Inspector/FormView.tsx
index 0b176f5..cf640c5 100644
--- a/src/layouts/Inspector/FormView.tsx
+++ b/src/layouts/Inspector/FormView.tsx
@@ -192,12 +192,19 @@ export const FormView = ({ applicationData, formData }: FormViewProps) => {
                     defaultValues: k.defaultValues,
                     fieldType: k.fieldType,
                     isCorrect:
+                      tempArrayTwo &&
+                      tempArrayTwo[n].fields.length &&
                       tempArrayTwo[n].fields[k.label]["value"] === "correct"
                         ? true
                         : false,
                     inspectionValue:
+                      tempArrayTwo &&
+                      tempArrayTwo[n].fields.length &&
                       tempArrayTwo[n].fields[k.label]["inspectionValue"],
-                    comments: tempArrayTwo[n].fields[k.label]["comments"],
+                    comments:
+                      tempArrayTwo &&
+                      tempArrayTwo[n].fields.length &&
+                      tempArrayTwo[n].fields[k.label]["comments"],
                     attachments: [],
                   });
                 }
diff --git a/src/layouts/Regulator/ReviewApplicationLayout.tsx b/src/layouts/Regulator/ReviewApplicationLayout.tsx
index 19132c8..d09d74f 100644
--- a/src/layouts/Regulator/ReviewApplicationLayout.tsx
+++ b/src/layouts/Regulator/ReviewApplicationLayout.tsx
@@ -189,13 +189,23 @@ export const ReviewApplicationLayout = ({
                     defaultValues: k.defaultValues,
                     fieldType: k.fieldType,
                     isCorrect:
+                      tempArrayTwo &&
+                      tempArrayTwo[n].fields.length &&
                       tempArrayTwo[n].fields[k.label]["value"] === "correct"
                         ? true
                         : false,
                     inspectionValue:
+                      tempArrayTwo &&
+                      tempArrayTwo[n].fields.length &&
                       tempArrayTwo[n].fields[k.label]["inspectionValue"],
-                    comments: tempArrayTwo[n].fields[k.label]["comments"],
-                    attachments: tempArrayTwo[n].fields[k.label]["attachments"],
+                    comments:
+                      tempArrayTwo &&
+                      tempArrayTwo[n].fields.length &&
+                      tempArrayTwo[n].fields[k.label]["comments"],
+                    attachments:
+                      tempArrayTwo &&
+                      tempArrayTwo[n].fields.length &&
+                      tempArrayTwo[n].fields[k.label]["attachments"],
                   });
                 }
               });
-- 
GitLab