+
+
+ sortDataBy("pinswg_name")}
+ className={
+ orderByState == "pinswg_name"
+ ? fieldSortState == "asc"
+ ? `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortAsc`
+ : `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortDesc`
+ : `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16`
+ }
+ >
+ {t("search:searchresults-case-reference-label")}
+
+
+
+ {t("search:searchresults-site-address-label")}
+
+
+
+ sortDataBy(
+ "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
+ )
+ }
+ className={
+ orderByState ==
+ "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
+ ? fieldSortState == "asc"
+ ? `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortAsc`
+ : `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortDesc`
+ : `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16`
+ }
+ >
+ {t("search:searchresults-applicant-label")}
+
+
+
+
+ sortDataBy("_pinswg_associatedlpa_value")
+ }
+ className={
+ orderByState ==
+ "_pinswg_associatedlpa_value"
+ ? fieldSortState == "asc"
+ ? `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortAsc`
+ : `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortDesc`
+ : `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16`
+ }
+ >
+ {t("search:searchresults-authority-label")}
+
+
+
+ sortDataBy("pinswg_appealType")}
+ className={
+ orderByState == "pinswg_appealcasetype"
+ ? fieldSortState == "asc"
+ ? `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortAsc`
+ : `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortDesc`
+ : `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16`
+ }
+ >
+ {t("search:searchresults-case-type-label")}
+
+
+
+ {/* {t("search:searchresults-status-label")} */}
+ sortDataBy("statuscode")}
+ className={
+ orderByState == "statuscode"
+ ? fieldSortState == "asc"
+ ? `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortAsc`
+ : `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortDesc`
+ : `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16`
+ }
+ >
+ {t("search:searchresults-status-label")}
+
+
+
+
+
+ {showSpinnerState == true ? (
+
+
+ {t("common:spinner-fetching-data")}
+
+
+
+ ) : (
+ resultsArrPaged.map((item, key) => {
+ let detailsObj = jsonpath(
+ '$..value[?(@.pinswg_name=="' +
+ item.pinswg_name +
+ '")]',
+ searchDetailsObj
+ );
+ detailsObj = detailsObj[0];
+ return (
+
+
+ {
+ // setCurrentReference({
+ // "ticketnumber":
+ // item.ticketnumber,
+ // "currentReference":
+ // item.title,
+ // "currentType":
+ // "searchResultsObj",
+ // "incidentid":
+ // item.incidentid,
+ // "appealType":
+ // item.pinswg_appealcasetype,
+ // "showLoginCheck":
+ // props.showLoginCheck,
+ // });
+ // }}
+ >
+
+ {t(
+ "search:searchresults-case-reference-label"
+ )}
+ :
+
+ {item.pinswg_name}
+
+
+
+
+ {t(
+ "search:searchresults-site-address-label"
+ )}
+ :
+
+ {_.has(
+ detailsObj,
+ "pinswg_projectlocation"
+ )
+ ? 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]
+ : ""
+ : ""}
+ {_.has(
+ detailsObj,
+ "pinswg_siteaddressline1"
+ )
+ ? detailsObj.pinswg_siteaddressline1
+ : ""}
+ {_.has(
+ detailsObj,
+ "pinswg_addressline1"
+ )
+ ? detailsObj.pinswg_addressline1
+ : ""}
+ {/* {detailsObj.pinswg_siteaddressline1 !=
+ null && } */}
+ {_.has(
+ detailsObj,
+ "pinswg_siteaddressline1"
+ ) &&
+ detailsObj.pinswg_siteaddressline1 !=
+ null && }
+ {_.has(
+ detailsObj,
+ "pinswg_addressline1"
+ ) &&
+ detailsObj.pinswg_addressline1 !=
+ null && }
+ {_.has(
+ detailsObj,
+ "pinswg_siteaddressline1"
+ )
+ ? detailsObj.pinswg_siteaddressline2
+ : ""}
+ {_.has(
+ detailsObj,
+ "pinswg_addressline1"
+ )
+ ? detailsObj.pinswg_addressline2
+ : ""}
+ {_.has(
+ detailsObj,
+ "pinswg_siteaddressline2"
+ ) &&
+ detailsObj.pinswg_siteaddressline2 !=
+ null && }
+ {_.has(
+ detailsObj,
+ "pinswg_addressline2"
+ ) &&
+ detailsObj.pinswg_addressline2 !=
+ null && }
+ {_.has(
+ detailsObj,
+ "pinswg_siteaddresstown"
+ )
+ ? detailsObj.pinswg_siteaddresstown
+ : ""}
+ {_.has(detailsObj, "pinswg_addresstown")
+ ? detailsObj.pinswg_addresstown
+ : ""}
+ {_.has(
+ detailsObj,
+ "pinswg_siteaddresstown"
+ ) &&
+ detailsObj.pinswg_siteaddresstown !=
+ null && }
+ {_.has(
+ detailsObj,
+ "pinswg_addresstown"
+ ) &&
+ detailsObj.pinswg_addresstown !=
+ null && }
+ {_.has(
+ detailsObj,
+ "pinswg_siteaddresscounty"
+ )
+ ? detailsObj.pinswg_siteaddresscounty
+ : ""}
+ {_.has(
+ detailsObj,
+ "pinswg_addresscounty"
+ )
+ ? detailsObj.pinswg_addresscounty
+ : ""}
+ {_.has(
+ detailsObj,
+ "pinswg_siteaddresscounty"
+ ) &&
+ detailsObj.pinswg_siteaddresscounty !=
+ null && }
+ {_.has(
+ detailsObj,
+ "pinswg_addresscounty"
+ ) &&
+ detailsObj.pinswg_addresscounty !=
+ null && }
+ {_.has(
+ detailsObj,
+ "pinswg_siteaddresspostcode"
+ )
+ ? detailsObj.pinswg_siteaddresspostcode
+ : ""}
+ {_.has(detailsObj, "pinswg_postcode")
+ ? detailsObj.pinswg_postcode
+ : ""}
+
+
+
+ {t(
+ "search:searchresults-applicant-label"
+ )}
+ :
+
+ {_.has(detailsObj, [
+ "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue",
+ ])
+ ? detailsObj[
+ "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
+ ]
+ : ""}
+
+
+
+ {t(
+ "search:searchresults-authority-label"
+ )}
+ :
+
+ {_.has(item, [
+ "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue",
+ ])
+ ? router.locale == "cy"
+ ? jsonpath(
+ '$..[?(@.value=="' +
+ item[
+ "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
+ ] +
+ '")].value_cy',
+ transLookup
+ )
+ : item[
+ "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
+ ] || "N/A"
+ : ""}
+
+
+
+ {t(
+ "search:searchresults-case-type-label"
+ )}
+ :
+
+ {router.locale == "cy"
+ ? jsonpath(
+ '$..[?(@.value=="' +
+ item[
+ "pinswg_appealType"
+ ] +
+ '")].value_cy',
+ transLookup
+ )
+ : item["pinswg_appealType"] ||
+ "N/A"}
+
+
+
+ {t(
+ "search:searchresults-status-label"
+ )}
+ :
+
+
+ {router.locale == "cy"
+ ? jsonpath(
+ '$..[?(@.value=="' +
+ item[
+ "statuscode@OData.Community.Display.V1.FormattedValue"
+ ] +
+ '")].value_cy',
+ transLookup
+ )
+ : item[
+ "statuscode@OData.Community.Display.V1.FormattedValue"
+ ] || "N/A"}
+
+ {myportal == true && (
+
+ {isWatchedCase(item.incidentid)
+ .length >
+ 0 ==
+ true ? (
+ {
+ confirm(
+ t(
+ "case:you-have-stopped-watching-label"
+ ) +
+ item.pinswg_name +
+ "?"
+ ) &&
+ deleteItem(
+ isWatchedCase(
+ item.incidentid
+ )[0]
+ .pinswg_watchlistid,
+
+ "watchedCases"
+ );
+ }}
+ title={t(
+ "case:stop-watching-case-link"
+ )}
+ >
+
+
+ ) : (
+ {
+ confirm(
+ t(
+ "case:you-are-watching-label"
+ ) +
+ item.pinswg_name +
+ "?"
+ ) &&
+ selectWatchedCase(
+ props
+ .accountDetails
+ .loggedinUserId,
+ item.incidentid,
+ item.pinswg_appealcasetype
+ );
+ }}
+ title={t(
+ "case:watch-this-case-link"
+ )}
+ >
+
+
+ )}
+
+ )}
+
+ {(showLoginCheck == "true" ||
+ showLoginCheck == true) &&
+ !session && (
+
+
+ {t(
+ "case:watch-this-case-link"
+ )}
+
+
+ {
+ confirm(
+ t(
+ "case:trying-to-watch-case-label"
+ ) +
+ item.pinswg_name +
+ "\n\n" +
+ t(
+ "case:trying-to-watch-case-redirect-label"
+ )
+ ) &&
+ // signIn("email");
+ signIn(undefined, {
+ callbackUrl:
+ "/myportal/addresssearchresults?" +
+ new URLSearchParams(
+ searchString
+ ) +
+ "&toWatch=" +
+ item.incidentid +
+ "_" +
+ item.pinswg_appealcasetype,
+ });
+ }}
+ title={t(
+ "case:watch-this-case-link"
+ )}
+ >
+
+
+
+ )}
+
+ );
+ })
+ )}
+
+
+
+
+
+ {isLinkedCase
+ ? t("search:searchresults-title-label-linked-case")
+ : t("search:searchresults-title-label")}
+
+
+ {!isLinkedCase && (
+
+ {resultsArr.length > 200
+ ? t("search:searchresults-max-count-label")
+ : t("search:searchresults-count-label", {
+ count: searchResultsObj["@odata.count"],
+ })}
+ .
+ {advancedSearch != true ? (
+ <>
+
+ {t(
+ "search:searchresults-case-count-label"
+ )}{" "}
+ {" "}
+ "{searchString}"
+
+ >
+ ) : (
+ ""
+ )}
+
+ )}
+ {searchResultsObj["@odata.count"] > 5 && (
+
+
+
+ {t(
+ "search:searchresults-show-records-label-a"
+ )}
+ {
+ setSelectedOption(e.target.value);
+ // setCurrentPage(1);
+ }}
+ value={selectedOption}
+ className="govuk-select"
+ id="showNumberOfRecords"
+ name="showNumberOfRecords"
+ >
+ 5
+ 10
+ 20
+ 30
+ 50
+ {" "}
+ {t(
+ "search:searchresults-show-records-label-b"
+ )}
+
+
+
+ )}
+ {resultsArr.length > 0 ? (
+ ResultsView(resultsArr)
+ ) : (
+
+
+
+ {t("search:searchresults-no-records-label")}
+
+
+
+ )}
+
+
+ >
+ );
+};
+
+const mapDispatchToProps = (dispatch) => {
+ return {
+ setCurrentReference: (currentReference) => {
+ dispatch(setCurrentReference(currentReference));
+ },
+ setSearchResults: (searchResultsObj) => {
+ dispatch(setSearchResults(searchResultsObj));
+ },
+ setSearchDetails: (searchDetailsObj) => {
+ dispatch(setSearchDetails(searchDetailsObj));
+ },
+ setWatchedCases: (watchedCases) => {
+ dispatch(setWatchedCases(watchedCases));
+ },
+ setWatchedCasesDetails: (watchedCasesDetails) => {
+ dispatch(setWatchedCasesDetails(watchedCasesDetails));
+ },
+ // setCurrentPage: (currentPage) => {
+ // dispatch(setCurrentPage(currentPage));
+ // },
+ };
+};
+
+const mapStateToProps = (state) => {
+ return {
+ // currentView: state.currentView,
+ accountDetails: state.accountDetails,
+ // search: state.search,
+ // searchResultsObj: state.searchResultsObj,
+ };
+};
+export default connect(mapStateToProps, mapDispatchToProps)(SearchResults);
diff --git a/components/utils/index.js b/components/utils/index.js
index ff458e05..2159127f 100644
--- a/components/utils/index.js
+++ b/components/utils/index.js
@@ -29,6 +29,14 @@ export const getFormCollectionByID = (appealTypeID) => {
return collectionName[0];
};
+export const getFormIDByLogicalName = (appealTypeLogicalName) => {
+ const collectionName = jsonpath(
+ "$..[?(@.LogicalName =='" + appealTypeLogicalName + "')]",
+ data
+ );
+ return collectionName[0];
+};
+
export const getPickListLabel = (data, picklistType, picklistID) => {
const pickListData = jsonpath(
"$..[?(@.LogicalName=='" + picklistType + "')]",
@@ -63,6 +71,7 @@ export const getSearchDetails = (searchResultsObj) => {
//console.log(searchResultsObj);
let detailsArr = [];
+
searchResultsObj = searchResultsObj.value;
const detailsObj = searchResultsObj.map((searchDetail, index) => {
if (searchDetail.pinswg_appealcasetype == null) {
diff --git a/data/formsxml/commercialappealcas.xml b/data/formsxml/commercialappealcas.xml
index 75b51a05..194ee723 100644
--- a/data/formsxml/commercialappealcas.xml
+++ b/data/formsxml/commercialappealcas.xml
@@ -163,7 +163,7 @@
+
+
+ {t("search:page-title")} - {t("common:service-name")}
+
+ {/* Language by default is EN, if multilingual site this will need updated */}
+ <>
+
+
+ {/* If they have a Twitter Handle, include the meta details below */}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+
+
+
+
+
+
+ {hasError ? (
+
+ ) : (
+
+ )}
+
+
+
+
+ );
+};
+
+const mapStateToProps = (state) => {
+ return {
+ search: state.search,
+ searchResultsObj: state.searchResultsObj,
+ formData: state.formData,
+ appealType: state.appealType,
+ LPAData: state.LPAData,
+ //form: state.form,
+ accountDetails: state.accountDetails,
+ };
+};
+
+export default connect(mapStateToProps)(Home);
diff --git a/pages/addresssearchresults.js b/pages/addresssearchresults.js
new file mode 100644
index 00000000..179c94cf
--- /dev/null
+++ b/pages/addresssearchresults.js
@@ -0,0 +1,160 @@
+import useTranslation from "next-translate/useTranslation";
+import Head from "next/head";
+import { useRouter } from "next/router";
+import { connect } from "react-redux";
+import {
+ getAddressSearch,
+ getIncidentbyID,
+ getIsPublishedbyID,
+} from "../actions";
+import Breadcrumbs from "../components/breadcrumbs";
+import CookieBanner from "../components/cookieBanner";
+import Footer from "../components/footer";
+import Header from "../components/header";
+import SearchResults from "../components/addresssearchresults";
+import { getSearchDetails } from "../components/utils";
+import { setSearch } from "../store/search/action";
+import {
+ setSearchDetails,
+ setSearchResults,
+} from "../store/searchOutput/action";
+import { setShowReps } from "../store/currentView/action";
+
+import { wrapper } from "../store/store";
+
+const Home = (props) => {
+ const { footerLinks, pages } = props;
+ let { t, lang } = useTranslation();
+
+ const router = useRouter();
+ const { locale } = router;
+ const { appealtypes } = router.query;
+
+ return (
+