From 3e83332d28cd16032b7333d67a532cb1553881fe Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Mon, 29 Jan 2024 15:11:23 +0000 Subject: [PATCH] updated watched cases with language and confirm --- .env.local | 22 ++-- components/case/summary.js | 80 +++++++----- .../myportal/awaitingsubmissionfromblob.js | 33 ++--- components/myportal/topthree.js | 50 +++---- components/myportal/watchedcases.js | 5 +- components/search/dnssearchresults.js | 47 +++---- components/search/searchresults.js | 122 ++++++++++-------- i18n.js | 2 +- locales/cy/case.json | 8 +- locales/en/case.json | 8 +- pages/case/index.js | 3 +- pages/dns/[developmentName].js | 1 + pages/myportal/case.js | 2 + 13 files changed, 216 insertions(+), 167 deletions(-) diff --git a/.env.local b/.env.local index c221e6b4..c66bb39a 100644 --- a/.env.local +++ b/.env.local @@ -5,11 +5,11 @@ GRANT_TYPE = "client_credentials" HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136d84f68818d3a96399467b52143e273d4f3bf4ae190848891535421cd6c //Dev oauth ESNR -//CLIENT_ID = 9b834097-03d7-409b-b038-ecfec31a394a -//CLIENT_SECRET = AU88Q~NBOVOXqwb4mBx9y.NMIZ9s1o7boqZoKcSE -//RELAY_ROOT = https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/ -//RELAYURI = "dev-pedw-ns.servicebus.windows.net" -//RELAYPATH = "dev-pedw-hc" +CLIENT_ID = 9b834097-03d7-409b-b038-ecfec31a394a +CLIENT_SECRET = AU88Q~NBOVOXqwb4mBx9y.NMIZ9s1o7boqZoKcSE +RELAY_ROOT = https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/ +RELAYURI = "dev-pedw-ns.servicebus.windows.net" +RELAYPATH = "dev-pedw-hc" //Test Oauth ESNR @@ -30,12 +30,12 @@ HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136 //Prod Oauth WGO -CLIENT_ID = 3e4141a3-1fbd-454e-98f0-7f3a4f14a3cc -//CLIENT_SECRET = mJN7Q~lFu.xFGa5KCc.zwIm_fJAWxajyQaFo~ -CLIENT_SECRET = tFk8Q~E.R-HFjROTu1sRKqwb_ONzy05uPYoF6awR -RELAY_ROOT = https://prod-pedw-ns.servicebus.windows.net/prod-pedw-hc/ -RELAYURI = "prod-pedw-ns.servicebus.windows.net" -RELAYPATH = "prod-pedw-hc" +//CLIENT_ID = 3e4141a3-1fbd-454e-98f0-7f3a4f14a3cc +////CLIENT_SECRET = mJN7Q~lFu.xFGa5KCc.zwIm_fJAWxajyQaFo~ +//CLIENT_SECRET = tFk8Q~E.R-HFjROTu1sRKqwb_ONzy05uPYoF6awR +//RELAY_ROOT = https://prod-pedw-ns.servicebus.windows.net/prod-pedw-hc/ +//RELAYURI = "prod-pedw-ns.servicebus.windows.net" +//RELAYPATH = "prod-pedw-hc" GOOGLE_TAG_MANAGER = GTM-T78CBC3 diff --git a/components/case/summary.js b/components/case/summary.js index a4d0b49e..26340b3c 100644 --- a/components/case/summary.js +++ b/components/case/summary.js @@ -411,8 +411,7 @@ const CaseSummary = (props) => { */} - - {showLoginCheck == true && ( + {showLoginCheck == "true" && ( <>
@@ -466,26 +465,27 @@ const CaseSummary = (props) => { { - deleteItem( - isWatchedCase( - props - .currentView - .caseReference - .incidentid - )[0] - .pinswg_watchlistid, - - "watchedCases" - ); - alert( + confirm( t( "case:you-have-stopped-watching-label" ) + props .currentView .caseReference - .currentReference - ); + .currentReference + + "?" + ) && + deleteItem( + isWatchedCase( + props + .currentView + .caseReference + .incidentid + )[0] + .pinswg_watchlistid, + + "watchedCases" + ); }} title={t( "case:stop-watching-case-link" @@ -499,17 +499,7 @@ const CaseSummary = (props) => { { - selectWatchedCase( - props.accountDetails - .loggedinUserId, - props.currentView - .caseReference - .incidentid, - props.currentView - .caseReference - .appealType - ); - alert( + confirm( t( "case:you-are-watching-label" ) + @@ -517,8 +507,22 @@ const CaseSummary = (props) => { props .currentView .caseReference - .currentReference - ); + .currentReference + + "?" + ) && + selectWatchedCase( + props + .accountDetails + .loggedinUserId, + props + .currentView + .caseReference + .incidentid, + props + .currentView + .caseReference + .appealType + ); }} > {t( @@ -532,7 +536,7 @@ const CaseSummary = (props) => { className="govuk-link" onClick={() => { // signIn("email"); - signIn(); + // signIn(); // selectWatchedCase( // cookies.pinsUser, // item.incidentid, @@ -542,6 +546,21 @@ const CaseSummary = (props) => { // "Trying to watch case " + // item.title // ); + confirm( + "Trying to watch case " + + props.currentView + .caseReference + .currentReference + + "\n\nYou will now be prompted to sign in" + ) && + signIn("email", { + callbackUrl: + "/myportal/searchresults?q=" + + props + .currentView + .caseReference + .currentReference, + }); }} title={t( "case:watch-this-case-link" @@ -576,6 +595,7 @@ const CaseSummary = (props) => {
)} + {/* 1{" "} {_.has(detailsObj, "pinswg_startdatetimeiftheevent") && detailsObj.pinswg_startdatetimeiftheevent} diff --git a/components/myportal/awaitingsubmissionfromblob.js b/components/myportal/awaitingsubmissionfromblob.js index aa28e440..1a6b7de0 100644 --- a/components/myportal/awaitingsubmissionfromblob.js +++ b/components/myportal/awaitingsubmissionfromblob.js @@ -92,10 +92,9 @@ const AwaitingSubmissionFromBlob = (props) => { showTopThreeArr[key] .pinswg_appealcasetype, }); - }}> - + }} + > {showTopThreeArr[index].pinswg_name} -
@@ -174,23 +173,26 @@ const AwaitingSubmissionFromBlob = (props) => { : showTopThreeArrDets[key]["pinswg_lpaname"] || ""}
- { - event.preventDefault(); - deleteCaseItem( - props.containerID, - showTopThreeArr[key].pinswg_name - ); - alert( - "You have deleted case " + + confirm( + t("case:do-you-want-to-delete-case-label") + + showTopThreeArr[key].pinswg_name + + "?\n" + + t( + "case:do-you-want-to-delete-case-disclaimer-label" + ) + ) && + deleteCaseItem( + props.containerID, showTopThreeArr[key].pinswg_name - ); + ); }} > — - +
); @@ -226,10 +228,9 @@ const AwaitingSubmissionFromBlob = (props) => { "viewName": "Awaiting Submission", "viewKey": "awaitingSubmissionDetails", }); - }}> - + }} + > {t("myportal:viewall-link")} - )} diff --git a/components/myportal/topthree.js b/components/myportal/topthree.js index d677ac60..09b65e7d 100644 --- a/components/myportal/topthree.js +++ b/components/myportal/topthree.js @@ -194,8 +194,8 @@ const TopThree = (props) => { showTopThreeArr[key] .pinswg_appealcasetype, }); - }}> - + }} + > {topThreeType != "watchedCases" ? topThreeType != "myRepresentations" ? showTopThreeArr[key].ticketnumber @@ -205,7 +205,6 @@ const TopThree = (props) => { : showTopThreeArr[key][ "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" ]}{" "} - {/* {(topThreeType == "awaitingSubmission" || @@ -301,46 +300,47 @@ const TopThree = (props) => { {topThreeType == "watchedCases" && (
- { - event.preventDefault(); - deleteItem( - showTopThreeArr[key].pinswg_watchlistid, - "watchedCases" - ); - alert( - "You have stopped watching case " + + confirm( + t("case:you-have-stopped-watching-label") + showTopThreeArr[key][ "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" ] - ); + ) && + deleteItem( + showTopThreeArr[key].pinswg_watchlistid, + "watchedCases" + ); }} > — - +
)} {topThreeType == "awaitingSubmission" && (
- { - event.preventDefault(); - deleteItem( - showTopThreeArr[key].incidentid, - "awaitingSubmission" - ); - alert( - "You have deleted case " + - showTopThreeArr[key].ticketnumber - ); + confirm( + t("case:do-you-want-to-delete-case-label") + + showTopThreeArr[key].ticketnumber + + "?\n" + + t( + "case:do-you-want-to-delete-case-disclaimer-label" + ) + ) && + deleteItem( + showTopThreeArr[key].incidentid, + "awaitingSubmission" + ); }} > — - +
)} diff --git a/components/myportal/watchedcases.js b/components/myportal/watchedcases.js index e5ff6c13..b9b4d6ba 100644 --- a/components/myportal/watchedcases.js +++ b/components/myportal/watchedcases.js @@ -43,10 +43,9 @@ const WatchedCases = (props) => { "viewName": "Watched Cases", "viewKey": "watchedCases", }); - }}> - + }} + > {t("myportal:viewall-link")} - )} diff --git a/components/search/dnssearchresults.js b/components/search/dnssearchresults.js index 637af5f3..bfefb804 100644 --- a/components/search/dnssearchresults.js +++ b/components/search/dnssearchresults.js @@ -369,8 +369,8 @@ const DNSSearchResults = (props) => { item.pinswg_appealcasetype, "showMap": showMap, }); - }}> - + }} + > {t( "search:searchresults-case-reference-label" @@ -378,7 +378,6 @@ const DNSSearchResults = (props) => { : {item.title} -
@@ -531,19 +530,21 @@ const DNSSearchResults = (props) => { { - deleteItem( - isWatchedCase( - item.incidentid - )[0] - .pinswg_watchlistid, - - "watchedCases" - ); - alert( + confirm( t( "case:you-have-stopped-watching-label" - ) + item.title - ); + ) + + item.title + + "?" + ) && + deleteItem( + isWatchedCase( + item.incidentid + )[0] + .pinswg_watchlistid, + + "watchedCases" + ); }} title={t( "case:stop-watching-case-link" @@ -555,16 +556,18 @@ const DNSSearchResults = (props) => { { - selectWatchedCase( - cookies.pinsUser, - item.incidentid, - item.pinswg_appealcasetype - ); - alert( + confirm( t( "case:you-are-watching-label" - ) + item.title - ); + ) + + item.title + + "?" + ) && + selectWatchedCase( + cookies.pinsUser, + item.incidentid, + item.pinswg_appealcasetype + ); }} title={t( "case:watch-this-case-link" diff --git a/components/search/searchresults.js b/components/search/searchresults.js index 00fa889b..b1fb477d 100644 --- a/components/search/searchresults.js +++ b/components/search/searchresults.js @@ -309,6 +309,8 @@ const SearchResults = (props) => { item.incidentid, "appealType": item.pinswg_appealcasetype, + "showLoginCheck": + props.showLoginCheck, }); }} > @@ -498,19 +500,21 @@ const SearchResults = (props) => { { - deleteItem( - isWatchedCase( - item.incidentid - )[0] - .pinswg_watchlistid, - - "watchedCases" - ); - alert( + confirm( t( "case:you-have-stopped-watching-label" - ) + item.title - ); + ) + + item.title + + "?" + ) && + deleteItem( + isWatchedCase( + item.incidentid + )[0] + .pinswg_watchlistid, + + "watchedCases" + ); }} title={t( "case:stop-watching-case-link" @@ -522,17 +526,20 @@ const SearchResults = (props) => { { - selectWatchedCase( - props.accountDetails - .loggedinUserId, - item.incidentid, - item.pinswg_appealcasetype - ); - alert( + confirm( t( "case:you-are-watching-label" - ) + item.title - ); + ) + + item.title + + "?" + ) && + selectWatchedCase( + props + .accountDetails + .loggedinUserId, + item.incidentid, + item.pinswg_appealcasetype + ); }} title={t( "case:watch-this-case-link" @@ -543,39 +550,48 @@ const SearchResults = (props) => { )}
)} - {showLoginCheck == "true" && !session && ( -
- { - // signIn("email"); - signIn(undefined, { - callbackUrl: - "/myportal/searchresults?q=" + - searchString + - "&toWatch=" + - item.incidentid + - "_" + - item.pinswg_appealcasetype, - }); - // selectWatchedCase( - // props.accountDetails.loggedinUserId, - // item.incidentid, - // item.pinswg_appealcasetype - // ); - alert( - "Trying to watch case " + - item.title - ); - }} - title={t( - "case:watch-this-case-link" - )} - > - - -
- )} + + {(showLoginCheck == "true" || + showLoginCheck == true) && + !session && ( +
+ + {t( + "case:watch-this-case-link" + )} + + { + confirm( + t( + "case:trying-to-watch-case-label" + ) + + item.title + + "\n\n" + + t( + "case:trying-to-watch-case-redirect-label" + ) + ) && + // signIn("email"); + signIn(undefined, { + callbackUrl: + "/myportal/searchresults?q=" + + searchString + + "&toWatch=" + + item.incidentid + + "_" + + item.pinswg_appealcasetype, + }); + }} + title={t( + "case:watch-this-case-link" + )} + > + + +
+ )} ); }) diff --git a/i18n.js b/i18n.js index 3aff356a..1a95fa43 100644 --- a/i18n.js +++ b/i18n.js @@ -12,7 +12,7 @@ module.exports = { "*": ["common", "newappeal", "search"], "/": ["common", "home", "case"], "/error": ["common", "home", "myportal"], - "/myportal": ["myportal", "common", "home"], + "/myportal": ["myportal", "common", "home", "case"], "/myportal/viewall": ["search", "myportal"], "/myportal/advancedsearch": ["search", "myportal"], "/myportal/advancedsearchresults": ["search", "myportal"], diff --git a/locales/cy/case.json b/locales/cy/case.json index 8af17e5c..86e73c17 100644 --- a/locales/cy/case.json +++ b/locales/cy/case.json @@ -88,6 +88,10 @@ "representation-period-ended-on-label": "Daeth y Cyfnod Cynrychiolaeth i ben ar ", "stop-watching-case-link": "Stopiwch wylio'r achos hwn", "watch-this-case-link": "Gwyliwch yr achos hwn", - "you-are-watching-label": "Rydych chi'n gwylio achos ", - "you-have-stopped-watching-label": "Rydych chi wedi rhoi'r gorau i wylio'r achos " + "you-are-watching-label": "Ydych chi eisiau gwylio achos ", + "trying-to-watch-case-label": "Ceisio gwylio achos ", + "trying-to-watch-case-redirect-label": "Fe'ch anogir nawr i fewngofnodi", + "you-have-stopped-watching-label": "Ydych chi am roi'r gorau i wylio achos ", + "do-you-want-to-delete-case-label": "Ydych chi am ddileu achos", + "do-you-want-to-delete-case-disclaimer-label": "Unwaith y caiff ei dileu, bydd yr holl wybodaeth a gyflwynwyd gennych yn cael ei cholli." } \ No newline at end of file diff --git a/locales/en/case.json b/locales/en/case.json index bdd0acce..87eedc85 100644 --- a/locales/en/case.json +++ b/locales/en/case.json @@ -88,6 +88,10 @@ "representation-period-ended-on-label": "Representation Period ended on ", "stop-watching-case-link": "Stop watching this case", "watch-this-case-link": "Watch this case", - "you-are-watching-label": "You are watching case ", - "you-have-stopped-watching-label": "You have stopped watching case " + "you-are-watching-label": "Do you want to watch case ", + "trying-to-watch-case-label": "Trying to watch case ", + "trying-to-watch-case-redirect-label": "You will now be prompted to sign in", + "you-have-stopped-watching-label": "Do you want to stop watching case ", + "do-you-want-to-delete-case-label": "Do you want to delete case ", + "do-you-want-to-delete-case-disclaimer-label": "Once deleted all information you have submited, will be lost." } \ No newline at end of file diff --git a/pages/case/index.js b/pages/case/index.js index 4ef5396b..86e8071d 100644 --- a/pages/case/index.js +++ b/pages/case/index.js @@ -66,7 +66,7 @@ const CaseHome = (props) => { representationsObj={ props.searchResultsObj.representationsObj } - showLoginCheck={props.showLoginCheck} + showLoginCheck={props.currentView.showLogin} />