diff --git a/components/myportal/viewall.js b/components/myportal/viewall.js
index 2e4ecfda..c5682ac8 100644
--- a/components/myportal/viewall.js
+++ b/components/myportal/viewall.js
@@ -261,24 +261,11 @@ const ViewAllResults = (props) => {
)}
-
+ {/*
{t("search:searchresults-site-address-label")}:
- {/* {getFormCollectionByID(appealTypeID).PrimaryIdAttribute ==
- "pinswg_dnsid"
- ? detailsObj.pinswg_projectlocation != null
- ? detailsObj.pinswg_projectlocation.indexOf(";") < 0
- ? detailsObj.pinswg_projectlocation
- : router.locale == "cy"
- ? detailsObj.pinswg_projectlocation.split(
- ";"
- )[1]
- : detailsObj.pinswg_projectlocation.split(
- ";"
- )[0]
- : ""
- : ""} */}
+
{currentView.viewKey == "awaitingSubmissionDetails" &&
_.has(searchDetailsObj[key], "pinswg_siteaddressline1")
? searchDetailsObj[key].pinswg_siteaddressline1
@@ -329,14 +316,12 @@ const ViewAllResults = (props) => {
) &&
searchDetailsObj[key].pinswg_siteaddressline2 !=
null &&
}
-
{currentView.viewKey == "myRepresentations" &&
_.has(
searchDetailsObj[key].pinswg_siteaddressline2
) &&
searchDetailsObj[key].pinswg_siteaddressline1 !=
null &&
}
-
{_.has(detailsObj, "pinswg_siteaddressline2") &&
detailsObj.pinswg_siteaddressline2 != null && (
@@ -359,7 +344,6 @@ const ViewAllResults = (props) => {
) &&
searchDetailsObj[key].pinswg_siteaddresstown !=
null &&
}
-
{currentView.viewKey == "myRepresentations" &&
_.has(
searchDetailsObj[key],
@@ -367,7 +351,6 @@ const ViewAllResults = (props) => {
) &&
searchDetailsObj[key].pinswg_siteaddresstown !=
null &&
}
-
{_.has(detailsObj, "pinswg_siteaddresstown") &&
detailsObj.pinswg_siteaddresstown != null &&
}
{currentView.viewKey == "awaitingSubmissionDetails" &&
@@ -402,7 +385,51 @@ const ViewAllResults = (props) => {
{_.has(detailsObj, "pinswg_siteaddresspostcode")
? detailsObj.pinswg_siteaddresspostcode
: ""}
+ */}
+
+
+
+ {t("search:searchresults-site-address-label")}:
+
+
+ {/* Helper function to extract address lines based on current view and data */}
+ {[
+ "pinswg_siteaddressline1",
+ "pinswg_siteaddressline2",
+ "pinswg_siteaddresstown",
+ "pinswg_siteaddresscounty",
+ "pinswg_siteaddresspostcode",
+ ].map((field, idx) => {
+ const isAwaitingSubmission =
+ currentView.viewKey ===
+ "awaitingSubmissionDetails";
+ const isMyRepresentations =
+ currentView.viewKey === "myRepresentations";
+ const searchValue = _.get(
+ searchDetailsObj,
+ `${key}.${field}`
+ );
+ const detailsValue = _.get(detailsObj, field);
+
+ // Determine the display value based on current view
+ const valueToDisplay =
+ (isAwaitingSubmission && searchValue) ||
+ (isMyRepresentations && searchValue) ||
+ detailsValue ||
+ "";
+
+ // Only render a line break if there is a valid value and it's not the last address part
+ const renderLineBreak = valueToDisplay && idx < 4; // Only insert
if it's not the last element
+
+ return (
+ <>
+ {valueToDisplay}
+ {renderLineBreak &&
}
+ >
+ );
+ })}
+
{currentView.viewKey == "awaitingSubmissionDetails"