@@ -919,4 +401,36 @@ export default function AdvancedSearch(props) {
);
-}
+};
+
+const mapStateToProps = (state) => {
+ return {
+ currentView: state.currentView,
+ search: state.search,
+ searchResultsObj: state.searchResultsObj,
+ formData: state.formData,
+ appealType: state.appealType,
+ LPAData: state.LPAData,
+ //form: state.form,
+ myCases: state.myCases,
+ watchedCases: state.watchedCases,
+ myRepresentations: state.myRepresentations,
+ awaitingSubmission: state.awaitingSubmission,
+ };
+};
+
+const mapDispatchToProps = (dispatch) => {
+ return {};
+};
+
+const selector = formValueSelector("advancedSearchForm"); // <-- same as form name
+
+export default connect(
+ mapStateToProps,
+ mapDispatchToProps
+)(
+ reduxForm({
+ form: "advancedSearchForm",
+ destroyOnUnmount: false,
+ })(AdvancedSearch)
+);
diff --git a/components/search/dnssearchresults.js b/components/search/dnssearchresults.js
index 968a5843..763d95ea 100644
--- a/components/search/dnssearchresults.js
+++ b/components/search/dnssearchresults.js
@@ -19,28 +19,18 @@ const DNSSearchResults = (props) => {
const router = useRouter();
const { locale } = router;
- var resultsArr = searchResultsObj.value || [{}];
+ _.isEmpty(searchResultsObj);
- return (
- <>
-
-
-
- {t("dnsCommon:service-name")}{" "}
- {t("dnsApplications:page-title")}
-
-
- {t("dnsApplications:page-intro-paragraph-1")}
-
-
- - {t("dnsApplications:page-intro-list-item-1")}
+ let newSearchResultsObj = _.isEmpty(searchResultsObj)
+ ? [{}]
+ : _.isEmpty(searchResultsObj.value)
+ ? [{}]
+ : searchResultsObj.value;
- - {t("dnsApplications:page-intro-list-item-2")}
+ var resultsArr = newSearchResultsObj || [];
- - {t("dnsApplications:page-intro-list-item-3")}
-
-
-
+ const ResultsView = (resultsArr) => {
+ return (
@@ -62,6 +52,7 @@ const DNSSearchResults = (props) => {
{t("search:searchresults-status-label")}
+ {console.log(newSearchResultsObj.length > 0)}
{resultsArr.map((item, key) => {
let detailsObj = jsonpath.query(
@@ -207,6 +198,38 @@ const DNSSearchResults = (props) => {
+ {resultsArr.length > 0 ? (
+ ResultsView(resultsArr)
+ ) : (
+
+ )}
>
);
};
diff --git a/components/search/searchresults.js b/components/search/searchresults.js
index dce2de78..b945a8f9 100644
--- a/components/search/searchresults.js
+++ b/components/search/searchresults.js
@@ -19,8 +19,163 @@ const SearchResults = (props) => {
const router = useRouter();
const { locale } = router;
- var resultsArr = searchResultsObj.value || [{}];
+ var resultsArr = searchResultsObj.value || [];
+ const ResultsView = (resultsArr) => {
+ return (
+
@@ -29,188 +184,31 @@ const SearchResults = (props) => {
{t("search:searchresults-count-label", {
- count: searchResultsObj["@odata.count"].toString(),
+ count: resultsArr.length,
})}
- . {t("search:searchresults-case-count-label")}{" "}
- "{searchString}"
+ .
+ {typeof searchString != "undefined" ? (
+ <>
+
+ {t("search:searchresults-case-count-label")}{" "}
+ {" "}
+ "{searchString}"
+
+ >
+ ) : (
+ ""
+ )}
-
-
-
-
- {t("search:searchresults-case-reference-label")}
-
-
-
- {t("search:searchresults-site-address-label")}
-
-
-
- {t("search:searchresults-applicant-label")}
-
-
-
- {t("search:searchresults-authority-label")}
-
-
-
- {t("search:searchresults-case-type-label")}
-
-
-
- {t("search:searchresults-status-label")}
-
+
+ {resultsArr.length > 0 ? (
+ ResultsView(resultsArr)
+ ) : (
+
+
+
There are no records
+
-
- {resultsArr.map((item, key) => {
- let detailsObj = jsonpath.query(
- searchDetailsObj,
- "$..value[?(@.pinswg_name=='" + item.title + "')]"
- );
- detailsObj = detailsObj[0];
-
- return (
-
-
-
-
- {
- setCurrentReference({
- "currentReference":
- item.title,
- "currentType":
- "searchResultsObj",
- });
- }}
- >
-
- {t(
- "search:searchresults-case-reference-label"
- )}
- :
-
- {item.title}
-
-
-
-
-
-
- {t(
- "search:searchresults-site-address-label"
- )}
- :
-
- {_.has(
- detailsObj,
- "pinswg_siteaddressline1"
- )
- ? detailsObj.pinswg_siteaddressline1
- : ""}
-
- {_.has(
- detailsObj,
- "pinswg_siteaddressline1"
- )
- ? detailsObj.pinswg_siteaddressline2
- : ""}
-
- {_.has(
- detailsObj,
- "pinswg_siteaddressline1"
- )
- ? detailsObj.pinswg_siteaddresstown
- : ""}
-
- {_.has(
- detailsObj,
- "pinswg_siteaddressline1"
- )
- ? detailsObj.pinswg_siteaddresscounty
- : ""}
-
- {_.has(
- detailsObj,
- "pinswg_siteaddressline1"
- )
- ? detailsObj.pinswg_siteaddresspostcode
- : ""}
-
-
-
-
- {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(detailsObj, [
- "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue",
- ])
- ? router.locale == "cy"
- ? jsonpath.query(
- transLookup,
- '$..[?(@.value=="' +
- detailsObj[
- "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
- ] +
- '")].value_cy'
- )
- : detailsObj[
- "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
- ] || "N/A"
- : ""}
-
-
-
-
- {t(
- "search:searchresults-case-type-label"
- )}
- :
-
- {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"}
-
-
-
-
- {t("search:searchresults-status-label")}
- :
-
-
- {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"}
-
-
- );
- })}
-
+ )}
);
diff --git a/components/searchresults.js b/components/searchresults.js
index 02599187..8e9a3834 100644
--- a/components/searchresults.js
+++ b/components/searchresults.js
@@ -35,12 +35,12 @@ export default function Search(props) {
{t("search:searchresults-search-button-label")}
-
router.back()}
className="govuk-button govuk-button--secondary"
>
{t("search:searchresults-new-search-button-label")}
-
+ */}