diff --git a/components/search/searchresults.js b/components/search/searchresults.js index a2f4c853..9c3df8a4 100644 --- a/components/search/searchresults.js +++ b/components/search/searchresults.js @@ -110,23 +110,24 @@ const SearchResults = (props) => { "pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")", "pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")", "pinswg_appealcasetype": +appealType, + "pinswg_emailnotifications": true, }; console.log("Email signed up"); - // createWatchedCases(updateBody) - // .then((data) => data) - // .then(() => { - // getWatchedCasesProxy(props.accountDetails.loggedinUserId).then( - // (data) => { - // setWatchedCases(data), - // getDetailsProxy(data, "myWatchedCases").then( - // (data) => { - // setWatchedCasesDetails(data); - // } - // ); - // } - // ); - // }); + createWatchedCases(updateBody) + .then((data) => data) + .then(() => { + getWatchedCasesProxy(props.accountDetails.loggedinUserId).then( + (data) => { + setWatchedCases(data), + getDetailsProxy(data, "myWatchedCases").then( + (data) => { + setWatchedCasesDetails(data); + } + ); + } + ); + }); }; const isWatchedCase = (whichIncident) => { @@ -143,6 +144,19 @@ const SearchResults = (props) => { return isWatched; }; + const isEmailSignUp = (whichIncident) => { + let isEmail = jsonpath({ + path: + "$..value[?(@ && @._pinswg_watchedcase_value=='" + + whichIncident + + "' && @.pinswg_emailnotifications==true)]", + + json: watchedCases, + eval: true, + }); + return isEmail; + }; + const isEmailNotifications = (whichIncident) => { let isWatched = jsonpath({ path: @@ -643,28 +657,57 @@ const SearchResults = (props) => { )} - + {isEmailSignUp(item.incidentid) + .length > + 0 == + true ? ( + + ) : ( + + )} )} diff --git a/styles/sass/welshgov/_application.scss b/styles/sass/welshgov/_application.scss index 646a3e89..b4b69a93 100644 --- a/styles/sass/welshgov/_application.scss +++ b/styles/sass/welshgov/_application.scss @@ -2403,7 +2403,18 @@ ul#sharePageLinks.active { } } + + + + +dd.govuk-summary-list__value.govuk-\!-font-size-14.govuk-summary-list__action { + display: flex; + flex-direction: column; + border: none +} + .govuk-summary-list__actionLink { + border: 1px solid $red; padding: 5px; height: 20px;