14627 ui for email notifications

This commit is contained in:
2025-05-28 14:14:46 +01:00
parent f725c811b3
commit 6354cabde0
5 changed files with 180 additions and 3 deletions
+12
View File
@@ -1047,6 +1047,12 @@ const CaseSummary = (props) => {
"case:watch-this-case-link"
)}
</button>
<button className="govuk-link mailNotification">
Send me
email
updates
</button>
{/* <button
onClick={
handleOpenModal
@@ -1105,6 +1111,12 @@ const CaseSummary = (props) => {
"case:watch-this-case-link"
)}
</button>
<button className="govuk-link mailNotification">
Send me email
updates
</button>
{/* <button
onClick={handleOpenModal}
>
+2 -2
View File
@@ -175,8 +175,8 @@ let CaseSearch = (props) => {
<Link
href={
router.locale == "cy"
? "/cyswllt"
: "/contactus"
? "/fymhorth/cyswllt"
: "/myportal/contactus"
}
className="govuk-button withChevron govuk-button-cta"
>
+89
View File
@@ -100,6 +100,35 @@ const SearchResults = (props) => {
});
};
const selectEmailNotifications = (
emailaddress,
loggedInUser,
incidentID,
appealType
) => {
let updateBody = {
"pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")",
"pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")",
"pinswg_appealcasetype": +appealType,
};
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);
// }
// );
// }
// );
// });
};
const isWatchedCase = (whichIncident) => {
let isWatched = jsonpath({
path:
@@ -114,6 +143,20 @@ const SearchResults = (props) => {
return isWatched;
};
const isEmailNotifications = (whichIncident) => {
let isWatched = jsonpath({
path:
"$..value[?(@ && @._pinswg_watchedcase_value=='" +
whichIncident +
"')]",
json: watchedCases,
eval: true,
});
return isWatched;
};
const deleteItem = (caseID, topThreeType) => {
let cookies = parseCookies();
topThreeType == "watchedCases" &&
@@ -600,6 +643,28 @@ const SearchResults = (props) => {
<span className="eye"></span>
</button>
)}
<button
className="govuk-summary-list__actionLink mailLink"
title="Email about changes"
onClick={() => {
confirm(
" Do you want to be sent email updates for " +
item.title +
"?"
) &&
selectEmailNotifications(
props.accountDetails
.accountDetails
.emailaddress1,
props.accountDetails
.loggedinUserId,
item.incidentid,
item.pinswg_appealcasetype
);
}}
>
<span className="mailicon icon"></span>
</button>
</dd>
)}
@@ -642,6 +707,30 @@ const SearchResults = (props) => {
>
<span className="eye"></span>
</button>
<button
className="govuk-summary-list__actionLink mailLink"
title="Email about changes"
onClick={() => {
confirm(
" Do you want to be sent email updates for " +
item.title +
"?"
) &&
selectEmailNotifications(
props
.accountDetails
.accountDetails
.emailaddress1,
props
.accountDetails
.loggedinUserId,
item.incidentid,
item.pinswg_appealcasetype
);
}}
>
<span className="mailicon icon"></span>
</button>
</dd>
)}
</div>