Merged PR 1126: updated breadcrumb link on case details page
updated breadcrumb link on case details page Related work items: #10914
This commit is contained in:
+60
-27
@@ -12,7 +12,10 @@ import {
|
|||||||
import CookieBanner from "../../../components/cookieBanner";
|
import CookieBanner from "../../../components/cookieBanner";
|
||||||
import Footer from "../../../components/footer";
|
import Footer from "../../../components/footer";
|
||||||
import Header from "../../../components/header";
|
import Header from "../../../components/header";
|
||||||
import { getSearchDetails } from "../../../components/utils";
|
import {
|
||||||
|
getSearchDetails,
|
||||||
|
getFormCollectionByID,
|
||||||
|
} from "../../../components/utils";
|
||||||
import { setCurrentReference } from "../../../store/currentView/action";
|
import { setCurrentReference } from "../../../store/currentView/action";
|
||||||
import { setSearch } from "../../../store/search/action";
|
import { setSearch } from "../../../store/search/action";
|
||||||
import {
|
import {
|
||||||
@@ -144,14 +147,55 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
// "\n======================================\n"
|
// "\n======================================\n"
|
||||||
// );
|
// );
|
||||||
|
|
||||||
store.dispatch(setSearch(req.headers.referer.split("?")[1]));
|
var whichAppeal = getFormCollectionByID(
|
||||||
|
searchResultsObj.value[0].pinswg_appealcasetype
|
||||||
|
).LogicalName;
|
||||||
|
|
||||||
console.log(
|
var defaultPostcode =
|
||||||
searchResultsObj["@odata.count"] > 1 ||
|
whichAppeal == "pinswg_ldps" ||
|
||||||
searchResultsObj["@odata.count"] < 1
|
whichAppeal == "pinswg_harbourrevisionorders"
|
||||||
|
? "pinswg_postcode"
|
||||||
|
: whichAppeal == "pinswg_transportandworkacts" ||
|
||||||
|
whichAppeal == "pinswg_electricityacts" ||
|
||||||
|
whichAppeal == "pinswg_dnses"
|
||||||
|
? "pinswg_postcode"
|
||||||
|
: "pinswg_siteaddresspostcode";
|
||||||
|
|
||||||
|
var defaultFirstLineAddress =
|
||||||
|
whichAppeal == "pinswg_ldps" ||
|
||||||
|
whichAppeal == "pinswg_harbourrevisionorders"
|
||||||
|
? "pinswg_postcode"
|
||||||
|
: whichAppeal == "pinswg_transportandworkacts" ||
|
||||||
|
whichAppeal == "pinswg_electricityacts" ||
|
||||||
|
whichAppeal == "pinswg_dnses"
|
||||||
|
? "pinswg_addressline1"
|
||||||
|
: "pinswg_siteaddressline1";
|
||||||
|
|
||||||
|
store.dispatch(
|
||||||
|
req.headers.hasOwnProperty("referer")
|
||||||
|
? req.headers.referer.indexOf("?") > -1
|
||||||
|
? setSearch(req.headers.referer.split("?")[1])
|
||||||
|
: setSearch(
|
||||||
|
searchDetailsObj[0].value[0][defaultPostcode] == null
|
||||||
|
? "postcode=" +
|
||||||
|
searchDetailsObj[0].value[0][
|
||||||
|
defaultPostcode
|
||||||
|
]
|
||||||
|
: "addressline1=" +
|
||||||
|
searchDetailsObj[0].value[0][
|
||||||
|
defaultFirstLineAddress
|
||||||
|
]
|
||||||
|
)
|
||||||
|
: setSearch(
|
||||||
|
"postcode=" +
|
||||||
|
searchDetailsObj[0].value[0][defaultPostcode]
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (searchResultsObj["@odata.count"] < 1) {
|
if (
|
||||||
|
searchResultsObj["@odata.count"] < 1 ||
|
||||||
|
searchResultsObj["@odata.count"] > 1
|
||||||
|
) {
|
||||||
return {
|
return {
|
||||||
redirect: {
|
redirect: {
|
||||||
destination: "/404",
|
destination: "/404",
|
||||||
@@ -159,28 +203,17 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
if (searchResultsObj["@odata.count"] > 1) {
|
store.dispatch(
|
||||||
return {
|
setCurrentReference({
|
||||||
redirect: {
|
"ticketnumber": searchResultsObj.value[0].ticketnumber,
|
||||||
//destination: "/dns-not-found",
|
"currentReference": searchResultsObj.value[0].title,
|
||||||
destination: "/404",
|
"currentType": "searchResultsObj",
|
||||||
permanent: false,
|
"incidentid": searchResultsObj.value[0].incidentid,
|
||||||
},
|
"appealType":
|
||||||
};
|
searchResultsObj.value[0].pinswg_appealcasetype,
|
||||||
} else {
|
})
|
||||||
store.dispatch(
|
);
|
||||||
setCurrentReference({
|
|
||||||
"ticketnumber": searchResultsObj.value[0].ticketnumber,
|
|
||||||
"currentReference": searchResultsObj.value[0].title,
|
|
||||||
"currentType": "searchResultsObj",
|
|
||||||
"incidentid": searchResultsObj.value[0].incidentid,
|
|
||||||
"appealType":
|
|
||||||
searchResultsObj.value[0].pinswg_appealcasetype,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// console.log(searchResultsObj);
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
searchResultsObj: {
|
searchResultsObj: {
|
||||||
|
|||||||
Reference in New Issue
Block a user