From 20cd10394f755723b0397f52231e3ace10e38e07 Mon Sep 17 00:00:00 2001
From: rdbsolutions
Date: Tue, 9 Apr 2024 15:00:30 +0100
Subject: [PATCH 1/7] added ticketnumber props to footer component
---
pages/404.js | 2 +-
pages/_error.js | 2 +-
pages/accessibility.js | 2 +-
pages/account/changepassword.js | 2 +-
pages/account/forgottenpassword.js | 2 +-
pages/account/forgottenuser.js | 2 +-
pages/account/personaldetails.js | 2 +-
pages/account/register.js | 2 +-
pages/advancedsearch.js | 2 +-
pages/advancedsearchresults.js | 2 +-
pages/auth/error.js | 2 +-
pages/auth/signin.js | 2 +-
pages/auth/verify-request.js | 2 +-
pages/details-about-cookies.js | 2 +-
pages/dns-not-found.js | 2 +-
pages/dns/[developmentName].js | 3 ++-
pages/dns/application-process.js | 2 +-
pages/dns/application-view.js | 2 +-
pages/dns/applications.js | 2 +-
pages/dns/contact-us.js | 2 +-
pages/dns/help.js | 6 ++----
pages/dnsapplications.js | 2 +-
pages/dnsdetails.js | 7 +++++--
pages/error.js | 2 +-
pages/help/cookies.js | 2 +-
pages/index.js | 2 +-
pages/logout.js | 2 +-
pages/myportal/[appealtypes].js | 2 +-
pages/myportal/advancedsearch.js | 2 +-
pages/myportal/advancedsearchresults.js | 2 +-
pages/myportal/continuesubmission.js | 2 +-
pages/myportal/dnsapplications.js | 2 +-
pages/myportal/dnsdetails.js | 2 +-
pages/myportal/error.js | 2 +-
pages/myportal/index.js | 2 +-
pages/myportal/representation.js | 2 +-
pages/myportal/searchresults.js | 2 +-
pages/myportal/viewall.js | 2 +-
pages/newappeal/[appealtypes].js | 2 +-
pages/newappeal/aboutyou.js | 2 +-
pages/newappeal/index.js | 2 +-
pages/privacy.js | 2 +-
pages/searchresults.js | 2 +-
pages/terms-and-conditions.js | 2 +-
pages/viewall.js | 2 +-
45 files changed, 51 insertions(+), 49 deletions(-)
diff --git a/pages/404.js b/pages/404.js
index 03bd1aeb..2610d46a 100644
--- a/pages/404.js
+++ b/pages/404.js
@@ -33,7 +33,7 @@ const FourOhFour = (props) => {
-
+
);
diff --git a/pages/_error.js b/pages/_error.js
index 2a7da1f9..ee8975f4 100644
--- a/pages/_error.js
+++ b/pages/_error.js
@@ -62,7 +62,7 @@ function Error({ statusCode }, props) {
-
+
);
diff --git a/pages/accessibility.js b/pages/accessibility.js
index 86874048..bceece1c 100644
--- a/pages/accessibility.js
+++ b/pages/accessibility.js
@@ -72,7 +72,7 @@ const Accessibility = (props) => {
-
+
);
diff --git a/pages/account/changepassword.js b/pages/account/changepassword.js
index 16395062..2caddb8f 100644
--- a/pages/account/changepassword.js
+++ b/pages/account/changepassword.js
@@ -96,7 +96,7 @@ const Home = (props) => {
-
+
);
diff --git a/pages/account/forgottenpassword.js b/pages/account/forgottenpassword.js
index 565c39f5..62f612ff 100644
--- a/pages/account/forgottenpassword.js
+++ b/pages/account/forgottenpassword.js
@@ -72,7 +72,7 @@ const Home = (props) => {
-
+
);
diff --git a/pages/account/forgottenuser.js b/pages/account/forgottenuser.js
index d0983a32..7ee327d4 100644
--- a/pages/account/forgottenuser.js
+++ b/pages/account/forgottenuser.js
@@ -71,7 +71,7 @@ const Home = (props) => {
-
+
);
diff --git a/pages/account/personaldetails.js b/pages/account/personaldetails.js
index 49dc9acd..520f12c3 100644
--- a/pages/account/personaldetails.js
+++ b/pages/account/personaldetails.js
@@ -94,7 +94,7 @@ const Home = (props) => {
-
+
);
diff --git a/pages/account/register.js b/pages/account/register.js
index ff40550b..0a59dad1 100644
--- a/pages/account/register.js
+++ b/pages/account/register.js
@@ -150,7 +150,7 @@ const Home = (props) => {
-
+
);
diff --git a/pages/advancedsearch.js b/pages/advancedsearch.js
index 96186d76..4b390bd0 100644
--- a/pages/advancedsearch.js
+++ b/pages/advancedsearch.js
@@ -112,7 +112,7 @@ const Home = (props) => {
/>
)}
-
+
);
diff --git a/pages/advancedsearchresults.js b/pages/advancedsearchresults.js
index 074ffb70..4264387f 100644
--- a/pages/advancedsearchresults.js
+++ b/pages/advancedsearchresults.js
@@ -105,7 +105,7 @@ const Home = (props) => {
advancedSearch={true}
/>
-
+
);
diff --git a/pages/auth/error.js b/pages/auth/error.js
index fe998efa..d566df1e 100644
--- a/pages/auth/error.js
+++ b/pages/auth/error.js
@@ -69,7 +69,7 @@ const Error = (props) => {
-
+
);
diff --git a/pages/auth/signin.js b/pages/auth/signin.js
index 9b2cb562..ae5a9ba4 100644
--- a/pages/auth/signin.js
+++ b/pages/auth/signin.js
@@ -87,7 +87,7 @@ const SignIn = (props) => {
-
+
);
diff --git a/pages/auth/verify-request.js b/pages/auth/verify-request.js
index 73f2328f..a896b056 100644
--- a/pages/auth/verify-request.js
+++ b/pages/auth/verify-request.js
@@ -51,7 +51,7 @@ const SignIn = (props) => {
-
+
);
diff --git a/pages/details-about-cookies.js b/pages/details-about-cookies.js
index 25f4ceea..06aabe5c 100644
--- a/pages/details-about-cookies.js
+++ b/pages/details-about-cookies.js
@@ -73,7 +73,7 @@ const CookieDetails = (props) => {
-
+
);
diff --git a/pages/dns-not-found.js b/pages/dns-not-found.js
index b2ed98c3..f1eead2b 100644
--- a/pages/dns-not-found.js
+++ b/pages/dns-not-found.js
@@ -36,7 +36,7 @@ const FourOhFour = (props) => {
-
+
);
diff --git a/pages/dns/[developmentName].js b/pages/dns/[developmentName].js
index b3a46f66..9d356d65 100644
--- a/pages/dns/[developmentName].js
+++ b/pages/dns/[developmentName].js
@@ -79,7 +79,7 @@ const CaseHome = (props) => {
showLoginCheck={props.currentView.showLogin}
/>
-
+
);
@@ -138,6 +138,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
} else {
store.dispatch(
setCurrentReference({
+ "ticketnumber": searchResultsObj.value[0].ticketnumber,
"currentReference": searchResultsObj.value[0].title,
"currentType": "searchResultsObj",
"incidentid": searchResultsObj.value[0].incidentid,
diff --git a/pages/dns/application-process.js b/pages/dns/application-process.js
index 23932970..ed3dd133 100644
--- a/pages/dns/application-process.js
+++ b/pages/dns/application-process.js
@@ -142,7 +142,7 @@ const Home = (props) => {
-
+
);
diff --git a/pages/dns/application-view.js b/pages/dns/application-view.js
index 76b0b4db..0c5685f4 100644
--- a/pages/dns/application-view.js
+++ b/pages/dns/application-view.js
@@ -46,7 +46,7 @@ const ApplicationView = (props) => {
-
+
);
diff --git a/pages/dns/applications.js b/pages/dns/applications.js
index 0bd9b3b6..b4cd8c41 100644
--- a/pages/dns/applications.js
+++ b/pages/dns/applications.js
@@ -43,7 +43,7 @@ const Applications = (props) => {
-
+
);
diff --git a/pages/dns/contact-us.js b/pages/dns/contact-us.js
index 6919ead8..170e15c2 100644
--- a/pages/dns/contact-us.js
+++ b/pages/dns/contact-us.js
@@ -146,7 +146,7 @@ const Home = (props) => {
-
+
);
diff --git a/pages/dns/help.js b/pages/dns/help.js
index 85bd980d..14884b14 100644
--- a/pages/dns/help.js
+++ b/pages/dns/help.js
@@ -52,9 +52,7 @@ const Home = (props) => {
-
- Terms and conditions
-
+ Terms and conditions
@@ -115,7 +113,7 @@ const Home = (props) => {
{" "}
-
+
);
diff --git a/pages/dnsapplications.js b/pages/dnsapplications.js
index f606ad44..4ecefaca 100644
--- a/pages/dnsapplications.js
+++ b/pages/dnsapplications.js
@@ -105,7 +105,7 @@ const Home = (props) => {
searchResultsObj={props.searchResultsObj}
/>
-
+
);
diff --git a/pages/dnsdetails.js b/pages/dnsdetails.js
index 264a4cdb..8c611015 100644
--- a/pages/dnsdetails.js
+++ b/pages/dnsdetails.js
@@ -22,7 +22,7 @@ const Home = (props) => {
{t("case:page-title")}:{" "}
{props.currentView.caseReference.currentReference}{" "}
- {t("common:service-name")}
+ {t("common:service-name")} dd
@@ -66,7 +66,10 @@ const Home = (props) => {
showMap={props.currentView.caseReference.showMap}
/>
-
+
);
diff --git a/pages/error.js b/pages/error.js
index b8ba4de8..f2694f34 100644
--- a/pages/error.js
+++ b/pages/error.js
@@ -66,7 +66,7 @@ function Error({ statusCode }, props) {
-
+
);
diff --git a/pages/help/cookies.js b/pages/help/cookies.js
index ed6a7244..336046f8 100644
--- a/pages/help/cookies.js
+++ b/pages/help/cookies.js
@@ -35,7 +35,7 @@ const CookieManagement = (props) => {
-
+
);
diff --git a/pages/index.js b/pages/index.js
index fc534479..cb0e3cb4 100644
--- a/pages/index.js
+++ b/pages/index.js
@@ -142,7 +142,7 @@ const Home = (props) => {
>
)}
-
+
);
diff --git a/pages/logout.js b/pages/logout.js
index edc2f773..98af9b7b 100644
--- a/pages/logout.js
+++ b/pages/logout.js
@@ -101,7 +101,7 @@ const LogOut = (props) => {
-
+
);
diff --git a/pages/myportal/[appealtypes].js b/pages/myportal/[appealtypes].js
index fb3d63f6..1c93ffaa 100644
--- a/pages/myportal/[appealtypes].js
+++ b/pages/myportal/[appealtypes].js
@@ -203,7 +203,7 @@ let Home = (props) => {
)}
-
+
diff --git a/pages/myportal/advancedsearch.js b/pages/myportal/advancedsearch.js
index c1f2e8f8..d9405d88 100644
--- a/pages/myportal/advancedsearch.js
+++ b/pages/myportal/advancedsearch.js
@@ -62,7 +62,7 @@ const Home = (props) => {
/>
)}
-
+
diff --git a/pages/myportal/advancedsearchresults.js b/pages/myportal/advancedsearchresults.js
index ca9112a0..43344cd1 100644
--- a/pages/myportal/advancedsearchresults.js
+++ b/pages/myportal/advancedsearchresults.js
@@ -65,7 +65,7 @@ const Home = (props) => {
myportal={true}
/>
-
+
diff --git a/pages/myportal/continuesubmission.js b/pages/myportal/continuesubmission.js
index d58a6c34..bdae07bd 100644
--- a/pages/myportal/continuesubmission.js
+++ b/pages/myportal/continuesubmission.js
@@ -107,7 +107,7 @@ const Home = (props) => {
props={props}
/>
-
+
);
diff --git a/pages/myportal/dnsapplications.js b/pages/myportal/dnsapplications.js
index 7c6080d1..a1375271 100644
--- a/pages/myportal/dnsapplications.js
+++ b/pages/myportal/dnsapplications.js
@@ -122,7 +122,7 @@ const Home = (props) => {
watchedCases={watchedCases}
/>
-
+
);
diff --git a/pages/myportal/dnsdetails.js b/pages/myportal/dnsdetails.js
index f7981759..539cbaf2 100644
--- a/pages/myportal/dnsdetails.js
+++ b/pages/myportal/dnsdetails.js
@@ -79,7 +79,7 @@ const Home = (props) => {
showMap={props.currentView.caseReference.showMap}
/>
-
+
);
diff --git a/pages/myportal/error.js b/pages/myportal/error.js
index a257f532..6600c689 100644
--- a/pages/myportal/error.js
+++ b/pages/myportal/error.js
@@ -34,7 +34,7 @@ function Error({ statusCode }, props) {
-
+
);
diff --git a/pages/myportal/index.js b/pages/myportal/index.js
index 1faa6898..1c0e7133 100644
--- a/pages/myportal/index.js
+++ b/pages/myportal/index.js
@@ -154,7 +154,7 @@ const Home = (props) => {
currentView={currentView}
/>
-
+
);
diff --git a/pages/myportal/representation.js b/pages/myportal/representation.js
index f1a7aeb4..db35c30d 100644
--- a/pages/myportal/representation.js
+++ b/pages/myportal/representation.js
@@ -161,7 +161,7 @@ const Home = (props) => {
props={props}
/>
-
+
);
diff --git a/pages/myportal/searchresults.js b/pages/myportal/searchresults.js
index 93859b75..84486a37 100644
--- a/pages/myportal/searchresults.js
+++ b/pages/myportal/searchresults.js
@@ -67,7 +67,7 @@ const Home = (props) => {
watchedCases={watchedCases}
/>
-
+
diff --git a/pages/myportal/viewall.js b/pages/myportal/viewall.js
index b21df2b9..40e9d464 100644
--- a/pages/myportal/viewall.js
+++ b/pages/myportal/viewall.js
@@ -56,7 +56,7 @@ const Home = (props) => {
myportal={true}
/>
-
+
diff --git a/pages/newappeal/[appealtypes].js b/pages/newappeal/[appealtypes].js
index d43ca21d..69144690 100644
--- a/pages/newappeal/[appealtypes].js
+++ b/pages/newappeal/[appealtypes].js
@@ -204,7 +204,7 @@ let Home = (props) => {
-
+
diff --git a/pages/newappeal/aboutyou.js b/pages/newappeal/aboutyou.js
index dbf82807..51eb1943 100644
--- a/pages/newappeal/aboutyou.js
+++ b/pages/newappeal/aboutyou.js
@@ -105,7 +105,7 @@ const AboutYou = (props) => {
-
+
);
diff --git a/pages/newappeal/index.js b/pages/newappeal/index.js
index 32998f76..2c95649f 100644
--- a/pages/newappeal/index.js
+++ b/pages/newappeal/index.js
@@ -125,7 +125,7 @@ const Home = (props) => {
-
+
diff --git a/pages/privacy.js b/pages/privacy.js
index 86ea5b5f..fb2f5f72 100644
--- a/pages/privacy.js
+++ b/pages/privacy.js
@@ -73,7 +73,7 @@ const Privacy = (props) => {
-
+
);
diff --git a/pages/searchresults.js b/pages/searchresults.js
index f1293a89..80ab84f4 100644
--- a/pages/searchresults.js
+++ b/pages/searchresults.js
@@ -110,7 +110,7 @@ const Home = (props) => {
showLoginCheck={showLoginCheck}
/>
-
+
);
diff --git a/pages/terms-and-conditions.js b/pages/terms-and-conditions.js
index 6cb2ce17..8cd38f01 100644
--- a/pages/terms-and-conditions.js
+++ b/pages/terms-and-conditions.js
@@ -73,7 +73,7 @@ const TandC = (props) => {
-
+
);
diff --git a/pages/viewall.js b/pages/viewall.js
index db2bf9cd..16631b25 100644
--- a/pages/viewall.js
+++ b/pages/viewall.js
@@ -99,7 +99,7 @@ const Home = (props) => {
currentView={props.currentView.currentView}
/>
-
+
);
From 2e812b546d4a96f950046822622bc1f2a92d546e Mon Sep 17 00:00:00 2001
From: rdbsolutions
Date: Tue, 9 Apr 2024 15:01:43 +0100
Subject: [PATCH 2/7] added ticketnumber to setcurrentreference call
---
components/myportal/topthree.js | 2 ++
components/myportal/topthree_reps.js | 2 ++
components/myportal/viewall.js | 2 ++
components/nosession.js | 2 +-
components/search/dnssearchresults.js | 2 ++
components/search/searchresults.js | 2 ++
6 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/components/myportal/topthree.js b/components/myportal/topthree.js
index 554bce5a..a1a56247 100644
--- a/components/myportal/topthree.js
+++ b/components/myportal/topthree.js
@@ -189,6 +189,8 @@ const TopThree = (props) => {
data-id={index}
onClick={() => {
setCurrentReference({
+ "ticketnumber":
+ showTopThreeArr[key].ticketnumber,
"currentReference":
topThreeType != "watchedCases"
? topThreeType !=
diff --git a/components/myportal/topthree_reps.js b/components/myportal/topthree_reps.js
index 92fc4ae5..fc86e376 100644
--- a/components/myportal/topthree_reps.js
+++ b/components/myportal/topthree_reps.js
@@ -169,6 +169,8 @@ const TopThree = (props) => {
data-id={index}
onClick={() => {
setCurrentReference({
+ "ticketnumber":
+ showTopThreeArr[key].ticketnumber,
"currentReference":
showTopThreeArr[key].caseRef,
"currentType": topThreeType,
diff --git a/components/myportal/viewall.js b/components/myportal/viewall.js
index d50fbe38..be66c4d9 100644
--- a/components/myportal/viewall.js
+++ b/components/myportal/viewall.js
@@ -119,6 +119,8 @@ const ViewAllResults = (props) => {
}
onClick={() => {
setCurrentReference({
+ "ticketnumber":
+ resultsArr[key].ticketnumber,
"currentReference":
currentView.viewKey != "watchedCases"
? currentView.viewKey ==
diff --git a/components/nosession.js b/components/nosession.js
index 5f717195..241bb2a0 100644
--- a/components/nosession.js
+++ b/components/nosession.js
@@ -46,7 +46,7 @@ const NoSessionWarning = (props) => {
-
+
);
diff --git a/components/search/dnssearchresults.js b/components/search/dnssearchresults.js
index 09d8a7e2..55334a4e 100644
--- a/components/search/dnssearchresults.js
+++ b/components/search/dnssearchresults.js
@@ -358,6 +358,8 @@ const DNSSearchResults = (props) => {
className="govuk-link--no-underline"
onClick={() => {
setCurrentReference({
+ "ticketnumber":
+ item.ticketnumber,
"currentReference":
item.title,
"currentType":
diff --git a/components/search/searchresults.js b/components/search/searchresults.js
index 81b5fe45..6365543c 100644
--- a/components/search/searchresults.js
+++ b/components/search/searchresults.js
@@ -300,6 +300,8 @@ const SearchResults = (props) => {
className="govuk-link--no-underline"
onClick={() => {
setCurrentReference({
+ "ticketnumber":
+ item.ticketnumber,
"currentReference":
item.title,
"currentType":
From f2e143ab1f82d7f6d209f1c3f289b926e2a4e7fb Mon Sep 17 00:00:00 2001
From: rdbsolutions
Date: Tue, 9 Apr 2024 15:02:47 +0100
Subject: [PATCH 3/7] added copy link and updated styling
---
components/footer.js | 51 ++++++++++++++++----------
styles/sass/welshgov/_application.scss | 25 +++++++++++++
2 files changed, 57 insertions(+), 19 deletions(-)
diff --git a/components/footer.js b/components/footer.js
index df8f2e88..7bd9a340 100644
--- a/components/footer.js
+++ b/components/footer.js
@@ -23,15 +23,30 @@ export default function Footer(props) {
));
const [showShareState, setShowShareState] = useState(false);
+ const [copySuccess, setCopySuccess] = useState("");
let shareState = () => {
showShareState == true
- ? setShowShareState(false)
+ ? (setShowShareState(false), setCopySuccess(""))
: setShowShareState(true);
};
- //console.log(router.asPath);
- const shareBodyStr = t("common:service-home-url") + router.asPath;
+ const copyToClipBoard = async (copyMe) => {
+ try {
+ await navigator.clipboard.writeText(copyMe);
+ setCopySuccess(" - done!");
+ } catch (err) {
+ setCopySuccess("Failed to copy!");
+ }
+ };
+
+ const shareBodyStr =
+ t("common:service-home-url") +
+ (router.route == "/case" ||
+ router.route == "/dnsdetails" ||
+ router.route == "/myportal/case"
+ ? "/case/" + encodeURIComponent(props.ticketnumber)
+ : router.asPath);
const shareSubjectStr =
t("common:social-shared-from") +
" " +
@@ -110,7 +125,7 @@ export default function Footer(props) {
shareBodyStr +
"&subject=" +
shareSubjectStr
- } //https%3A//gov.wales/&subject=Shared%20from%20gov.wales"
+ }
className="email"
>
@@ -119,6 +134,19 @@ export default function Footer(props) {
Email
+
+ {
+ copyToClipBoard(shareBodyStr);
+ }}
+ className="link"
+ >
+
+ Share this page via{" "}
+
+ Copy Link {copySuccess}
+
+
- {/*
-
- {t(
- "common:footer-alternative-languages-link-label"
- )}
-
- */}
Date: Tue, 9 Apr 2024 15:03:33 +0100
Subject: [PATCH 4/7] update footer props with ticketnumber
---
pages/case/index.js | 5 ++++-
pages/dns/index.js | 2 +-
pages/myportal/case.js | 5 ++++-
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/pages/case/index.js b/pages/case/index.js
index 11459ae1..6b4dcf84 100644
--- a/pages/case/index.js
+++ b/pages/case/index.js
@@ -69,7 +69,10 @@ const CaseHome = (props) => {
showLoginCheck={props.currentView.showLogin}
/>
-
+
);
diff --git a/pages/dns/index.js b/pages/dns/index.js
index 01b18e6c..7ea1b189 100644
--- a/pages/dns/index.js
+++ b/pages/dns/index.js
@@ -37,7 +37,7 @@ const Home = (props) => {
-
+
);
diff --git a/pages/myportal/case.js b/pages/myportal/case.js
index c6bf2bb4..1357e395 100644
--- a/pages/myportal/case.js
+++ b/pages/myportal/case.js
@@ -84,7 +84,10 @@ const Home = (props) => {
currentView={props.currentView}
/>
-
+
From c8aa3db174f0f07a4595c8f5dbdc11ae10e3c8d8 Mon Sep 17 00:00:00 2001
From: rdbsolutions
Date: Tue, 9 Apr 2024 15:04:14 +0100
Subject: [PATCH 5/7] passed modified on date for watched cases
---
pages/api/endpoint/getwatchedcases_api.js | 3 ++-
pages/api/endpoint/getwatchedcasesproxy_api.js | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/pages/api/endpoint/getwatchedcases_api.js b/pages/api/endpoint/getwatchedcases_api.js
index fa4363f7..39d0c3fc 100644
--- a/pages/api/endpoint/getwatchedcases_api.js
+++ b/pages/api/endpoint/getwatchedcases_api.js
@@ -48,7 +48,7 @@ export default async function ApiProxy(req, res) {
var queryUrl =
"pinswg_watchlists?$filter= _pinswg_contact_value eq " +
loggedInUserId +
- "&$select=pinswg_appealcasetype,pinswg_watchlistid,_pinswg_watchedcase_value,statuscode&$count=true&$orderby=createdon desc&$expand=pinswg_WatchedCase($select=pinswg_AssociatedLPA)";
+ "&$select=modifiedon,pinswg_appealcasetype,pinswg_watchlistid,_pinswg_watchedcase_value,statuscode&$count=true&$orderby=createdon desc&$expand=pinswg_WatchedCase($select=pinswg_AssociatedLPA)";
return axios
.get(
@@ -57,6 +57,7 @@ export default async function ApiProxy(req, res) {
)
.then(({ data }) => {
data.value.forEach(function (element) {
+ element.ticketnumber = element.pinswg_WatchedCase.ticketnumber;
element.pinswg_title =
element[
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
diff --git a/pages/api/endpoint/getwatchedcasesproxy_api.js b/pages/api/endpoint/getwatchedcasesproxy_api.js
index 1309a7de..8c4f6167 100644
--- a/pages/api/endpoint/getwatchedcasesproxy_api.js
+++ b/pages/api/endpoint/getwatchedcasesproxy_api.js
@@ -43,7 +43,7 @@ export default async function ApiProxy(req, res) {
var queryUrl =
"pinswg_watchlists?$filter= _pinswg_contact_value eq " +
loggedInUserId +
- "&$select=pinswg_appealcasetype,pinswg_watchlistid,_pinswg_watchedcase_value,statuscode&$count=true&$orderby=createdon desc&$expand=pinswg_WatchedCase($select=pinswg_AssociatedLPA)";
+ "&$select=modifiedon,pinswg_appealcasetype,pinswg_watchlistid,_pinswg_watchedcase_value,statuscode&$count=true&$orderby=createdon desc&$expand=pinswg_WatchedCase($select=pinswg_AssociatedLPA)";
return axios
.get(
From 7014323161b83a987790907b420526901a4750d8 Mon Sep 17 00:00:00 2001
From: rdbsolutions
Date: Tue, 9 Apr 2024 15:04:48 +0100
Subject: [PATCH 6/7] direct link to case page by ticketnumber
---
components/breadcrumbs.js | 13 ++
components/case.js | 1 +
components/case/summary.js | 69 ++++++++---
pages/case/[ticketnumber].js | 225 +++++++++++++++++++++++++++++++++++
4 files changed, 290 insertions(+), 18 deletions(-)
create mode 100644 pages/case/[ticketnumber].js
diff --git a/components/breadcrumbs.js b/components/breadcrumbs.js
index 3c9d11b6..4dca5cf2 100644
--- a/components/breadcrumbs.js
+++ b/components/breadcrumbs.js
@@ -420,6 +420,19 @@ const Breadcrumbs = (props) => {
""
)}
+ {router.pathname == "/case/[ticketnumber]" ? (
+ <>
+
+ {t("common:breadcrumb-case-reference")}:{" "}
+ {
+ props.props.searchResultsObj
+ .searchResultsObj.value[0].title
+ }
+
+ >
+ ) : (
+ ""
+ )}
{router.pathname == "/myportal/dnsapplications" ? (
<>
{" "}
diff --git a/components/case.js b/components/case.js
index 9a0d97b3..8bfd8f04 100644
--- a/components/case.js
+++ b/components/case.js
@@ -32,6 +32,7 @@ const Case = (props) => {
currentType={props.currentType}
appealTypeID={props.appealTypeID}
searchResultsObj={props.searchResultsObj}
+ directSearchResultsObj={props.directSearchResultsObj}
searchDetailsObj={props.searchDetailsObj}
searchString={props.searchString}
incidentid={props.incidentid}
diff --git a/components/case/summary.js b/components/case/summary.js
index ff8a9d0f..17f4e73c 100644
--- a/components/case/summary.js
+++ b/components/case/summary.js
@@ -69,6 +69,7 @@ const CaseSummary = (props) => {
awaitingSubmission,
searchResultsObj,
searchDetailsObj,
+ directSearchResultsObj,
currentType,
setCurrentLinkedCases,
linkedCasesReference,
@@ -79,9 +80,9 @@ const CaseSummary = (props) => {
currentView,
} = props;
- const showLoginCheck = currentView.showLogin;
+ const showLoginCheck =
+ currentType == "directResultsObj" ? "true" : currentView.showLogin;
const { data: session, status } = useSession();
- //console.log("session status:", status, session);
const cookies = parseCookies();
@@ -182,6 +183,8 @@ const CaseSummary = (props) => {
'$..[?(@.pinswg_title=="' + caseReference + '")]',
setCaseQueryObj
))
+ : currentType == "directResultsObj"
+ ? (casesObj = directSearchResultsObj.value)
: (casesObj = jsonpath(
'$..[?(@.reference=="' + caseReference + '")]',
setCaseQueryObj
@@ -196,6 +199,8 @@ const CaseSummary = (props) => {
'$..[?(@.pinswg_name=="' + caseReference + '")]',
searchDetailsObj
))
+ : currentType == "directResultsObj"
+ ? (detailsObj = searchDetailsObj[0].value)
: (detailsObj = jsonpath(
'$..[?(@.pinswg_name=="' + caseReference + '")]',
setCaseDetailsObj
@@ -226,6 +231,10 @@ const CaseSummary = (props) => {
{t("case:summary-reference-label")}:{" "}
{currentType == "searchResultsObj"
? detailsObj.pinswg_name
+ : currentType == "directResultsObj"
+ ? casesObj.title
+ : currentType == "watchedCases"
+ ? casesObj.pinswg_title
: casesObj.reference}
@@ -367,12 +376,12 @@ const CaseSummary = (props) => {
{router.locale == "cy"
? jsonpath(
- transLookup,
'$..[?(@.value=="' +
detailsObj[
"pinswg_casestage@OData.Community.Display.V1.FormattedValue"
] +
- '")].value_cy'
+ '")].value_cy',
+ transLookup
)
: detailsObj[
"pinswg_casestage@OData.Community.Display.V1.FormattedValue"
@@ -531,14 +540,32 @@ const CaseSummary = (props) => {
.currentReference +
"\n\nYou will now be prompted to sign in"
) &&
- signIn("email", {
- callbackUrl:
- "/myportal/searchresults?q=" +
- props
- .currentView
- .caseReference
- .currentReference,
- });
+ // signIn("email", {
+ // callbackUrl:
+ // "/myportal/case/" +
+ // props
+ // .currentView
+ // .caseReference
+ // .ticketnumber,
+ // });
+
+ setCookie(
+ null,
+ "pedwWatchCase",
+ currentType ==
+ "searchResultsObj"
+ ? detailsObj.pinswg_name
+ : currentType ==
+ "directResultsObj"
+ ? casesObj.title
+ : casesObj.reference,
+ {
+ path: "/",
+ expires:
+ expDate,
+ }
+ ),
+ signIn();
}}
title={t(
"case:watch-this-case-link"
@@ -921,13 +948,10 @@ const CaseSummary = (props) => {
const linkedCases = linkCaseObj();
}, [incidentid, setCurrentLinkedCases]);
- // const [showSpinnerState, setShowSpinnerState] = useState(false);
+ let now = new Date();
+ let expDate = new Date(now);
- // let spinnerState = () => {
- // showSpinnerState == true
- // ? setShowSpinnerState(false)
- // : setShowSpinnerState(true);
- // };
+ expDate.setDate(now.getDate() + 365);
function formatDates(dateObj, showTime) {
var dateObj = new Date(dateObj);
@@ -998,6 +1022,15 @@ const CaseSummary = (props) => {
return date > start && date > end ? true : false;
}
+ if (status == "authenticated" && cookies.pedwWatchCase != null) {
+ selectWatchedCase(
+ props.accountDetails.accountDetails.contactid,
+ incidentid,
+ appealTypeID
+ );
+ destroyCookie({}, "pedwWatchCase", { path: "/" });
+ }
+
return <>{showDetailsBlock}>;
};
diff --git a/pages/case/[ticketnumber].js b/pages/case/[ticketnumber].js
new file mode 100644
index 00000000..f3a3b1a5
--- /dev/null
+++ b/pages/case/[ticketnumber].js
@@ -0,0 +1,225 @@
+import useTranslation from "next-translate/useTranslation";
+import Head from "next/head";
+import { useRouter } from "next/router";
+import { connect } from "react-redux";
+import {
+ getBasicSearch,
+ getIP,
+ getPortalLogin,
+ getPersonalAccount,
+} from "../../actions";
+import CookieBanner from "../../components/cookieBanner";
+import Footer from "../../components/footer";
+import Header from "../../components/header";
+import { getSearchDetails } from "../../components/utils";
+import { setCurrentReference } from "../../store/currentView/action";
+import { setSearch } from "../../store/search/action";
+import {
+ setSearchDetails,
+ setSearchResults,
+} from "../../store/searchOutput/action";
+import { wrapper } from "../../store/store";
+import Case from "../../components/case";
+import Breadcrumbs from "../../components/breadcrumbs";
+import { getSession, useSession } from "next-auth/react";
+import {
+ setAccountDetails,
+ setContainerID,
+ setLoggedInUserId,
+} from "../../store/accountDetails/action";
+
+const CaseHome = (props) => {
+ const { footerLinks, pages } = props;
+ let { t, lang } = useTranslation();
+
+ const router = useRouter();
+ const { locale } = router;
+ const { ticketnumber } = router.query;
+
+ return (
+
+
+
+ Reference:{" "}
+ {props.currentView.caseReference.currentReference}{" "}
+
+
+
+
+ );
+};
+
+export const getServerSideProps = wrapper.getServerSideProps(
+ (store) => async (ctx) => {
+ const { query, req, res } = ctx;
+ getIP(req);
+ const { cookies } = req;
+
+ console.log(cookies);
+ console.log("the query :", query.ticketnumber);
+
+ let thisSession = await getSession(ctx);
+ let loggedInUser = {};
+
+ if (thisSession) {
+ console.log(" has sesssion.......");
+ [loggedInUser] = await Promise.all([
+ await getPortalLogin(thisSession.user.email),
+ ]);
+
+ loggedInUser = loggedInUser.value[0].contactid;
+
+ const accountDetails = await getPersonalAccount(loggedInUser);
+ store.dispatch(setAccountDetails(accountDetails));
+ } else {
+ console.log("not has sesssion.......");
+ }
+
+ let developmentQuery =
+ query.ticketnumber.indexOf("CAS-") == 0
+ ? query.ticketnumber
+ : query.ticketnumber.split("-").join(" ");
+
+ const searchResultsObj = await getBasicSearch(developmentQuery);
+ const searchDetailsObj = await getSearchDetails(searchResultsObj);
+
+ console.log(
+ "\n======================================\n",
+ searchResultsObj,
+ "\n======================================\n"
+ );
+ console.log(
+ "\n======================================\n",
+ searchDetailsObj[0],
+ "\n======================================\n"
+ );
+
+ store.dispatch(setSearch(developmentQuery));
+
+ console.log(
+ searchResultsObj["@odata.count"] > 1 ||
+ searchResultsObj["@odata.count"] < 1
+ );
+
+ if (searchResultsObj["@odata.count"] < 1) {
+ return {
+ redirect: {
+ destination: "/404",
+ permanent: false,
+ },
+ };
+ } else {
+ if (searchResultsObj["@odata.count"] > 1) {
+ return {
+ redirect: {
+ //destination: "/dns-not-found",
+ destination: "/404",
+ permanent: false,
+ },
+ };
+ } else {
+ store.dispatch(
+ setCurrentReference({
+ "ticketnumber": searchResultsObj.value[0].ticketnumber,
+ "currentReference": searchResultsObj.value[0].title,
+ "currentType": "searchResultsObj",
+ "incidentid": searchResultsObj.value[0].incidentid,
+ "appealType":
+ searchResultsObj.value[0].pinswg_appealcasetype,
+ })
+ );
+ }
+ }
+ // console.log(searchResultsObj);
+ return {
+ props: {
+ searchResultsObj: {
+ searchResultsObj: searchResultsObj,
+ searchDetailsObj: searchDetailsObj,
+ },
+ currentType: "directResultsObj",
+ },
+ };
+ }
+);
+
+const mapStateToProps = (state) => {
+ return {
+ accountDetails: state.accountDetails,
+ currentView: state.currentView,
+ search: state.search,
+ //searchResultsObj: state.searchResultsObj,
+ documentDetailsObj: state.searchResultsObj.documentDetailsObj,
+ formData: state.formData,
+ appealType: state.appealType,
+ form: state.form,
+ myCases: state.myCases,
+ watchedCases: state.watchedCases,
+ myRepresentations: state.myRepresentations,
+ awaitingSubmission: state.awaitingSubmission,
+ };
+};
+
+const mapDispatchToProps = (dispatch) => {
+ return {
+ setCurrentReference: (currentReference) => {
+ dispatch(setCurrentReference(refno));
+ },
+ };
+};
+
+export default connect(mapStateToProps, mapDispatchToProps)(CaseHome);
From 44f067d2aa44b356ea74336c8515ecc58ca2efaf Mon Sep 17 00:00:00 2001
From: rdbsolutions
Date: Wed, 10 Apr 2024 08:06:21 +0100
Subject: [PATCH 7/7] share link for DNS
---
components/footer.js | 3 +-
pages/dns/[developmentName].js | 82 +++++++++++++++++++++++++++-------
2 files changed, 68 insertions(+), 17 deletions(-)
diff --git a/components/footer.js b/components/footer.js
index 7bd9a340..b5627591 100644
--- a/components/footer.js
+++ b/components/footer.js
@@ -45,7 +45,8 @@ export default function Footer(props) {
(router.route == "/case" ||
router.route == "/dnsdetails" ||
router.route == "/myportal/case"
- ? "/case/" + encodeURIComponent(props.ticketnumber)
+ ? (router.route == "/dnsdetails" ? "/dns/" : "/case/") +
+ encodeURIComponent(props.ticketnumber)
: router.asPath);
const shareSubjectStr =
t("common:social-shared-from") +
diff --git a/pages/dns/[developmentName].js b/pages/dns/[developmentName].js
index 9d356d65..93419f2b 100644
--- a/pages/dns/[developmentName].js
+++ b/pages/dns/[developmentName].js
@@ -16,6 +16,12 @@ import {
import { wrapper } from "../../store/store";
import Case from "../../components/case";
import Breadcrumbs from "../../components/breadcrumbs";
+import { getSession, useSession } from "next-auth/react";
+import {
+ setAccountDetails,
+ setContainerID,
+ setLoggedInUserId,
+} from "../../store/accountDetails/action";
const CaseHome = (props) => {
const { footerLinks, pages } = props;
@@ -44,15 +50,13 @@ const CaseHome = (props) => {
props={props}
myCases={props.myCases.myCases}
myCasesDetails={props.myCases.myCasesDetails}
- searchResultsObj={
+ directSearchResultsObj={
props.searchResultsObj.searchResultsObj
}
searchDetailsObj={
props.searchResultsObj.searchDetailsObj
}
- documentDetailsObj={
- props.searchResultsObj.documentDetailsObj
- }
+ documentDetailsObj={props.documentDetailsObj}
myRepresentations={
props.myRepresentations.myRepresentations
}
@@ -64,22 +68,32 @@ const CaseHome = (props) => {
props.awaitingSubmission.awaitingSubmission
}
caseReference={
- props.currentView.caseReference.currentReference
- }
- currentType={
- props.currentView.caseReference.currentType
+ props.searchResultsObj.searchResultsObj.value[0]
+ .ticketnumber
}
+ currentType={props.currentType}
appealTypeID={
- props.currentView.caseReference.appealType
+ props.searchResultsObj.searchResultsObj.value[0]
+ .pinswg_appealcasetype
+ }
+ incidentid={
+ props.searchResultsObj.searchResultsObj.value[0]
+ .incidentid
}
- incidentid={props.currentView.caseReference.incidentid}
representationsObj={
props.searchResultsObj.representationsObj
}
- showLoginCheck={props.currentView.showLogin}
+ showLoginCheck={true}
/>
-
+
);
@@ -93,7 +107,23 @@ export const getServerSideProps = wrapper.getServerSideProps(
console.log(cookies);
console.log("the query", query.developmentName);
- let loggedInUser = cookies.pinsUser;
+
+ let thisSession = await getSession(ctx);
+ let loggedInUser = {};
+
+ if (thisSession) {
+ console.log(" has sesssion.......");
+ [loggedInUser] = await Promise.all([
+ await getPortalLogin(thisSession.user.email),
+ ]);
+
+ loggedInUser = loggedInUser.value[0].contactid;
+
+ const accountDetails = await getPersonalAccount(loggedInUser);
+ store.dispatch(setAccountDetails(accountDetails));
+ } else {
+ console.log("not has sesssion.......");
+ }
let developmentQuery =
query.developmentName.indexOf("CAS-") == 0
@@ -104,8 +134,17 @@ export const getServerSideProps = wrapper.getServerSideProps(
const searchResultsObj = await getBasicDNSURLSearch(developmentQuery);
const searchDetailsObj = await getSearchDetails(searchResultsObj);
- store.dispatch(setSearchResults(searchResultsObj));
- store.dispatch(setSearchDetails(searchDetailsObj));
+ console.log(
+ "\n======================================\n",
+ searchResultsObj,
+ "\n======================================\n"
+ );
+ console.log(
+ "\n======================================\n",
+ searchDetailsObj[0],
+ "\n======================================\n"
+ );
+
store.dispatch(setSearch(developmentQuery));
// console.log({
@@ -149,14 +188,25 @@ export const getServerSideProps = wrapper.getServerSideProps(
}
}
// console.log(searchResultsObj);
+ return {
+ props: {
+ searchResultsObj: {
+ searchResultsObj: searchResultsObj,
+ searchDetailsObj: searchDetailsObj,
+ },
+ currentType: "directResultsObj",
+ },
+ };
}
);
const mapStateToProps = (state) => {
return {
+ accountDetails: state.accountDetails,
currentView: state.currentView,
search: state.search,
- searchResultsObj: state.searchResultsObj,
+ //searchResultsObj: state.searchResultsObj,
+ documentDetailsObj: state.searchResultsObj.documentDetailsObj,
formData: state.formData,
appealType: state.appealType,
form: state.form,