diff --git a/actions/index.js b/actions/index.js
index a5a3d2f7..ee60e791 100644
--- a/actions/index.js
+++ b/actions/index.js
@@ -130,6 +130,19 @@ export const getBasicSearch = (searchString) => {
});
};
+export const getBasicDNSSearch = (searchString) => {
+ return axios
+ .get(
+ WEBAPI_URL +
+ "incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype eq 846040011&$count=true",
+ azureHeaders
+ )
+ .then((res) => res.data)
+ .catch((error) => {
+ console.log("thiserror", error);
+ });
+};
+
export const getBasicSearchDetails = (appealType, caseReference) => {
return axios
.get(
@@ -146,6 +159,21 @@ export const getBasicSearchDetails = (appealType, caseReference) => {
});
};
+export const getBasicDNSSearchDetails = (appealType, caseReference) => {
+ return axios
+ .get(
+ WEBAPI_URL +
+ "pinswg_dnses?$filter=pinswg_name eq '" +
+ caseReference +
+ "'&$count=true",
+ azureHeaders
+ )
+ .then((res) => res.data)
+ .catch((error) => {
+ console.log("thiserror", error);
+ });
+};
+
export const getFormData = (whichForm) => {
//console.log("got to axios", whichForm);
//console.log("api_root: ", BASE_URL);
diff --git a/components/breadcrumbs.js b/components/breadcrumbs.js
index c54c3a7c..9c66724f 100644
--- a/components/breadcrumbs.js
+++ b/components/breadcrumbs.js
@@ -54,11 +54,11 @@ const Breadcrumbs = (props) => {
- {router.pathname.includes("dns")
+ {router.pathname.includes("/dns/")
? t("dnsCommon:service-name")
: t("common:service-name")}
@@ -372,6 +372,15 @@ const Breadcrumbs = (props) => {
) : (
""
)}
+ {router.pathname == "/dnsapplications" ? (
+ <>
+
+ {t("dnsCommon:service-name")}
+
+ >
+ ) : (
+ ""
+ )}
{router.pathname == "/dns/application-process" ? (
<>
diff --git a/components/case/summary.js b/components/case/summary.js
index cd4f96fb..8979051d 100644
--- a/components/case/summary.js
+++ b/components/case/summary.js
@@ -21,6 +21,8 @@ const CaseSummary = (props) => {
currentType,
} = props;
+ const noRepresentationLink = ["/case", "/dnsdetails"];
+
let setCaseQueryObj = props[currentType];
let setCaseDetailsObj = props[currentType + "Details"];
@@ -122,19 +124,19 @@ const CaseSummary = (props) => {
- {router.pathname != "/case" ? (
- <>
-
-
- {t(
- "case:summary-make-representation-label"
- )}
-
-
- >
- ) : (
+ {noRepresentationLink.includes(router.pathname) ==
+ true ? (
""
+ ) : (
+
+
+ {t(
+ "case:summary-make-representation-label"
+ )}
+
+
)}
+
router.back()}
className="govuk-button govuk-button--secondary"
diff --git a/components/dnssearchresults.js b/components/dnssearchresults.js
new file mode 100644
index 00000000..c3153f27
--- /dev/null
+++ b/components/dnssearchresults.js
@@ -0,0 +1,32 @@
+import Link from "next/link";
+import { useRouter } from "next/router";
+import { useContext } from "react";
+import useTranslation from "next-translate/useTranslation";
+import SearchForCase from "./search/searchforcase";
+import DNSSearchResults from "./search/dnssearchresults";
+
+export default function Search(props) {
+ const { searchString, searchResultsObj } = props;
+ let { t } = useTranslation();
+
+ const router = useRouter();
+ const { locale } = router;
+
+ return (
+
+
+
+ );
+}
diff --git a/components/header.js b/components/header.js
index d0ac40a3..51b3417a 100644
--- a/components/header.js
+++ b/components/header.js
@@ -21,6 +21,8 @@ const Header = (props) => {
"/searchresults",
"/case",
"advancedsearch",
+ "/dnsapplications",
+ "/dnsdetails",
];
const hasContactLink = [
"/dns",
diff --git a/components/homepage/dns.js b/components/homepage/dns.js
index 6d74dbfd..cbbaf329 100644
--- a/components/homepage/dns.js
+++ b/components/homepage/dns.js
@@ -17,9 +17,11 @@ export default function Dns() {
diff --git a/components/newappeal/complete.js b/components/newappeal/complete.js
index 5d6f77ad..84501620 100644
--- a/components/newappeal/complete.js
+++ b/components/newappeal/complete.js
@@ -65,7 +65,12 @@ let CompleteAppeal = (props) => {
primaryAttribute,
props.appealType.caseReference.ticketnumber
);
- }, [props.appealType.caseReference, props.props.form.appealForm.values]);
+ }, [
+ props.appealType.caseReference,
+ props.props.form.appealForm.values,
+ props.appealType.appealLPA,
+ props.props.accountDetails.loggedinUserId,
+ ]);
const getFormCollection = (formtype) => {
const collectionName = jsonpath.query(
diff --git a/components/search/dnssearchresults.js b/components/search/dnssearchresults.js
new file mode 100644
index 00000000..968a5843
--- /dev/null
+++ b/components/search/dnssearchresults.js
@@ -0,0 +1,222 @@
+import Link from "next/link";
+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 _ from "lodash";
+import transLookup from "../../data/lookuptranslations.json";
+
+const DNSSearchResults = (props) => {
+ const {
+ searchString,
+ searchResultsObj,
+ searchDetailsObj,
+ setCurrentReference,
+ } = props;
+ let { t } = useTranslation();
+
+ const router = useRouter();
+ const { locale } = router;
+
+ var resultsArr = searchResultsObj.value || [{}];
+
+ return (
+ <>
+
+
+
+ {t("dnsCommon:service-name")}{" "}
+ {t("dnsApplications:page-title")}
+
+
+ {t("dnsApplications:page-intro-paragraph-1")}
+
+
+ - {t("dnsApplications:page-intro-list-item-1")}
+
+ - {t("dnsApplications:page-intro-list-item-2")}
+
+ - {t("dnsApplications:page-intro-list-item-3")}
+
+
+
+
+
+
+
+
-
+ {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-status-label")}
+
+
+
+ {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-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"}
+
+
+ );
+ })}
+
+
+
+ >
+ );
+};
+
+const mapDispatchToProps = (dispatch) => {
+ return {
+ setCurrentReference: (currentReference) => {
+ dispatch(setCurrentReference(currentReference));
+ },
+ };
+};
+
+export default connect(null, mapDispatchToProps)(DNSSearchResults);
diff --git a/data/collections.json b/data/collections.json
index 16d57a78..d4059743 100644
--- a/data/collections.json
+++ b/data/collections.json
@@ -456,4 +456,4 @@
"MetadataId": "6aedaab1-4a82-eb11-aac0-00224800be9c"
}
]
-}
+}
\ No newline at end of file
diff --git a/data/lookuptranslations.json b/data/lookuptranslations.json
index 1c77f083..27d6418f 100644
--- a/data/lookuptranslations.json
+++ b/data/lookuptranslations.json
@@ -176,6 +176,11 @@
"value": "Researching",
"value_cy": "Ymchwilio",
"statuscode": 5
+ },
+ {
+ "value": "Problem Solved",
+ "value_cy": "Datrys Problemau",
+ "statuscode": 6
}
],
"pinswg_decision": [
diff --git a/i18n.json b/i18n.json
index 515366f7..ca766d15 100644
--- a/i18n.json
+++ b/i18n.json
@@ -64,6 +64,14 @@
"/dns/application-view": [
"dnsCommon",
"dnsApplicationView"
+ ],
+ "/dnsapplications": [
+ "search",
+ "dnsCommon",
+ "dnsApplications"
+ ],
+ "/dnsdetails": [
+ "case"
]
}
}
\ No newline at end of file
diff --git a/pages/dnsapplications.js b/pages/dnsapplications.js
new file mode 100644
index 00000000..dbe0f32c
--- /dev/null
+++ b/pages/dnsapplications.js
@@ -0,0 +1,128 @@
+import _ from "lodash";
+import Head from "next/head";
+import Header from "../components/header";
+import Banner from "../components/banner";
+import CookieBanner from "../components/cookieBanner";
+import Breadcrumbs from "../components/breadcrumbs";
+import DNSSearchResults from "../components/dnssearchresults";
+import Footer from "../components/footer";
+import Errorpage from "../components/errorpage";
+import styles from "../styles/Home.module.css";
+import { useSelector, shallowEqual, connect } from "react-redux";
+import { wrapper } from "../store/store";
+import Cookies from "cookies";
+import { useRouter } from "next/router";
+import useTranslation from "next-translate/useTranslation";
+import jsonpath from "jsonpath";
+import data from "../data/collections.json";
+
+import { setSearch, getSearchObj } from "../store/search/action";
+import {
+ setSearchResults,
+ setSearchDetails,
+ getSearchResultsObj,
+} from "../store/searchOutput/action";
+import { getBasicDNSSearch, getBasicSearchDetails } from "../actions";
+
+const Home = (props) => {
+ const { footerLinks, pages } = props;
+ let { t, lang } = useTranslation();
+
+ const router = useRouter();
+ const { locale } = router;
+ const { appealtypes } = router.query;
+
+ return (
+
+
+
+ {t("search:page-title")} - {t("common:service-name")}
+
+
+
+
+ );
+};
+
+export const getServerSideProps = wrapper.getServerSideProps(
+ (store) =>
+ async ({ query, req, res }) => {
+ console.log("query-", query);
+
+ const searchResultsObj = await getBasicDNSSearch();
+ //console.log(searchResultsObj);
+
+ const searchDetailsObj = await getSearchDetails(searchResultsObj);
+ //console.log(searchDetailsObj);
+ store.dispatch(setSearchResults(searchResultsObj));
+ store.dispatch(setSearchDetails(searchDetailsObj));
+ store.dispatch(setSearch("DNS"));
+ }
+);
+
+const getFormCollection = (formtype) => {
+ const collectionName = jsonpath.query(
+ data,
+ "$..[?(@.LogicalName=='" + formtype + "')].LogicalCollectionName"
+ );
+ //console.log(collectionName[0]);
+ return collectionName[0];
+};
+
+const getSearchDetails = (searchResultsObj) => {
+ //console.log(searchResultsObj);
+
+ let detailsArr = [];
+ searchResultsObj = searchResultsObj.value;
+ const detailsObj = searchResultsObj.map((searchDetail, index) => {
+ if (searchDetail.pinswg_appealcasetype == null) {
+ console.log(searchDetail.ticketnumber);
+ } else {
+ detailsArr.push(
+ getBasicSearchDetails(
+ getFormCollection(
+ "pinswg_" +
+ searchDetail[
+ "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
+ ]
+ .replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
+ .toLowerCase()
+ .slice(0, 39)
+ ),
+ searchDetail.ticketnumber
+ )
+ );
+ }
+ });
+ //console.log(detailsArr);
+ return Promise.all(detailsArr);
+};
+
+const mapStateToProps = (state) => {
+ return {
+ currentView: state.currentView,
+ search: state.search,
+ searchResultsObj: state.searchResultsObj,
+ formData: state.formData,
+ appealType: state.appealType,
+ form: state.form,
+ myCases: state.myCases,
+ watchedCases: state.watchedCases,
+ myRepresentations: state.myRepresentations,
+ awaitingSubmission: state.awaitingSubmission,
+ };
+};
+
+export default connect(mapStateToProps)(Home);
diff --git a/pages/dnsdetails.js b/pages/dnsdetails.js
new file mode 100644
index 00000000..11120215
--- /dev/null
+++ b/pages/dnsdetails.js
@@ -0,0 +1,89 @@
+import _ from "lodash";
+import Head from "next/head";
+import Header from "../components/header";
+import Banner from "../components/banner";
+import CookieBanner from "../components/cookieBanner";
+import Breadcrumbs from "../components/breadcrumbs";
+import CaseSummary from "../components/case";
+import Footer from "../components/footer";
+import Errorpage from "../components/errorpage";
+import styles from "../styles/Home.module.css";
+import { useSelector, shallowEqual, connect } from "react-redux";
+import { wrapper } from "../store/store";
+import Cookies from "cookies";
+import { useRouter } from "next/router";
+import useTranslation from "next-translate/useTranslation";
+import Case from "../components/case";
+
+const Home = (props) => {
+ const { footerLinks, pages } = props;
+ let { t, lang } = useTranslation();
+
+ const router = useRouter();
+ const { locale } = router;
+ const { appealtypes } = router.query;
+
+ return (
+
+
+
+ {t("case:page-title")}:{" "}
+ {props.currentView.caseReference.currentReference}{" "}
+ {t("common:service-name")}
+
+
+
+
+ );
+};
+
+const mapStateToProps = (state) => {
+ //console.log(state);
+
+ return {
+ currentView: state.currentView,
+ search: state.search,
+ searchResultsObj: state.searchResultsObj,
+ formData: state.formData,
+ appealType: state.appealType,
+ form: state.form,
+ myCases: state.myCases,
+ watchedCases: state.watchedCases,
+ myRepresentations: state.myRepresentations,
+ awaitingSubmission: state.awaitingSubmission,
+ };
+};
+
+export default connect(mapStateToProps)(Home);