correctly go back to the previous page search results

This commit is contained in:
2026-03-10 10:31:16 +00:00
parent e6c25d7ef5
commit 3e48f8cd28
4 changed files with 407 additions and 408 deletions
+51 -39
View File
@@ -12,7 +12,7 @@ import { Field, change, reduxForm } from "redux-form";
import { setCurrentSection } from "../store/appealType/action";
import {
setRepresentationCapacity,
setRepresentationSubmit,
setRepresentationSubmit
} from "../store/currentView/action";
const Breadcrumbs = (props) => {
const {
@@ -20,7 +20,7 @@ const Breadcrumbs = (props) => {
setCurrentView,
setCurrentSection,
setRepresentationCapacity,
setRepresentationSubmit,
setRepresentationSubmit
} = props;
const router = useRouter();
let { t } = useTranslation();
@@ -38,10 +38,10 @@ const Breadcrumbs = (props) => {
currentView.caseReference.appealType == 846040008
? 7
: currentView.caseReference.appealType == 846040005 ||
currentView.caseReference.appealType == 846040006 ||
currentView.caseReference.appealType == 846040007
? 9
: "";
currentView.caseReference.appealType == 846040006 ||
currentView.caseReference.appealType == 846040007
? 9
: "";
var viewAllKey = currentView?.viewKey || router.query.viewKey;
return (
@@ -551,17 +551,25 @@ const Breadcrumbs = (props) => {
<>
<li className="govuk-breadcrumbs__list-item">
<Link
href={
"/searchresults?q=" +
props.props.search.searchString
}
// onClick={() => {
// // spinnerState();
// router.back();
// }}
href={{
pathname:
(session ? "/myportal" : "") +
(router.query.adv == "true"
? "/advancedsearchresults"
: router.query.ads == "true"
? "/addresssearchresults"
: "/searchresults"),
query: router.query
}}
className="govuk-breadcrumbs__link"
>
{t("common:breadcrumb-search-results")}
{router.query.ads == "true"
? t(
"common:breadcrumb-addresssearch-results"
)
: t(
"common:breadcrumb-search-results"
)}
</Link>
</li>
<li className="govuk-breadcrumbs__list-item">
@@ -602,10 +610,6 @@ const Breadcrumbs = (props) => {
props.props.search
.searchString
}
onClick={() => {
// spinnerState();
router.back();
}}
className="govuk-breadcrumbs__link"
>
{t(
@@ -704,23 +708,29 @@ const Breadcrumbs = (props) => {
</li>
<li className="govuk-breadcrumbs__list-item">
<Link
href={
router.locale != "en"
? router.locale +
"/fymhorth/searchresults?q=" +
props.props.search
.searchString
: "/myportal/searchresults?q=" +
props.props.search
.searchString
}
onClick={() => {
// spinnerState();
router.back();
href={{
pathname:
(session ? "/myportal" : "") +
(router.query.adv == "true"
? "/advancedsearchresults"
: router.query.ads == "true"
? "/addresssearchresults"
: "/searchresults"),
query: router.query
}}
className="govuk-breadcrumbs__link"
>
{t("common:breadcrumb-search-results")}
{router.query.adv == "true"
? t(
"common:breadcrumb-advanced-search-results"
)
: router.query.ads == "true"
? t(
"common:breadcrumb-address-search-results"
)
: t(
"common:breadcrumb-search-results"
)}
</Link>
</li>
<li className="govuk-breadcrumbs__list-item">
@@ -827,11 +837,13 @@ const Breadcrumbs = (props) => {
router.locale != "en"
? router.locale +
"/searchresults?q=" +
props.props.search
.searchString
router.query.q +
"&page=" +
router.query.page
: "/searchresults?q=" +
props.props.search
.searchString
router.query.q +
"&page=" +
router.query.page
}
onClick={() => {
// spinnerState();
@@ -1193,7 +1205,7 @@ const Breadcrumbs = (props) => {
const mapStateToProps = (state) => {
return {
...state,
...state
};
};
@@ -1214,7 +1226,7 @@ const mapDispatchToProps = (dispatch) => {
},
setCurrentSection: (currentSection) => {
dispatch(setCurrentSection(currentSection));
},
}
};
};
+225 -236
View File
@@ -786,235 +786,241 @@ const CaseSummary = (props) => {
<>
<div className="govuk-grid-row">
<div className="govuk-grid-column-full">
<div className="govuk-button-group">
{getFormCollectionByID(
appealTypeID
).PrimaryIdAttribute ==
"pinswg_sipscase" &&
showReps(
detailsObj.pinswg_consultationopen,
detailsObj.pinswg_consultationclose
) && (
<>
{showRepButton(
props
.currentView
.caseReference
.appealType
) ? (
<>
<Link
href={{
pathname:
"/myportal/representation",
query: {
case:
currentType ==
"searchResultsObj"
? detailsObj.pinswg_name
: currentType ==
"watchedCases"
? casesObj.pinswg_title
: currentType ==
"directResultsObj"
<div className="">
<div className="govuk-button-group">
{getFormCollectionByID(
appealTypeID
).PrimaryIdAttribute ==
"pinswg_sipscase" &&
showReps(
detailsObj.pinswg_consultationopen,
detailsObj.pinswg_consultationclose
) && (
<>
{showRepButton(
props
.currentView
.caseReference
.appealType
) ? (
<>
<Link
href={{
pathname:
"/myportal/representation",
query: {
case:
currentType ==
"searchResultsObj"
? detailsObj.pinswg_name
: casesObj.reference
}
}}
className="govuk-button"
>
{props
.currentView
.caseReference
.appealType ==
846040002
? t(
"case:summary-make-consultation-label"
)
: t(
"case:summary-make-representation-label"
)}
</Link>
<a
onClick={() => {
//spinnerState();
router.back();
}}
className="govuk-button govuk-button--secondary"
>
{t(
"case:summary-back-button-label"
)}
</a>
</>
) : !isLPA &&
props.currentView
.caseReference
.appealType ==
846040004 ? (
""
) : (
<>
<div className="govuk-grid-column-full govuk-!-padding-left-0">
<div className="govuk-button-group">
<p className="govuk-body">
{t(
"case:representation-date-passed-label",
{
startDate:
formatDates(
detailsObj.pinswg_consultationopen
),
endDate:
formatDates(
detailsObj.pinswg_consultationclose
: currentType ==
"watchedCases"
? casesObj.pinswg_title
: currentType ==
"directResultsObj"
? detailsObj.pinswg_name
: casesObj.reference
}
}}
className="govuk-button"
>
{props
.currentView
.caseReference
.appealType ==
846040002
? t(
"case:summary-make-consultation-label"
)
: t(
"case:summary-make-representation-label"
)}
</Link>
</>
) : !isLPA &&
props
.currentView
.caseReference
.appealType ==
846040004 ? (
""
) : (
<>
<div className="govuk-grid-column-full govuk-!-padding-left-0">
<div className="govuk-button-group">
<p className="govuk-body">
{t(
"case:representation-date-passed-label",
{
startDate:
formatDates(
detailsObj.pinswg_consultationopen
),
endDate:
formatDates(
detailsObj.pinswg_consultationclose
)
}
)}
<br />{" "}
{t(
"case:representation-date-passed-additional-label"
)}{" "}
<Link
href={
"mailto:" +
t(
"home:login-contact-email"
)
}
)}
<br />{" "}
{t(
"case:representation-date-passed-additional-label"
)}{" "}
<Link
href={
"mailto:" +
t(
}
>
{t(
"home:login-contact-email"
)
}
>
{t(
"home:login-contact-email"
)}
</Link>
</p>
)}
</Link>
</p>
</div>
</div>
</div>
</>
)}
</>
)}
{(_.has(
detailsObj,
"pinswg_startdate"
) ||
_.has(
</>
)}
</>
)}
{(_.has(
detailsObj,
"pinswg_applicationacceptedasvalid"
"pinswg_startdate"
) ||
_.has(
detailsObj,
"pinswg_startdates"
)) &&
showReps(
detailsObj.pinswg_startdate ||
detailsObj.pinswg_startdates ||
detailsObj.pinswg_applicationacceptedasvalid,
detailsObj.pinswg_finalcommentsduedate ||
detailsObj.pinswg_endofrepresentationperiod
) && (
<>
{showRepButton(
props
.currentView
.caseReference
.appealType
) ? (
<>
<Link
href={{
pathname:
"/myportal/representation",
query: {
case:
currentType ==
"searchResultsObj"
? detailsObj.ticketnumber
: currentType ==
"watchedCases"
? casesObj.pinswg_title
: currentType ==
"directResultsObj"
_.has(
detailsObj,
"pinswg_applicationacceptedasvalid"
) ||
_.has(
detailsObj,
"pinswg_startdates"
)) &&
showReps(
detailsObj.pinswg_startdate ||
detailsObj.pinswg_startdates ||
detailsObj.pinswg_applicationacceptedasvalid,
detailsObj.pinswg_finalcommentsduedate ||
detailsObj.pinswg_endofrepresentationperiod
) && (
<>
{showRepButton(
props
.currentView
.caseReference
.appealType
) ? (
<>
<Link
href={{
pathname:
"/myportal/representation",
query: {
case:
currentType ==
"searchResultsObj"
? detailsObj.ticketnumber
: casesObj.reference
}
}}
className="govuk-button"
>
{t(
"case:summary-make-representation-label"
)}
</Link>
<a
onClick={() => {
//spinnerState();
router.back();
}}
className="govuk-button govuk-button--secondary"
>
{t(
"case:summary-back-button-label"
)}
</a>
</>
) : !isLPA &&
props.currentView
.caseReference
.appealType ==
846040004 ? (
""
) : (
<>
<div className="govuk-grid-column-full govuk-!-padding-left-0">
<div className="govuk-button-group">
<p className="govuk-body">
{t(
"case:representation-date-passed-label",
{
startDate:
formatDates(
detailsObj.pinswg_startdate
),
endDate:
props
.currentView
.caseReference
.appealType ==
846040019
? formatDates(
detailsObj.pinswg_statementduedate
)
: formatDates(
detailsObj.pinswg_finalcommentsduedate
)
}
)}
<br />{" "}
{t(
"case:representation-date-passed-additional-label"
)}{" "}
<Link
href={
"mailto:" +
t(
"home:login-contact-email"
)
}
>
: currentType ==
"watchedCases"
? casesObj.pinswg_title
: currentType ==
"directResultsObj"
? detailsObj.ticketnumber
: casesObj.reference
}
}}
className="govuk-button"
>
{t(
"case:summary-make-representation-label"
)}
</Link>
</>
) : !isLPA &&
props
.currentView
.caseReference
.appealType ==
846040004 ? (
""
) : (
<>
<div className="govuk-grid-column-full govuk-!-padding-left-0">
<div className="govuk-button-group">
<p className="govuk-body">
{t(
"home:login-contact-email"
"case:representation-date-passed-label",
{
startDate:
formatDates(
detailsObj.pinswg_startdate
),
endDate:
props
.currentView
.caseReference
.appealType ==
846040019
? formatDates(
detailsObj.pinswg_statementduedate
)
: formatDates(
detailsObj.pinswg_finalcommentsduedate
)
}
)}
</Link>
</p>
<br />{" "}
{t(
"case:representation-date-passed-additional-label"
)}{" "}
<Link
href={
"mailto:" +
t(
"home:login-contact-email"
)
}
>
{t(
"home:login-contact-email"
)}
</Link>
</p>
</div>
</div>
</div>
</>
)}
</>
)}
<div className="govuk-body">
</>
)}
</>
)}
<Link
className="govuk-button govuk-button--secondary"
href={{
pathname:
(session
? "/myportal"
: "") +
(router.query
.adv ==
"true"
? "/advancedsearchresults"
: router
.query
.ads ==
"true"
? "/addresssearchresults"
: "/searchresults"),
query: router.query
}}
>
{" "}
{t(
"case:summary-back-button-label"
)}
</Link>
</div>
<div className="govuk-button-group">
{session &&
(isWatchedCase(
props.currentView
@@ -1245,13 +1251,6 @@ const CaseSummary = (props) => {
"case:send-email-notifications"
)}
</button>
{/* <button
onClick={
handleOpenModal
}
>
Open Modal
</button> */}
</>
))}
{!session && (
@@ -1939,16 +1938,6 @@ const CaseSummary = (props) => {
)}
</Link>
)}
<a
onClick={() => {
// spinnerState();
router.back();
}}
className="govuk-button govuk-button--secondary"
>
{t("case:summary-back-button-label")}
</a>
</div>
</div>
</div>
+58 -68
View File
@@ -13,11 +13,11 @@ import { useEffect } from "react";
import { setLoggedInUserId } from "../../store/accountDetails/action";
import {
setSearchDetails,
setSearchResults,
setSearchResults
} from "../../store/searchOutput/action";
import {
setWatchedCases,
setWatchedCasesDetails,
setWatchedCasesDetails
} from "../../store/watchedCases/action";
import { getDetailsProxy } from "../utils";
@@ -27,7 +27,7 @@ import { signIn, useSession } from "next-auth/react";
import {
createWatchedCases,
deleteWatchedCases,
getWatchedCasesProxy,
getWatchedCasesProxy
} from "../../actions";
import RepsOnResults from "./repsonresults";
@@ -71,7 +71,7 @@ const SearchResults = (props) => {
setWatchedCases,
setWatchedCasesDetails,
isLinkedCase,
showLoginCheck,
showLoginCheck
} = props;
let { t } = useTranslation();
@@ -109,7 +109,7 @@ const SearchResults = (props) => {
let updateBody = {
"pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")",
"pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")",
"pinswg_appealcasetype": +appealType,
"pinswg_appealcasetype": +appealType
};
createWatchedCases(updateBody)
@@ -117,12 +117,12 @@ const SearchResults = (props) => {
.then(() => {
getWatchedCasesProxy(props.accountDetails.loggedinUserId).then(
(data) => {
setWatchedCases(data),
(setWatchedCases(data),
getDetailsProxy(data, "myWatchedCases").then(
(data) => {
setWatchedCasesDetails(data);
}
);
));
}
);
});
@@ -138,7 +138,7 @@ const SearchResults = (props) => {
"pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")",
"pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")",
"pinswg_appealcasetype": +appealType,
"pinswg_emailnotifications": true,
"pinswg_emailnotifications": true
};
console.log("Email signed up");
@@ -147,12 +147,12 @@ const SearchResults = (props) => {
.then(() => {
getWatchedCasesProxy(props.accountDetails.loggedinUserId).then(
(data) => {
setWatchedCases(data),
(setWatchedCases(data),
getDetailsProxy(data, "myWatchedCases").then(
(data) => {
setWatchedCasesDetails(data);
}
);
));
}
);
});
@@ -165,7 +165,7 @@ const SearchResults = (props) => {
whichIncident +
"')]",
json: watchedCases,
eval: true,
eval: true
});
return isWatched;
@@ -179,7 +179,7 @@ const SearchResults = (props) => {
"' && @.pinswg_emailnotifications==true)]",
json: watchedCases,
eval: true,
eval: true
});
return isEmail;
};
@@ -203,7 +203,7 @@ const SearchResults = (props) => {
let newObj = {};
return Object.assign(newObj, {
"@odata.count": required.length,
"value": required,
"value": required
});
};
@@ -214,12 +214,12 @@ const SearchResults = (props) => {
var dateB = new Date(b.createdon);
return dateB - dateA;
});
setWatchedCases(data),
(setWatchedCases(data),
getDetailsProxy(data, "myWatchedCases").then(
(data) => {
setWatchedCasesDetails(data);
}
);
));
});
});
};
@@ -354,7 +354,7 @@ const SearchResults = (props) => {
'")]',
json: searchDetailsObj,
eval: true,
eval: true
});
detailsObj = detailsObj[0];
return (
@@ -364,34 +364,24 @@ const SearchResults = (props) => {
>
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
<Link
href={
(router.locale == "cy"
? myportal == true
? "/fymhorth/achos"
: "/achos"
: myportal == true
? "/myportal/case"
: "/case") +
"/" +
item.ticketnumber
}
href={{
pathname:
(router.locale == "cy"
? myportal == true
? "/fymhorth/achos"
: "/achos"
: myportal == true
? "/myportal/case"
: "/case") +
"/" +
item.ticketnumber,
query: {
...router.query,
adv: "false",
ads: "true"
}
}}
className="govuk-link--no-underline"
// onClick={() => {
// setCurrentReference({
// "ticketnumber":
// item.ticketnumber,
// "currentReference":
// item.title,
// "currentType":
// "searchResultsObj",
// "incidentid":
// item.incidentid,
// "appealType":
// item.pinswg_appealcasetype,
// "showLoginCheck":
// props.showLoginCheck,
// });
// }}
>
<span className="results-visually-hidden">
{t(
@@ -424,13 +414,13 @@ const SearchResults = (props) => {
) < 0
? detailsObj.pinswg_projectlocation
: router.locale ==
"cy"
? detailsObj.pinswg_projectlocation.split(
";"
)[1]
: detailsObj.pinswg_projectlocation.split(
";"
)[0]
"cy"
? detailsObj.pinswg_projectlocation.split(
";"
)[1]
: detailsObj.pinswg_projectlocation.split(
";"
)[0]
: "",
highlightQuery
)
@@ -578,7 +568,7 @@ const SearchResults = (props) => {
:
</span>
{_.has(detailsObj, [
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue",
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
])
? detailsObj[
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
@@ -593,7 +583,7 @@ const SearchResults = (props) => {
:
</span>
{_.has(item, [
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue",
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
])
? router.locale == "cy"
? jsonpath({
@@ -604,14 +594,14 @@ const SearchResults = (props) => {
] +
'")].value_cy',
json: transLookup,
eval: true,
eval: true
})
: item[
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
] || "N/A"
: ""}
{_.has(item, [
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue",
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
])
? router.locale == "cy"
? jsonpath({
@@ -622,7 +612,7 @@ const SearchResults = (props) => {
] +
'")].value_cy',
json: transLookup,
eval: true,
eval: true
})
: item[
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
@@ -658,7 +648,7 @@ const SearchResults = (props) => {
] +
'")].value_cy',
json: transLookup,
eval: true,
eval: true
})
: item["pinswg_appealType"] ||
"N/A"}
@@ -680,7 +670,7 @@ const SearchResults = (props) => {
] +
'")].value_cy',
json: transLookup,
eval: true,
eval: true
})
: item[
"statuscode@OData.Community.Display.V1.FormattedValue"
@@ -834,7 +824,7 @@ const SearchResults = (props) => {
"&toWatch=" +
item.incidentid +
"_" +
item.pinswg_appealcasetype,
item.pinswg_appealcasetype
});
}}
title={t(
@@ -865,7 +855,7 @@ const SearchResults = (props) => {
"&toWatch=" +
item.incidentid +
"_" +
item.pinswg_appealcasetype,
item.pinswg_appealcasetype
});
}}
>
@@ -903,7 +893,7 @@ const SearchResults = (props) => {
resultsArr = _.sortBy(resultsArr, [
function (o) {
return o[orderBy];
},
}
]);
fieldSort == "desc" && resultsArr.reverse();
@@ -946,7 +936,7 @@ const SearchResults = (props) => {
"pinswg_WatchedCase@odata.bind":
"/incidents(" + incidentID + ")",
"pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")",
"pinswg_appealcasetype": +appealType,
"pinswg_appealcasetype": +appealType
};
createWatchedCases(updateBody)
@@ -955,12 +945,12 @@ const SearchResults = (props) => {
getWatchedCasesProxy(
props.accountDetails.loggedinUserId
).then((data) => {
setWatchedCases(data),
(setWatchedCases(data),
getDetailsProxy(data, "myWatchedCases").then(
(data) => {
setWatchedCasesDetails(data);
}
);
));
});
});
};
@@ -983,7 +973,7 @@ const SearchResults = (props) => {
setLoggedInUserId(props.accountDetails.loggedinUserId);
setCookie(null, "pinsUser", props.accountDetails.loggedinUserId, {
path: "/",
expires: expDate,
expires: expDate
});
selectWatchedCase(
props.accountDetails.loggedinUserId,
@@ -1006,7 +996,7 @@ const SearchResults = (props) => {
getSearchPageResults,
setWatchedCasesDetails,
props.accountDetails.loggedinUserId,
router.query,
router.query
]);
return (
@@ -1024,7 +1014,7 @@ const SearchResults = (props) => {
{resultsArr.length > 200
? t("search:searchresults-max-count-label")
: t("search:searchresults-count-label", {
count: searchResultsObj["@odata.count"],
count: searchResultsObj["@odata.count"]
})}
.
{advancedSearch != true ? (
@@ -1108,7 +1098,7 @@ const mapDispatchToProps = (dispatch) => {
},
setWatchedCasesDetails: (watchedCasesDetails) => {
dispatch(setWatchedCasesDetails(watchedCasesDetails));
},
}
// setCurrentPage: (currentPage) => {
// dispatch(setCurrentPage(currentPage));
// },
@@ -1118,7 +1108,7 @@ const mapDispatchToProps = (dispatch) => {
const mapStateToProps = (state) => {
return {
// currentView: state.currentView,
accountDetails: state.accountDetails,
accountDetails: state.accountDetails
// search: state.search,
// searchResultsObj: state.searchResultsObj,
};
+73 -65
View File
@@ -9,7 +9,7 @@ import { getAdvancedSearchPaged, getBasicSearchPaged } from "../../actions";
import transLookup from "../../data/lookuptranslations.json";
import {
setCurrentPage,
setCurrentReference,
setCurrentReference
} from "../../store/currentView/action";
import { parseCookies, setCookie } from "nookies";
@@ -17,11 +17,11 @@ import { useEffect } from "react";
import { setLoggedInUserId } from "../../store/accountDetails/action";
import {
setSearchDetails,
setSearchResults,
setSearchResults
} from "../../store/searchOutput/action";
import {
setWatchedCases,
setWatchedCasesDetails,
setWatchedCasesDetails
} from "../../store/watchedCases/action";
import { getDetailsProxy, getSearchDetailsPaged } from "../utils";
@@ -31,11 +31,12 @@ import { signIn, useSession } from "next-auth/react";
import {
createWatchedCases,
deleteWatchedCases,
getWatchedCasesProxy,
getWatchedCasesProxy
} from "../../actions";
import { sendGAEvent } from "@next/third-parties/google";
import RepsOnResults from "./repsonresults";
import { query } from "jsonpath";
const escapeRegExp = (string) => string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -78,7 +79,7 @@ const SearchResults = (props) => {
setWatchedCasesDetails,
isLinkedCase,
setCurrentPage,
showLoginCheck,
showLoginCheck
} = props;
let { t } = useTranslation();
@@ -116,7 +117,7 @@ const SearchResults = (props) => {
let updateBody = {
"pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")",
"pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")",
"pinswg_appealcasetype": +appealType,
"pinswg_appealcasetype": +appealType
};
createWatchedCases(updateBody)
@@ -124,12 +125,12 @@ const SearchResults = (props) => {
.then(() => {
getWatchedCasesProxy(props.accountDetails.loggedinUserId).then(
(data) => {
setWatchedCases(data),
(setWatchedCases(data),
getDetailsProxy(data, "myWatchedCases").then(
(data) => {
setWatchedCasesDetails(data);
}
);
));
}
);
});
@@ -145,7 +146,7 @@ const SearchResults = (props) => {
"pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")",
"pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")",
"pinswg_appealcasetype": +appealType,
"pinswg_emailnotifications": true,
"pinswg_emailnotifications": true
};
console.log("Email signed up");
@@ -154,12 +155,12 @@ const SearchResults = (props) => {
.then(() => {
getWatchedCasesProxy(props.accountDetails.loggedinUserId).then(
(data) => {
setWatchedCases(data),
(setWatchedCases(data),
getDetailsProxy(data, "myWatchedCases").then(
(data) => {
setWatchedCasesDetails(data);
}
);
));
}
);
});
@@ -173,7 +174,7 @@ const SearchResults = (props) => {
"')]",
json: watchedCases,
eval: true,
eval: true
});
return isWatched;
@@ -187,7 +188,7 @@ const SearchResults = (props) => {
"' && @.pinswg_emailnotifications==true)]",
json: watchedCases,
eval: true,
eval: true
});
return isEmail;
};
@@ -200,7 +201,7 @@ const SearchResults = (props) => {
"')]",
json: watchedCases,
eval: true,
eval: true
});
return isWatched;
@@ -225,7 +226,7 @@ const SearchResults = (props) => {
let newObj = {};
return Object.assign(newObj, {
"@odata.count": required.length,
"value": required,
"value": required
});
};
@@ -236,12 +237,12 @@ const SearchResults = (props) => {
var dateB = new Date(b.createdon);
return dateB - dateA;
});
setWatchedCases(data),
(setWatchedCases(data),
getDetailsProxy(data, "myWatchedCases").then(
(data) => {
setWatchedCasesDetails(data);
}
);
));
});
});
};
@@ -259,7 +260,7 @@ const SearchResults = (props) => {
? searchString.map(([key, val]) => val).filter(Boolean)
: searchString;
const ResultsView = (resultsArr) => {
const ResultsView = (resultsArr, currPage) => {
return (
<>
<dl className="govuk-summary-list govuk-!-margin-bottom-9 results">
@@ -374,7 +375,7 @@ const SearchResults = (props) => {
item.ticketnumber +
'")]',
json: searchDetailsObj,
eval: true,
eval: true
});
Object.assign(item, item.pinswg_sipscase);
@@ -388,25 +389,32 @@ const SearchResults = (props) => {
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
<div></div>
<Link
href={
(router.locale == "cy"
? myportal == true
? "/fymhorth/achos"
: "/achos"
: myportal == true
? "/myportal/case"
: "/case") +
"/" +
item.ticketnumber
}
href={{
pathname:
(router.locale == "cy"
? myportal == true
? "/fymhorth/achos"
: "/achos"
: myportal == true
? "/myportal/case"
: "/case") +
"/" +
item.ticketnumber,
query: {
...router.query,
adv: advancedSearch
? "true"
: "false"
}
}}
className="govuk-link--no-underline"
onClick={() => {
sendGAEvent(
(sendGAEvent(
"event",
"CaseViewed",
{
caseReference:
item.ticketnumber,
item.ticketnumber
}
),
setCurrentReference({
@@ -428,11 +436,11 @@ const SearchResults = (props) => {
)
? detailsObj.pinswg_speacialistcaseprocess
: detailsObj.hasOwnProperty(
"pinswg_specialistcaseprocess"
)
? detailsObj.pinswg_specialistcaseprocess
: "",
});
"pinswg_specialistcaseprocess"
)
? detailsObj.pinswg_specialistcaseprocess
: ""
}));
}}
>
<span className="results-visually-hidden">
@@ -486,12 +494,12 @@ const SearchResults = (props) => {
) < 0
? detailsObj.pinswg_projectlocation
: router.locale == "cy"
? detailsObj.pinswg_projectlocation.split(
";"
)[1]
: detailsObj.pinswg_projectlocation.split(
";"
)[0]
? detailsObj.pinswg_projectlocation.split(
";"
)[1]
: detailsObj.pinswg_projectlocation.split(
";"
)[0]
: ""
: // : hasValidKey(
// item,
@@ -585,12 +593,12 @@ const SearchResults = (props) => {
" " +
item.pinswg_appellantlastname
: _.has(detailsObj, [
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue",
])
? detailsObj[
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
]
: ""}
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
])
? detailsObj[
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
]
: ""}
</dd>
<dd className="govuk-summary-list__value govuk-!-font-size-16">
<span className="results-visually-hidden">
@@ -600,7 +608,7 @@ const SearchResults = (props) => {
:
</span>
{_.has(item, [
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue",
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
])
? router.locale == "cy"
? jsonpath({
@@ -611,7 +619,7 @@ const SearchResults = (props) => {
] +
'")].value_cy',
json: transLookup,
eval: true,
eval: true
})
: item[
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
@@ -647,7 +655,7 @@ const SearchResults = (props) => {
] +
'")].value_cy',
json: transLookup,
eval: true,
eval: true
})
: item[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
@@ -670,7 +678,7 @@ const SearchResults = (props) => {
] +
'")].value_cy',
json: transLookup,
eval: true,
eval: true
})
: item[
"statuscode@OData.Community.Display.V1.FormattedValue"
@@ -821,7 +829,7 @@ const SearchResults = (props) => {
"&toWatch=" +
item.incidentid +
"_" +
item.pinswg_appealcasetype,
item.pinswg_appealcasetype
});
}}
title={t(
@@ -949,7 +957,7 @@ const SearchResults = (props) => {
searchString,
selectedOption,
setSearchDetails,
setSearchResults,
setSearchResults
]
);
@@ -973,7 +981,7 @@ const SearchResults = (props) => {
"pinswg_WatchedCase@odata.bind":
"/incidents(" + incidentID + ")",
"pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")",
"pinswg_appealcasetype": +appealType,
"pinswg_appealcasetype": +appealType
};
createWatchedCases(updateBody)
@@ -982,12 +990,12 @@ const SearchResults = (props) => {
getWatchedCasesProxy(
props.accountDetails.loggedinUserId
).then((data) => {
setWatchedCases(data),
(setWatchedCases(data),
getDetailsProxy(data, "myWatchedCases").then(
(data) => {
setWatchedCasesDetails(data);
}
);
));
});
});
};
@@ -1010,7 +1018,7 @@ const SearchResults = (props) => {
setLoggedInUserId(props.accountDetails.loggedinUserId);
setCookie(null, "pinsUser", props.accountDetails.loggedinUserId, {
path: "/",
expires: expDate,
expires: expDate
});
selectWatchedCase(
props.accountDetails.loggedinUserId,
@@ -1033,7 +1041,7 @@ const SearchResults = (props) => {
getSearchPageResults,
setWatchedCasesDetails,
props.accountDetails.loggedinUserId,
router.query,
router.query
]);
//console.log(
// "page is here ",
@@ -1059,7 +1067,7 @@ const SearchResults = (props) => {
: t("search:searchresults-count-label", {
count: searchResultsObj[
"@odata.count"
],
]
})}
.
{advancedSearch != true ? (
@@ -1122,7 +1130,7 @@ const SearchResults = (props) => {
</div>
)}
{resultsArr.length > 0 ? (
ResultsView(resultsArr)
ResultsView(resultsArr, props.currentView.currentPage)
) : (
<div className="govuk-grid-row">
<div className="govuk-grid-column-two-thirds">
@@ -1157,14 +1165,14 @@ const mapDispatchToProps = (dispatch) => {
},
setCurrentPage: (currentPage) => {
dispatch(setCurrentPage(currentPage));
},
}
};
};
const mapStateToProps = (state) => {
return {
// currentView: state.currentView,
accountDetails: state.accountDetails,
currentView: state.currentView,
accountDetails: state.accountDetails
// search: state.search,
// searchResultsObj: state.searchResultsObj,
};