Saving progress spinner and language updates
This commit is contained in:
+135
-24
@@ -21,9 +21,10 @@ const ViewAllResults = (props) => {
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
|
||||
var resultsArr = props[currentView.viewKey][currentView.viewKey].value || [
|
||||
{},
|
||||
];
|
||||
var resultsArr =
|
||||
currentView.viewKey == "awaitingSubmissionDetails"
|
||||
? props["awaitingSubmission"].awaitingSubmissionDetails.case
|
||||
: props[currentView.viewKey][currentView.viewKey].value || [];
|
||||
|
||||
function formatDates(dateObj) {
|
||||
var dateObj = new Date(dateObj);
|
||||
@@ -34,14 +35,17 @@ const ViewAllResults = (props) => {
|
||||
return dd + "/" + mm + "/" + yyyy;
|
||||
}
|
||||
|
||||
console.log(
|
||||
currentView.viewKey,
|
||||
props[currentView.viewKey],
|
||||
props[currentView.viewKey][currentView.viewKey].value
|
||||
);
|
||||
// console.log(
|
||||
// currentView.viewKey,
|
||||
// props[currentView.viewKey],
|
||||
// props[currentView.viewKey][currentView.viewKey].value
|
||||
// );
|
||||
|
||||
var searchDetailsObj =
|
||||
props[currentView.viewKey][currentView.viewKey + "Details"] || {};
|
||||
currentView.viewKey == "awaitingSubmissionDetails"
|
||||
? props["awaitingSubmission"].awaitingSubmissionDetails.value
|
||||
: props[currentView.viewKey][currentView.viewKey + "Details"] || [];
|
||||
|
||||
let resultsRowArr = [];
|
||||
resultsArr.map((item, key) => {
|
||||
let detailsObj = jsonpath.query(
|
||||
@@ -55,7 +59,7 @@ const ViewAllResults = (props) => {
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 govuk-!-padding-left-2">
|
||||
<Link
|
||||
href={
|
||||
currentView.viewKey == "awaitingSubmission"
|
||||
currentView.viewKey == "awaitingSubmissionDetails"
|
||||
? router.locale == "cy"
|
||||
? "/fymhorth/parhauigyflwyno"
|
||||
: "/myportal" +
|
||||
@@ -70,7 +74,7 @@ const ViewAllResults = (props) => {
|
||||
"&apt=" +
|
||||
resultsArr[key].pinswg_appealcasetype +
|
||||
"&casereference=" +
|
||||
resultsArr[key].pinswg_title +
|
||||
resultsArr[key].title +
|
||||
"&inid=" +
|
||||
resultsArr[key].incidentid
|
||||
: router.locale == "cy"
|
||||
@@ -135,45 +139,103 @@ const ViewAllResults = (props) => {
|
||||
)[0]
|
||||
: ""
|
||||
: ""} */}
|
||||
|
||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
||||
_.has(searchDetailsObj[key], "pinswg_siteaddressline1")
|
||||
? searchDetailsObj[key].pinswg_siteaddressline1
|
||||
: ""}
|
||||
|
||||
{_.has(detailsObj, "pinswg_siteaddressline1")
|
||||
? detailsObj.pinswg_siteaddressline1
|
||||
: ""}
|
||||
|
||||
{/* {detailsObj.pinswg_siteaddressline1 !=
|
||||
null && <br />} */}
|
||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
||||
_.has(
|
||||
searchDetailsObj[key],
|
||||
"pinswg_siteaddressline1"
|
||||
) &&
|
||||
searchDetailsObj[key].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
|
||||
: ""}
|
||||
|
||||
{_.has(detailsObj, "pinswg_siteaddressline1")
|
||||
? detailsObj.pinswg_siteaddressline2
|
||||
: ""}
|
||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
||||
_.has(
|
||||
searchDetailsObj[key],
|
||||
"pinswg_siteaddressline2"
|
||||
) &&
|
||||
searchDetailsObj[key].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
|
||||
: ""}
|
||||
|
||||
{_.has(detailsObj, "pinswg_siteaddresstown")
|
||||
? detailsObj.pinswg_siteaddresstown
|
||||
: ""}
|
||||
|
||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
||||
_.has(
|
||||
searchDetailsObj[key],
|
||||
"pinswg_siteaddresstown"
|
||||
) &&
|
||||
searchDetailsObj[key].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
|
||||
: ""}
|
||||
|
||||
{_.has(detailsObj, "pinswg_siteaddresscounty")
|
||||
? detailsObj.pinswg_siteaddresscounty
|
||||
: ""}
|
||||
|
||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
||||
_.has(
|
||||
searchDetailsObj[key],
|
||||
"pinswg_siteaddresscounty"
|
||||
) &&
|
||||
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
|
||||
: ""}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">
|
||||
{currentView.viewKey == "awaitingSubmission"
|
||||
? "Created on"
|
||||
{currentView.viewKey == "awaitingSubmissionDetails"
|
||||
? t("search:searchresults-created-on-label")
|
||||
: t("search:searchresults-applicant-label")}
|
||||
</span>
|
||||
|
||||
{currentView.viewKey == "awaitingSubmission"
|
||||
{currentView.viewKey == "awaitingSubmissionDetails"
|
||||
? formatDates(item.createdon)
|
||||
: _.has(detailsObj, [
|
||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue",
|
||||
@@ -189,19 +251,32 @@ const ViewAllResults = (props) => {
|
||||
<span className="results-visually-hidden">
|
||||
{t("search:searchresults-authority-label")}:
|
||||
</span>
|
||||
{_.has(detailsObj, [
|
||||
|
||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
||||
_.has(resultsArr[key], "pinswg_lpaname")
|
||||
? router.locale == "cy"
|
||||
? jsonpath.query(
|
||||
transLookup,
|
||||
'$..[?(@.value=="' +
|
||||
resultsArr[key].pinswg_lpaname +
|
||||
'")].value_cy'
|
||||
)
|
||||
: resultsArr[key].pinswg_lpaname || "N/A"
|
||||
: ""}
|
||||
|
||||
{_.has(resultsArr[key], [
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue",
|
||||
])
|
||||
? router.locale == "cy"
|
||||
? jsonpath.query(
|
||||
transLookup,
|
||||
'$..[?(@.value=="' +
|
||||
item[
|
||||
resultsArr[key][
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
] +
|
||||
'")].value_cy'
|
||||
)
|
||||
: detailsObj[
|
||||
: resultsArr[key][
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
] || "N/A"
|
||||
: ""}
|
||||
@@ -210,7 +285,20 @@ const ViewAllResults = (props) => {
|
||||
<span className="results-visually-hidden">
|
||||
{t("search:searchresults-case-type-label")}:
|
||||
</span>
|
||||
{router.locale == "cy"
|
||||
|
||||
{currentView.viewKey == "awaitingSubmissionDetails"
|
||||
? router.locale == "cy"
|
||||
? jsonpath.query(
|
||||
transLookup,
|
||||
'$..[?(@.value=="' +
|
||||
getFormCollectionByID(
|
||||
item.pinswg_appealcasetype
|
||||
).value +
|
||||
'")].value_cy'
|
||||
)
|
||||
: getFormCollectionByID(item.pinswg_appealcasetype)
|
||||
.value || "N/A"
|
||||
: router.locale == "cy"
|
||||
? jsonpath.query(
|
||||
transLookup,
|
||||
'$..[?(@.value=="' +
|
||||
@@ -227,7 +315,22 @@ const ViewAllResults = (props) => {
|
||||
<span className="results-visually-hidden">
|
||||
{t("search:searchresults-status-label")}:
|
||||
</span>
|
||||
{router.locale == "cy"
|
||||
|
||||
{currentView.viewKey == "awaitingSubmissionDetails"
|
||||
? router.locale == "cy"
|
||||
? jsonpath.query(
|
||||
transLookup,
|
||||
'$..[?(@.statuscode=="' +
|
||||
item.statuscode +
|
||||
'")].value_cy'
|
||||
)
|
||||
: jsonpath.query(
|
||||
transLookup,
|
||||
'$..[?(@.statuscode=="' +
|
||||
item.statuscode +
|
||||
'")].value'
|
||||
) || "N/A"
|
||||
: router.locale == "cy"
|
||||
? jsonpath.query(
|
||||
transLookup,
|
||||
'$..[?(@.value=="' +
|
||||
@@ -249,7 +352,14 @@ const ViewAllResults = (props) => {
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-full">
|
||||
<h1 className="govuk-heading-xl govuk-!-margin-bottom-7">
|
||||
{currentView.viewName}
|
||||
{currentView.viewKey == "awaitingSubmissionDetails" &&
|
||||
t("myportal:awatitingsubmission-card-title")}
|
||||
{currentView.viewKey == "watchedCases" &&
|
||||
t("myportal:watchedcases-card-title")}
|
||||
{currentView.viewKey == "myCases" &&
|
||||
t("myportal:mycases-card-title")}
|
||||
{currentView.viewKey == "myRepresentations" &&
|
||||
t("myportal:myrepresentations-card-title")}
|
||||
</h1>
|
||||
|
||||
<dl className="govuk-summary-list govuk-!-margin-bottom-9 results">
|
||||
@@ -260,9 +370,10 @@ const ViewAllResults = (props) => {
|
||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||
{t("search:searchresults-site-address-label")}
|
||||
</dd>
|
||||
{currentView.viewKey == "awaitingSubmission" ? (
|
||||
{currentView.viewKey ==
|
||||
"awaitingSubmissionDetails" ? (
|
||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||
Created on
|
||||
{t("search:searchresults-created-on-label")}{" "}
|
||||
</dd>
|
||||
) : (
|
||||
<dd className="govuk-summary-list__key govuk-!-font-size-16">
|
||||
|
||||
Reference in New Issue
Block a user