Added service stage status and delete functions
This commit is contained in:
+110
-34
@@ -3,6 +3,8 @@ import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { setCurrentReference } from "../../store/currentView/action";
|
||||
import { connect } from "react-redux";
|
||||
import jsonpath from "jsonpath";
|
||||
import transLookup from "../../data/lookuptranslations.json";
|
||||
|
||||
const ViewAllResults = (props) => {
|
||||
const {
|
||||
@@ -21,8 +23,16 @@ const ViewAllResults = (props) => {
|
||||
var resultsArr = props[currentView.viewKey][currentView.viewKey].value || [
|
||||
{},
|
||||
];
|
||||
var searchDetailsObj =
|
||||
props[currentView.viewKey][currentView.viewKey + "Details"] || {};
|
||||
let resultsRowArr = [];
|
||||
Object.keys(resultsArr).map((key, index) => {
|
||||
resultsArr.map((item, key) => {
|
||||
let detailsObj = jsonpath.query(
|
||||
searchDetailsObj,
|
||||
"$..value[?(@.pinswg_name=='" + item.pinswg_title + "')]"
|
||||
);
|
||||
detailsObj = detailsObj[0];
|
||||
|
||||
resultsRowArr.push(
|
||||
<div className="govuk-summary-list__row" key={key}>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 govuk-!-padding-left-2">
|
||||
@@ -42,21 +52,21 @@ const ViewAllResults = (props) => {
|
||||
setCurrentReference({
|
||||
"currentReference":
|
||||
currentView.viewKey != "watchedCases"
|
||||
? resultsArr[index].ticketnumber
|
||||
: resultsArr[index][
|
||||
? resultsArr[key].ticketnumber
|
||||
: resultsArr[key][
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
],
|
||||
|
||||
"currentType": currentView.viewKey,
|
||||
"incidentid":
|
||||
currentView.viewKey != "watchedCases"
|
||||
? resultsArr[index].incidentid
|
||||
: resultsArr[index][
|
||||
" _pinswg_watchedcase_value"
|
||||
? resultsArr[key].incidentid
|
||||
: resultsArr[key][
|
||||
"_pinswg_watchedcase_value"
|
||||
],
|
||||
|
||||
"appealType":
|
||||
resultsArr[index].pinswg_appealcasetype,
|
||||
resultsArr[key].pinswg_appealcasetype,
|
||||
});
|
||||
}}
|
||||
>
|
||||
@@ -65,8 +75,8 @@ const ViewAllResults = (props) => {
|
||||
</span>
|
||||
|
||||
{currentView.viewKey != "watchedCases"
|
||||
? resultsArr[index].ticketnumber
|
||||
: resultsArr[index][
|
||||
? resultsArr[key].ticketnumber
|
||||
: resultsArr[key][
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
]}
|
||||
</a>
|
||||
@@ -74,42 +84,108 @@ const ViewAllResults = (props) => {
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">
|
||||
Site Address:{" "}
|
||||
{t("search:searchresults-site-address-label")}:
|
||||
</span>
|
||||
{resultsArr[index].address1}
|
||||
<br /> {resultsArr[index].town}
|
||||
<br />
|
||||
{resultsArr[index].postcode}
|
||||
{_.has(detailsObj, "pinswg_siteaddressline1")
|
||||
? detailsObj.pinswg_siteaddressline1
|
||||
: ""}
|
||||
|
||||
{/* {detailsObj.pinswg_siteaddressline1 !=
|
||||
null && <br />} */}
|
||||
|
||||
{_.has(detailsObj, "pinswg_siteaddressline1") &&
|
||||
detailsObj.pinswg_siteaddressline1 != null && <br />}
|
||||
|
||||
{_.has(detailsObj, "pinswg_siteaddressline1")
|
||||
? detailsObj.pinswg_siteaddressline2
|
||||
: ""}
|
||||
|
||||
{_.has(detailsObj, "pinswg_siteaddressline2") &&
|
||||
detailsObj.pinswg_siteaddressline2 != null && <br />}
|
||||
{_.has(detailsObj, "pinswg_siteaddresstown")
|
||||
? detailsObj.pinswg_siteaddresstown
|
||||
: ""}
|
||||
{_.has(detailsObj, "pinswg_siteaddresstown") &&
|
||||
detailsObj.pinswg_siteaddresstown != null && <br />}
|
||||
|
||||
{_.has(detailsObj, "pinswg_siteaddresscounty")
|
||||
? detailsObj.pinswg_siteaddresscounty
|
||||
: ""}
|
||||
{_.has(detailsObj, "pinswg_siteaddresscounty") &&
|
||||
detailsObj.pinswg_siteaddresscounty != null && <br />}
|
||||
{_.has(detailsObj, "pinswg_siteaddresspostcode")
|
||||
? detailsObj.pinswg_siteaddresspostcode
|
||||
: ""}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">
|
||||
Appellant/Applicant:
|
||||
{t("search:searchresults-applicant-label")}:
|
||||
</span>
|
||||
Mr smith
|
||||
|
||||
{_.has(detailsObj, [
|
||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue",
|
||||
])
|
||||
? detailsObj[
|
||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
: resultsArr[key][
|
||||
"_customerid_value@OData.Community.Display.V1.FormattedValue"
|
||||
]}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">Authority:</span>
|
||||
{
|
||||
resultsArr[index][
|
||||
"_customerid_value@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
}
|
||||
<span className="results-visually-hidden">
|
||||
{t("search:searchresults-authority-label")}:
|
||||
</span>
|
||||
{_.has(detailsObj, [
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue",
|
||||
])
|
||||
? router.locale == "cy"
|
||||
? jsonpath.query(
|
||||
transLookup,
|
||||
'$..[?(@.value=="' +
|
||||
item[
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
] +
|
||||
'")].value_cy'
|
||||
)
|
||||
: detailsObj[
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
] || "N/A"
|
||||
: ""}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">Case Type:</span>
|
||||
{
|
||||
resultsArr[index][
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
}
|
||||
<span className="results-visually-hidden">
|
||||
{t("search:searchresults-case-type-label")}:
|
||||
</span>
|
||||
{router.locale == "cy"
|
||||
? jsonpath.query(
|
||||
transLookup,
|
||||
'$..[?(@.value=="' +
|
||||
item[
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
] +
|
||||
'")].value_cy'
|
||||
)
|
||||
: item[
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
] || "N/A"}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">Status:</span>
|
||||
{
|
||||
resultsArr[index][
|
||||
"statuscode@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
}
|
||||
<span className="results-visually-hidden">
|
||||
{t("search:searchresults-status-label")}:
|
||||
</span>
|
||||
{router.locale == "cy"
|
||||
? jsonpath.query(
|
||||
transLookup,
|
||||
'$..[?(@.value=="' +
|
||||
item[
|
||||
"statuscode@OData.Community.Display.V1.FormattedValue"
|
||||
] +
|
||||
'")].value_cy'
|
||||
)
|
||||
: item[
|
||||
"statuscode@OData.Community.Display.V1.FormattedValue"
|
||||
] || "N/A"}
|
||||
</dd>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user