updated view all

This commit is contained in:
2023-04-21 10:36:19 +01:00
parent 98ed833a47
commit dc43d7f2b4
7 changed files with 180 additions and 44 deletions
+157 -28
View File
@@ -35,15 +35,11 @@ const ViewAllResults = (props) => {
return dd + "/" + mm + "/" + yyyy;
}
// console.log(
// currentView.viewKey,
// props[currentView.viewKey],
// props[currentView.viewKey][currentView.viewKey].value
// );
var searchDetailsObj =
currentView.viewKey == "awaitingSubmissionDetails"
? props["awaitingSubmission"].awaitingSubmissionDetails.value
: currentView.viewKey == "myRepresentations"
? props["myRepresentations"]["myRepresentationsDetails"]
: props[currentView.viewKey][currentView.viewKey + "Details"] || [];
let resultsRowArr = [];
@@ -54,6 +50,13 @@ const ViewAllResults = (props) => {
);
detailsObj = detailsObj[0];
//console.log(searchDetailsObj[key]);
// searchDetailsObj[key] =
// currentView.viewKey == "myRepresentations"
// ? searchDetailsObj[key].value[0]
// : searchDetailsObj[key];
resultsRowArr.push(
<div className="govuk-summary-list__row" key={key}>
<dd className="govuk-summary-list__value govuk-!-font-size-16 govuk-!-padding-left-2">
@@ -110,11 +113,13 @@ const ViewAllResults = (props) => {
}}
>
<span className="results-visually-hidden">
Case Reference:
{t("search:searchresults-case-reference-label")}
:
</span>
{currentView.viewKey != "watchedCases"
? resultsArr[key].ticketnumber
? currentView.viewKey == "myRepresentations"
? resultsArr[key].casereference
: resultsArr[key].ticketnumber
: resultsArr[key][
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
]}
@@ -139,16 +144,23 @@ const ViewAllResults = (props) => {
)[0]
: ""
: ""} */}
{currentView.viewKey == "awaitingSubmissionDetails" &&
_.has(searchDetailsObj[key], "pinswg_siteaddressline1")
? searchDetailsObj[key].pinswg_siteaddressline1
: ""}
{_.has(detailsObj, "pinswg_siteaddressline1")
? detailsObj.pinswg_siteaddressline1
: ""}
{currentView.viewKey == "myRepresentations" &&
_.has(
searchDetailsObj[key].value[0],
"pinswg_siteaddressline1"
)
? searchDetailsObj[key].value[0].pinswg_siteaddressline1
: ""}
{_.has(detailsObj, "pinswg_siteaddressline1")
? detailsObj.pinswg_siteaddressline1
: ""}
{currentView.viewKey == "awaitingSubmissionDetails" &&
_.has(
searchDetailsObj[key],
@@ -156,15 +168,26 @@ const ViewAllResults = (props) => {
) &&
searchDetailsObj[key].pinswg_siteaddressline1 !=
null && <br />}
{currentView.viewKey == "myRepresentations" &&
_.has(
searchDetailsObj[key].value[0],
"pinswg_siteaddressline1"
) &&
searchDetailsObj[key].value[0]
.pinswg_siteaddressline1 != null && <br />}
{_.has(detailsObj, "pinswg_siteaddressline1") &&
detailsObj.pinswg_siteaddressline1 != null && <br />}
{currentView.viewKey == "awaitingSubmissionDetails" &&
_.has(searchDetailsObj[key], "pinswg_siteaddressline1")
? searchDetailsObj[key].pinswg_siteaddressline2
: ""}
{currentView.viewKey == "myRepresentations" &&
_.has(
searchDetailsObj[key].value[0],
"pinswg_siteaddressline1"
)
? searchDetailsObj[key].value[0].pinswg_siteaddressline2
: ""}
{_.has(detailsObj, "pinswg_siteaddressline1")
? detailsObj.pinswg_siteaddressline2
: ""}
@@ -176,18 +199,30 @@ const ViewAllResults = (props) => {
searchDetailsObj[key].pinswg_siteaddressline2 !=
null && <br />}
{currentView.viewKey == "myRepresentations" &&
_.has(
searchDetailsObj[key].value[0],
"pinswg_siteaddressline2"
) &&
searchDetailsObj[key].value[0]
.pinswg_siteaddressline2 != null && <br />}
{_.has(detailsObj, "pinswg_siteaddressline2") &&
detailsObj.pinswg_siteaddressline2 != null && <br />}
{currentView.viewKey == "awaitingSubmissionDetails" &&
_.has(searchDetailsObj[key], "pinswg_siteaddresstown")
? searchDetailsObj[key].pinswg_siteaddresstown
: ""}
{currentView.viewKey == "myRepresentations" &&
_.has(
searchDetailsObj[key].value[0],
"pinswg_siteaddresstown"
)
? searchDetailsObj[key].value[0].pinswg_siteaddresstown
: ""}
{_.has(detailsObj, "pinswg_siteaddresstown")
? detailsObj.pinswg_siteaddresstown
: ""}
{currentView.viewKey == "awaitingSubmissionDetails" &&
_.has(
searchDetailsObj[key],
@@ -196,18 +231,31 @@ const ViewAllResults = (props) => {
searchDetailsObj[key].pinswg_siteaddresstown !=
null && <br />}
{currentView.viewKey == "myRepresentations" &&
_.has(
searchDetailsObj[key].value[0],
"pinswg_siteaddresstown"
) &&
searchDetailsObj[key].value[0].pinswg_siteaddresstown !=
null && <br />}
{_.has(detailsObj, "pinswg_siteaddresstown") &&
detailsObj.pinswg_siteaddresstown != null && <br />}
{currentView.viewKey == "awaitingSubmissionDetails" &&
_.has(searchDetailsObj[key], "pinswg_siteaddresscounty")
? searchDetailsObj[key].pinswg_siteaddresscounty
: ""}
{currentView.viewKey == "myRepresentations" &&
_.has(
searchDetailsObj[key].value[0],
"pinswg_siteaddresscounty"
)
? searchDetailsObj[key].value[0]
.pinswg_siteaddresscounty
: ""}
{_.has(detailsObj, "pinswg_siteaddresscounty")
? detailsObj.pinswg_siteaddresscounty
: ""}
{currentView.viewKey == "awaitingSubmissionDetails" &&
_.has(
searchDetailsObj[key],
@@ -215,15 +263,12 @@ const ViewAllResults = (props) => {
) &&
searchDetailsObj[key].pinswg_siteaddresscounty !=
null && <br />}
{_.has(detailsObj, "pinswg_siteaddresscounty") &&
detailsObj.pinswg_siteaddresscounty != null && <br />}
{currentView.viewKey == "awaitingSubmissionDetails" &&
_.has(searchDetailsObj[key], "pinswg_siteaddresspostcode")
? searchDetailsObj[key].pinswg_siteaddresspostcode
: ""}
{_.has(detailsObj, "pinswg_siteaddresspostcode")
? detailsObj.pinswg_siteaddresspostcode
: ""}
@@ -234,7 +279,6 @@ const ViewAllResults = (props) => {
? t("search:searchresults-created-on-label")
: t("search:searchresults-applicant-label")}
</span>
{currentView.viewKey == "awaitingSubmissionDetails"
? formatDates(item.createdon)
: _.has(detailsObj, [
@@ -243,6 +287,10 @@ const ViewAllResults = (props) => {
? detailsObj[
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
]
: currentView.viewKey == "myRepresentations"
? searchDetailsObj[key].value[0][
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
]
: resultsArr[key][
"_customerid_value@OData.Community.Display.V1.FormattedValue"
]}
@@ -251,7 +299,6 @@ const ViewAllResults = (props) => {
<span className="results-visually-hidden">
{t("search:searchresults-authority-label")}:
</span>
{currentView.viewKey == "awaitingSubmissionDetails" &&
_.has(resultsArr[key], "pinswg_lpaname")
? router.locale == "cy"
@@ -263,7 +310,6 @@ const ViewAllResults = (props) => {
)
: resultsArr[key].pinswg_lpaname || "N/A"
: ""}
{_.has(resultsArr[key], [
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue",
])
@@ -280,6 +326,51 @@ const ViewAllResults = (props) => {
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
] || "N/A"
: ""}
{_.has(searchDetailsObj[key], [
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue",
])
? router.locale == "cy"
? jsonpath.query(
transLookup,
'$..[?(@.value=="' +
searchDetailsObj[key].value[0][
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValuee"
] +
'")].value_cy'
)
: searchDetailsObj[key].value[0][
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
] || "N/A"
: ""}
{_.has(resultsArr[key], [
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue",
])
? router.locale == "cy"
? jsonpath.query(
transLookup,
'$..[?(@.value=="' +
resultsArr[key][
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValuee"
] +
'")].value_cy'
)
: resultsArr[key][
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
] ||
(currentView.viewKey == "myRepresentations"
? ""
: "N/A")
: currentView.viewKey == "myRepresentations" &&
router.locale == "cy" &&
jsonpath.query(
transLookup,
'$..[?(@.value=="' +
searchDetailsObj[key].value[0][
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
] +
'")].value_cy'
)}
qqq
</dd>
<dd className="govuk-summary-list__value govuk-!-font-size-16">
<span className="results-visually-hidden">
@@ -309,7 +400,32 @@ const ViewAllResults = (props) => {
)
: item[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
] || "N/A"}
] ||
(currentView.viewKey == "myRepresentations"
? ""
: "N/A")}
{currentView.viewKey == "myRepresentations" &&
(router.locale == "cy"
? jsonpath.query(
transLookup,
'$..[?(@.value=="' +
getFormCollectionByID(
searchDetailsObj[key].value[0][
"pinswg_procedure"
]
).value +
'")].value_cy'
)[0]
: getFormCollectionByID(
searchDetailsObj[key].value[0][
"pinswg_procedure"
]
).value)}
{_.has(
searchDetailsObj[key],
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
)}
</dd>
<dd className="govuk-summary-list__value govuk-!-font-size-16">
<span className="results-visually-hidden">
@@ -330,6 +446,19 @@ const ViewAllResults = (props) => {
item.statuscode +
'")].value'
) || "N/A"
: currentView.viewKey == "myRepresentations"
? router.locale == "cy"
? jsonpath.query(
transLookup,
'$..[?(@.value=="' +
searchDetailsObj[key].value[0][
"statuscode@OData.Community.Display.V1.FormattedValue"
] +
'")].value_cy'
)
: searchDetailsObj[key].value[0][
"statuscode@OData.Community.Display.V1.FormattedValue"
] || "N/A"
: router.locale == "cy"
? jsonpath.query(
transLookup,