diff --git a/i18n.js b/i18n.js
index 22905cb0..ecf361e3 100644
--- a/i18n.js
+++ b/i18n.js
@@ -27,7 +27,8 @@ module.exports = {
"/newappeal": ["newappeal"],
"/newappeal/*": ["newappeal"],
"/newappeal/selectappeal": ["newappeal"],
- "/dns/*": ["dnsCommon"],
+ "/dns/*": ["dnsCommon", "case", "common"],
+ "/dns/[developmentName]": ["dnsCommon", "case", "common"],
"/dns": ["dnsCommon", "dnsHome"],
"/dns/applications": ["dnsCommon", "dnsApplications"],
"/dns/application-view": ["dnsCommon", "dnsApplicationView"],
diff --git a/pages/api/endpoint/getbasicdnsurlsearch_api.js b/pages/api/endpoint/getbasicdnsurlsearch_api.js
new file mode 100644
index 00000000..b315494b
--- /dev/null
+++ b/pages/api/endpoint/getbasicdnsurlsearch_api.js
@@ -0,0 +1,58 @@
+import axios from "axios";
+import CryptoJS from "crypto-js";
+import _ from "lodash";
+import { getToken, azureHeadersPaged } from "../../../actions";
+
+const WORDKEY = process.env.HASHKEY;
+
+const WEBAPI_URL =
+ process.env.RELAY_ROOT ||
+ "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
+
+const hashAPIPath = (queryPath) => {
+ var hashlink = CryptoJS.HmacSHA256(
+ queryPath,
+ CryptoJS.enc.Hex.parse(WORDKEY)
+ );
+ hashlink = hashlink.toString(CryptoJS.enc.Hex);
+
+ //return "&hash=" + hashlink;
+
+ return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
+};
+
+export default async function ApiProxy(req, res) {
+ var searchString = req.query.searchString;
+ var token = await getToken();
+
+ var queryUrl =
+ "incidents?$select=description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=(contains(title, '" +
+ searchString +
+ "') or contains(ticketnumber, '" +
+ searchString +
+ "')) and pinswg_appealcasetype eq 846040011 and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
+
+ // console.log("basic search ", queryUrl);
+
+ var apiResponse = _.isEmpty(req.query)
+ ? res.status(400).json()
+ : searchString.length > 0
+ ? axios
+ .get(
+ WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
+ azureHeadersPaged(token.access_token)
+ )
+ .then(({ data }) => {
+ var dataStr;
+ _.has(data, "@odata.nextLink") == true &&
+ ((dataStr = JSON.stringify(data["@odata.nextLink"])),
+ (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
+ res.status(200).json(data);
+ })
+ .catch(({ err }) => {
+ res.status(400).json(err);
+ })
+ : res.status(400).json();
+
+ return apiResponse;
+}
diff --git a/pages/dns-not-found.js b/pages/dns-not-found.js
new file mode 100644
index 00000000..678bfdfa
--- /dev/null
+++ b/pages/dns-not-found.js
@@ -0,0 +1,45 @@
+// 404.js
+import useTranslation from "next-translate/useTranslation";
+import Head from "next/head";
+import Link from "next/link";
+import CookieBanner from "../components/cookieBanner";
+import Footer from "../components/footer";
+import Header from "../components/header";
+
+const FourOhFour = (props) => {
+ let { t, lang } = useTranslation();
+ const { footerLinks, pages } = props;
+
+ return (
+
+
+
+ {t("common:404-not-found-title")} -{" "}
+ {t("common:service-name")}
+
+
+
+
+ );
+};
+
+export default FourOhFour;
diff --git a/pages/dns/[developmentName].js b/pages/dns/[developmentName].js
new file mode 100644
index 00000000..22870c81
--- /dev/null
+++ b/pages/dns/[developmentName].js
@@ -0,0 +1,174 @@
+import useTranslation from "next-translate/useTranslation";
+import Head from "next/head";
+import { useRouter } from "next/router";
+import { connect } from "react-redux";
+import { getBasicDNSURLSearch } from "../../actions";
+import CookieBanner from "../../components/cookieBanner";
+import Footer from "../../components/footer";
+import Header from "../../components/header";
+import { getSearchDetails } from "../../components/utils";
+import { setCurrentReference } from "../../store/currentView/action";
+import { setSearch } from "../../store/search/action";
+import {
+ setSearchDetails,
+ setSearchResults,
+} from "../../store/searchOutput/action";
+import { wrapper } from "../../store/store";
+import Case from "../../components/case";
+import Breadcrumbs from "../../components/breadcrumbs";
+
+const CaseHome = (props) => {
+ const { footerLinks, pages } = props;
+ let { t, lang } = useTranslation();
+
+ const router = useRouter();
+ const { locale } = router;
+ const { developmentName } = router.query;
+
+ return (
+
+
+
+ Reference:{" "}
+ {props.currentView.caseReference.currentReference}{" "}
+ Developments of National Significance
+
+
+
+
+ );
+};
+
+export const getServerSideProps = wrapper.getServerSideProps(
+ (store) => async (ctx) => {
+ const { query, req, res } = ctx;
+ const { cookies } = req;
+
+ console.log(cookies);
+ console.log("the query", query.developmentName);
+ let loggedInUser = cookies.pinsUser;
+
+ let developmentQuery = query.developmentName.split("-").join(" ");
+
+ const searchResultsObj = await getBasicDNSURLSearch(developmentQuery);
+ const searchDetailsObj = await getSearchDetails(searchResultsObj);
+
+ store.dispatch(setSearchResults(searchResultsObj));
+ store.dispatch(setSearchDetails(searchDetailsObj));
+ store.dispatch(setSearch(developmentQuery));
+
+ // console.log({
+ // "currentReference": searchResultsObj.value[0].title,
+ // "currentType": "searchResultsObj",
+ // "incidentid": searchResultsObj.value[0].incidentid,
+ // "appealType": searchResultsObj.value[0].pinswg_appealcasetype,
+ // });
+ console.log(
+ searchResultsObj["@odata.count"] > 1 ||
+ searchResultsObj["@odata.count"] < 1
+ );
+
+ if (searchResultsObj["@odata.count"] < 1) {
+ return {
+ redirect: {
+ destination: "/404",
+ permanent: false,
+ },
+ };
+ } else {
+ if (searchResultsObj["@odata.count"] > 1) {
+ return {
+ redirect: {
+ //destination: "/dns-not-found",
+ destination: "/404",
+ permanent: false,
+ },
+ };
+ } else {
+ store.dispatch(
+ setCurrentReference({
+ "currentReference": searchResultsObj.value[0].title,
+ "currentType": "searchResultsObj",
+ "incidentid": searchResultsObj.value[0].incidentid,
+ "appealType":
+ searchResultsObj.value[0].pinswg_appealcasetype,
+ })
+ );
+ }
+ }
+ // console.log(searchResultsObj);
+ }
+);
+
+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,
+ };
+};
+
+const mapDispatchToProps = (dispatch) => {
+ return {
+ setCurrentReference: (currentReference) => {
+ dispatch(setCurrentReference(refno));
+ },
+ };
+};
+
+export default connect(mapStateToProps, mapDispatchToProps)(CaseHome);
diff --git a/pages/dns/index.js b/pages/dns/index.js
index e197c914..f4ebc15d 100644
--- a/pages/dns/index.js
+++ b/pages/dns/index.js
@@ -1,18 +1,10 @@
-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 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 { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
+import Head from "next/head";
+import { useRouter } from "next/router";
+import CookieBanner from "../../components/cookieBanner";
import Main from "../../components/dns//main";
+import Footer from "../../components/footer";
+import Header from "../../components/header";
const Home = (props) => {
const { footerLinks, pages } = props;
diff --git a/store/store.js b/store/store.js
index ff25d224..be78c0b1 100644
--- a/store/store.js
+++ b/store/store.js
@@ -108,9 +108,9 @@ const makeStore = ({ isServer }) => {
const persistConfig = {
key: "acp",
whitelist: [
- "currentView",
- "search",
- "searchResultsObj",
+ // "currentView",
+ // "search",
+ // "searchResultsObj",
"formData",
"appealType",
"LPAData",