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 Footer from "../../../components/footer";
|
||||
import Header from "../../../components/header";
|
||||
import { getSearchDetails } from "../../../components/utils";
|
||||
import {
|
||||
getSearchDetails,
|
||||
getFormCollectionByID,
|
||||
} from "../../../components/utils";
|
||||
import { setCurrentReference } from "../../../store/currentView/action";
|
||||
import { setSearch } from "../../../store/search/action";
|
||||
import {
|
||||
@@ -144,14 +147,55 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
// "\n======================================\n"
|
||||
// );
|
||||
|
||||
store.dispatch(setSearch(req.headers.referer.split("?")[1]));
|
||||
var whichAppeal = getFormCollectionByID(
|
||||
searchResultsObj.value[0].pinswg_appealcasetype
|
||||
).LogicalName;
|
||||
|
||||
console.log(
|
||||
searchResultsObj["@odata.count"] > 1 ||
|
||||
searchResultsObj["@odata.count"] < 1
|
||||
var defaultPostcode =
|
||||
whichAppeal == "pinswg_ldps" ||
|
||||
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 {
|
||||
redirect: {
|
||||
destination: "/404",
|
||||
@@ -159,28 +203,17 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
},
|
||||
};
|
||||
} else {
|
||||
if (searchResultsObj["@odata.count"] > 1) {
|
||||
return {
|
||||
redirect: {
|
||||
//destination: "/dns-not-found",
|
||||
destination: "/404",
|
||||
permanent: false,
|
||||
},
|
||||
};
|
||||
} 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,
|
||||
})
|
||||
);
|
||||
}
|
||||
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 {
|
||||
props: {
|
||||
searchResultsObj: {
|
||||
|
||||
Reference in New Issue
Block a user