Merged PR 1187: duplicate contacts catch and handle and welsh

duplicate contacts catch and handle and welsh

Related work items: #11422
This commit is contained in:
Robert Bond
2024-06-11 15:46:09 +00:00
13 changed files with 153 additions and 28 deletions
+19 -4
View File
@@ -982,9 +982,22 @@ let MakeRepresentation = (props) => {
<> <>
<div> <div>
<p className="govuk-body"> <p className="govuk-body">
Some text in here to explain about {t(
raising a representation and why logging "myrepresentations:sign-in-to-raise-rep-label"
in )}{" "}
<a
href={
"mailto:" +
t(
"myrepresentations:login-contact-email"
)
}
className="govuk-link--no-underline"
>
{t(
"myrepresentations:login-contact-email"
)}
</a>
</p> </p>
</div> </div>
<button <button
@@ -992,7 +1005,9 @@ let MakeRepresentation = (props) => {
type="button" type="button"
onClick={() => signIn()} onClick={() => signIn()}
> >
Sign in to raise representation {t(
"myrepresentations:sign-in-to-raise-rep-button"
)}
</button> </button>
</> </>
) : ( ) : (
+11 -2
View File
@@ -537,8 +537,17 @@ const CaseSummary = (props) => {
{t( {t(
"case:representation-date-passed-additional-label" "case:representation-date-passed-additional-label"
)}{" "} )}{" "}
<Link href="mailto:pedw.casework@gov.wales"> <Link
pedw.casework@gov.wales href={
"mailto:" +
t(
"home:login-contact-email"
)
}
>
{t(
"home:login-contact-email"
)}
</Link> </Link>
</p> </p>
</div> </div>
+3 -9
View File
@@ -129,15 +129,9 @@ let CompleteAppeal = (props) => {
</p> </p>
<p className="govuk-body"> <p className="govuk-body">
{t("newappeal:new-appeal-complete-paragraph-3")}:: {t("newappeal:new-appeal-complete-paragraph-3")}::
{router.locale == "cy" ? ( <Link href={"mailto:" + t("home:login-contact-email")}>
<Link href="mailto:PEDW.GwaithAchos@llyw.cymru"> {t("home:login-contact-email")}
PEDW.GwaithAchos@llyw.cymru </Link>
</Link>
) : (
<Link href="mailto:PEDW.Casework@gov.wales">
PEDW.Casework@gov.wales
</Link>
)}
</p> </p>
<p className="govuk-body"> <p className="govuk-body">
{t("newappeal:new-appeal-complete-paragraph-4")}: {t("newappeal:new-appeal-complete-paragraph-4")}:
+9 -8
View File
@@ -12,6 +12,7 @@ module.exports = {
"*": ["common", "newappeal", "search"], "*": ["common", "newappeal", "search"],
"/": ["common", "home", "case"], "/": ["common", "home", "case"],
"/error": ["common", "home", "myportal"], "/error": ["common", "home", "myportal"],
"/furtherdetails": ["common", "home", "myportal"],
"/myportal": ["myportal", "common", "home", "case"], "/myportal": ["myportal", "common", "home", "case"],
"/myportal/viewall": ["search", "myportal", "case"], "/myportal/viewall": ["search", "myportal", "case"],
"/myportal/advancedsearch": ["search", "myportal"], "/myportal/advancedsearch": ["search", "myportal"],
@@ -32,18 +33,18 @@ module.exports = {
"/addresssearch": ["search", "case", "myportal"], "/addresssearch": ["search", "case", "myportal"],
"/addresssearchresults": ["search", "case", "myportal"], "/addresssearchresults": ["search", "case", "myportal"],
"/viewall": ["search"], "/viewall": ["search"],
"/case": ["case"], "/case": ["case", "home"],
"/case/*": ["case"], "/case/*": ["case", "home"],
"/case/[ticketnumber]": ["case"], "/case/[ticketnumber]": ["case", "home"],
"/case/id/[incident]": ["case"], "/case/id/[incident]": ["case", "home"],
"/myportal/representation": ["case", "myrepresentations", "common"], "/myportal/representation": ["case", "myrepresentations", "common"],
"/myportal/error": ["myportal", "common"], "/myportal/error": ["myportal", "common"],
"/myportal/case/id/[incident]": ["case"], "/myportal/case/id/[incident]": ["case","home"],
"/myportal/addresssearch": ["search", "case", "myportal"], "/myportal/addresssearch": ["search", "case", "myportal"],
"/myportal/addresssearchresults": ["search", "case", "myportal"], "/myportal/addresssearchresults": ["search", "case", "myportal"],
"/newappeal": ["newappeal"], "/newappeal": ["newappeal", "home"],
"/newappeal/*": ["newappeal"], "/newappeal/*": ["newappeal", "home"],
"/newappeal/selectappeal": ["newappeal"], "/newappeal/selectappeal": ["newappeal", "home"],
"/dns/*": ["dnsCommon", "case", "common"], "/dns/*": ["dnsCommon", "case", "common"],
"/dns/[developmentName]": ["dnsCommon", "case", "common"], "/dns/[developmentName]": ["dnsCommon", "case", "common"],
"/dns": ["dnsCommon", "dnsHome"], "/dns": ["dnsCommon", "dnsHome"],
+5 -1
View File
@@ -77,5 +77,9 @@
"of-label": "o", "of-label": "o",
"change-link-label": "Newid", "change-link-label": "Newid",
"hide-banner-label": "Cuddio", "hide-banner-label": "Cuddio",
"error-instruction-label": "Os nad ydych yn gallu gweld eich gweithgarwch diweddar, pwyswch Ctrl, Shift ac R i adnewyddu eich porwr (neu Cmd ac R os ydych yn defnyddio Mac)." "error-instruction-label": "Os nad ydych yn gallu gweld eich gweithgarwch diweddar, pwyswch Ctrl, Shift ac R i adnewyddu eich porwr (neu Cmd ac R os ydych yn defnyddio Mac).",
"further-details-title": "Mae angen rhagor o fanylion",
"further-details-header": "Ni allwch fewngofnodi ar hyn o bryd",
"further-details-para-one": "Mae angen i PEDW gadarnhau ychydig mwy o wybodaeth amdanoch cyn y gallwch barhau.",
"further-details-para-two": "Ffoniwch 01234 567890 neu cysylltwch â ni ar "
} }
+1 -1
View File
@@ -33,7 +33,7 @@
"casesearch-search-validation-required": "Angenrheidiol", "casesearch-search-validation-required": "Angenrheidiol",
"casesearch-search-validation-minlength": "Rhaid bod yn 4 nod neu fwy", "casesearch-search-validation-minlength": "Rhaid bod yn 4 nod neu fwy",
"casescomment-card-title": "Rhowch sylwadau ar apêl", "casescomment-card-title": "Rhowch sylwadau ar apêl",
"casescomment-card-paragraph-one": "Rhowch sylwadau ar apêl (gan eithrio deiliad tai a masnachol) drwy ebostio", "casescomment-card-paragraph-one": "Rhowch sylwadau ar apêl (gan eithrio deiliad tai a masnachol) drwy ebostio ",
"casescomment-card-paragraph-two": "Ar gyfer apeliadau deiliaid tai a masnachol, ni all partïon â buddiant wneud sylwadau yn ystod y cam apelio. Bydd unrhyw sylwadau a wneir yn ystod y cam ymgeisio yn cael eu darparu gan yr awdurdod cynllunio lleol a'u hystyried gan yr arolygydd.", "casescomment-card-paragraph-two": "Ar gyfer apeliadau deiliaid tai a masnachol, ni all partïon â buddiant wneud sylwadau yn ystod y cam apelio. Bydd unrhyw sylwadau a wneir yn ystod y cam ymgeisio yn cael eu darparu gan yr awdurdod cynllunio lleol a'u hystyried gan yr arolygydd.",
"inspectorate-card-visit-label": "Ymweld Yr Arolygiaeth Gynllunio", "inspectorate-card-visit-label": "Ymweld Yr Arolygiaeth Gynllunio",
"inspectorate-card-visit-link": "Hafan", "inspectorate-card-visit-link": "Hafan",
+3
View File
@@ -1,4 +1,7 @@
{ {
"login-contact-email": "pedw.gwaithachos@llyw.cymru",
"sign-in-to-raise-rep-label": "I godi cynrychiolaeth ar gyfer yr apêl hon bydd angen i chi fewngofnodi gyda'ch cyfeiriad e-bost. Os nad ydych am fewngofnodi i godi sylw cysylltwch",
"sign-in-to-raise-rep-button": "Mewngofnodwch i godi cynrychiolaeth",
"make-a-representation-on-label": "Gwnewch gynrychioliad ar", "make-a-representation-on-label": "Gwnewch gynrychioliad ar",
"make-a-representation-for-label": "Gwnewch gynrychiolaeth ar gyfer", "make-a-representation-for-label": "Gwnewch gynrychiolaeth ar gyfer",
"timetable-title": "Amserlen", "timetable-title": "Amserlen",
+5 -1
View File
@@ -77,5 +77,9 @@
"of-label": "of", "of-label": "of",
"change-link-label": "Change", "change-link-label": "Change",
"hide-banner-label": "Hide", "hide-banner-label": "Hide",
"error-instruction-label": "If you are unable to view your recent activity, press Ctrl, Shift and R to refresh your browser (or Cmd and R if you are using a Mac)." "error-instruction-label": "If you are unable to view your recent activity, press Ctrl, Shift and R to refresh your browser (or Cmd and R if you are using a Mac).",
"further-details-title": "Further details required",
"further-details-header": "You can not be logged in at this time",
"further-details-para-one": "PEDW needs to confirm a bit more informtion about you before you can continue.",
"further-details-para-two": "Please call 01234 567890 or contact us on "
} }
+3
View File
@@ -1,4 +1,7 @@
{ {
"login-contact-email": "pedw.casework@gov.wales",
"sign-in-to-raise-rep-label": "To raise a representation for this appeal you will need to login with your email address. If you do not wish to login to raise a representation contact",
"sign-in-to-raise-rep-button": "Sign in to raise representation",
"make-a-representation-on-label": "Make a representation on", "make-a-representation-on-label": "Make a representation on",
"make-a-representation-for-label": "Make a representation for", "make-a-representation-for-label": "Make a representation for",
"timetable-title": "Timetable", "timetable-title": "Timetable",
+4
View File
@@ -167,6 +167,10 @@ module.exports = {
source: "/fymhorth/cynrychiolaeth", source: "/fymhorth/cynrychiolaeth",
destination: "/myportal/representation", destination: "/myportal/representation",
}, },
{
source: "/manylionpellach",
destination: "/furtherdetails",
},
{ {
source: "/allgofnodi", source: "/allgofnodi",
destination: "/logout", destination: "/logout",
+2 -2
View File
@@ -43,9 +43,9 @@ export default async function ApiProxy(req, res) {
var queryUrl = var queryUrl =
"contacts?$filter=emailaddress1 eq '" + "contacts?$filter=emailaddress1 eq '" +
emailAddress + emailAddress +
"'&$count=true&$select=emailaddress1,contactid,yomifullname,firstname,lastname"; "' and statuscode eq 1&$count=true&$select=emailaddress1,contactid,yomifullname,firstname,lastname";
//console.log(req.query); console.log(req.query, queryUrl);
var apiResponse = _.isEmpty(req.query) var apiResponse = _.isEmpty(req.query)
? res.status(400).json() ? res.status(400).json()
+69
View File
@@ -0,0 +1,69 @@
// 404.js
import useTranslation from "next-translate/useTranslation";
import Head from "next/head";
import Link from "next/link";
import CookieBanner from "../components/cookieBanner";
import Footer from "../components/footer";
import Header from "../components/header";
import { parseCookies, setCookie, destroyCookie } from "nookies";
import { useSession, signIn, signOut } from "next-auth/react";
const FourOhFour = (props) => {
let { t, lang } = useTranslation();
const { footerLinks, pages } = props;
const handleLogout = () => {
console.info("////////////\n" + "logout" + "\n////////////");
window.localStorage.clear(),
destroyCookie(null, "next-auth.csrf-token"),
destroyCookie(null, "next-auth.callback-url"),
destroyCookie(null, "pedw_locale"),
destroyCookie(null, "pinsUser"),
signOut({ callbackUrl: "/" });
};
return (
<div>
<Head>
<title>
{t("common:further-details-title")} -{" "}
{t("common:service-name")}
</title>
</Head>
<div id="page_wrapper">
<CookieBanner />
<Header courseName={t("common:service-name")} />
<div className="govuk-width-container govuk-!-padding-bottom-9">
<main className="govuk-main-wrapper govuk-!-padding-top-9 govuk-!-padding-bottom-9">
<div className="govuk-grid-row">
<div className="govuk-grid-column-full ">
<h1>{t("common:further-details-header")}</h1>
<p className="govuk-body">
{t("common:further-details-para-one")}
</p>
<p className="govuk-body">
{t("common:further-details-para-two")}{" "}
<Link
href={
"mailto:" +
t("home:login-contact-email")
}
>
{t("home:login-contact-email")}
</Link>{" "}
</p>
<Link href="/" onClick={handleLogout}>
{t("common:404-not-found-link")}
</Link>
</div>
</div>
</main>
</div>
<Footer footerLinks={footerLinks} ticketnumber={props} />
</div>
</div>
);
};
export default FourOhFour;
+19
View File
@@ -191,6 +191,25 @@ export const getServerSideProps = wrapper.getServerSideProps(
await getPortalLogin(thisSession.user.email), await getPortalLogin(thisSession.user.email),
]); ]);
//grabs first contact on this list
//jump out page for duplicates....
console.log(
"Number of contacts with this email:",
loggedInUser.value.length
);
if (loggedInUser.value.length > 1) {
return {
redirect: {
destination:
ctx.locale == "cy"
? "/cy/manylionpellach"
: "/furtherdetails",
permanent: false,
},
};
}
loggedInUser = loggedInUser.value[0].contactid; loggedInUser = loggedInUser.value[0].contactid;
//console.log("nextAuth Session:", thisSession); //console.log("nextAuth Session:", thisSession);
} }