16951 mail notification subscribe

This commit is contained in:
2025-05-30 10:16:21 +01:00
parent eb020b014d
commit 2cfb06db2a
2 changed files with 90 additions and 36 deletions
+59 -16
View File
@@ -110,23 +110,24 @@ const SearchResults = (props) => {
"pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")", "pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")",
"pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")", "pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")",
"pinswg_appealcasetype": +appealType, "pinswg_appealcasetype": +appealType,
"pinswg_emailnotifications": true,
}; };
console.log("Email signed up"); console.log("Email signed up");
// createWatchedCases(updateBody) createWatchedCases(updateBody)
// .then((data) => data) .then((data) => data)
// .then(() => { .then(() => {
// getWatchedCasesProxy(props.accountDetails.loggedinUserId).then( getWatchedCasesProxy(props.accountDetails.loggedinUserId).then(
// (data) => { (data) => {
// setWatchedCases(data), setWatchedCases(data),
// getDetailsProxy(data, "myWatchedCases").then( getDetailsProxy(data, "myWatchedCases").then(
// (data) => { (data) => {
// setWatchedCasesDetails(data); setWatchedCasesDetails(data);
// } }
// ); );
// } }
// ); );
// }); });
}; };
const isWatchedCase = (whichIncident) => { const isWatchedCase = (whichIncident) => {
@@ -143,6 +144,19 @@ const SearchResults = (props) => {
return isWatched; 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) => { const isEmailNotifications = (whichIncident) => {
let isWatched = jsonpath({ let isWatched = jsonpath({
path: path:
@@ -643,6 +657,32 @@ const SearchResults = (props) => {
<span className="eye"></span> <span className="eye"></span>
</button> </button>
)} )}
{isEmailSignUp(item.incidentid)
.length >
0 ==
true ? (
<button
className="govuk-summary-list__actionLink mailLink watched_link"
title="Unsubscribe to email updates"
onClick={() => {
confirm(
" Do you want to unsubscribe to email updates for " +
item.title +
"?"
) &&
deleteItem(
isEmailSignUp(
item.incidentid
)[0]
.pinswg_watchlistid,
"watchedCases"
);
}}
>
<span className="mailicon icon"></span>
</button>
) : (
<button <button
className="govuk-summary-list__actionLink mailLink" className="govuk-summary-list__actionLink mailLink"
title="Email about changes" title="Email about changes"
@@ -653,10 +693,12 @@ const SearchResults = (props) => {
"?" "?"
) && ) &&
selectEmailNotifications( selectEmailNotifications(
props.accountDetails props
.accountDetails
.accountDetails .accountDetails
.emailaddress1, .emailaddress1,
props.accountDetails props
.accountDetails
.loggedinUserId, .loggedinUserId,
item.incidentid, item.incidentid,
item.pinswg_appealcasetype item.pinswg_appealcasetype
@@ -665,6 +707,7 @@ const SearchResults = (props) => {
> >
<span className="mailicon icon"></span> <span className="mailicon icon"></span>
</button> </button>
)}
</dd> </dd>
)} )}
+11
View File
@@ -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 { .govuk-summary-list__actionLink {
border: 1px solid $red; border: 1px solid $red;
padding: 5px; padding: 5px;
height: 20px; height: 20px;