updated welsh translations
This commit is contained in:
+2
-2
@@ -39,11 +39,11 @@ RELAYPATH = "dev-pedw-hc"
|
||||
|
||||
GOOGLE_TAG_MANAGER = GTM-T78CBC3
|
||||
SHOWLOGIN = true
|
||||
//SHOWREPRESENTATIONS = true
|
||||
SHOWREPRESENTATIONS = true
|
||||
SHOWFILEUPLOAD = "false"
|
||||
SHOWMAPS = "false"
|
||||
API_ROOT = "http://localhost:3000"
|
||||
|
||||
CY_API_ROOT ="http://cymru.local:3000"
|
||||
I18N_DOMAIN = "cymru.local"
|
||||
|
||||
|
||||
|
||||
Vendored
+8
-2
@@ -4,12 +4,18 @@
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
{
|
||||
"name": "Next.js: debug server-side",
|
||||
"type": "node-terminal",
|
||||
"request": "launch",
|
||||
"command": "yarn run dev"
|
||||
},
|
||||
{"name": "Launch Chrome against localhost",
|
||||
"type": "pwa-chrome",
|
||||
"request": "launch",
|
||||
"name": "Launch Chrome against localhost",
|
||||
"url": "http://localhost:3000",
|
||||
"webRoot": "${workspaceFolder}"
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
+12
-12
@@ -422,7 +422,7 @@ export const downloadProgressFile = async (
|
||||
|
||||
const downloaded = await streamToBuffer(downloadedBlob.readableStreamBody);
|
||||
|
||||
console.log("Downloaded blob content:", downloaded.toString());
|
||||
//console.log("Downloaded blob content:", downloaded.toString());
|
||||
|
||||
return JSON.parse(downloaded.toString());
|
||||
};
|
||||
@@ -578,17 +578,17 @@ export const getProgressBlobs = async (containerName, caseReference) => {
|
||||
blobCount++;
|
||||
}
|
||||
|
||||
console.log(
|
||||
"this is the casefolder and blobcount:",
|
||||
caseReference,
|
||||
blobCount
|
||||
);
|
||||
// console.log(
|
||||
// "this is the casefolder and blobcount:",
|
||||
// caseReference,
|
||||
// blobCount
|
||||
// );
|
||||
|
||||
let blobObj = [];
|
||||
for await (const blob of containerClient.listBlobsFlat({
|
||||
prefix: caseReference + "/" + caseReference + "_appeal.json",
|
||||
})) {
|
||||
console.log("getProgressBlobs in here");
|
||||
//console.log("getProgressBlobs in here");
|
||||
blobObj.push({
|
||||
"name": blob.name.split("/")[1],
|
||||
"path": blob.name,
|
||||
@@ -680,11 +680,11 @@ export const getRepslobs = async (containerName, caseReference) => {
|
||||
blobCount++;
|
||||
}
|
||||
|
||||
console.log(
|
||||
"this is the casefolder and blobcount:",
|
||||
caseReference,
|
||||
blobCount
|
||||
);
|
||||
// console.log(
|
||||
// "this is the casefolder and blobcount:",
|
||||
// caseReference,
|
||||
// blobCount
|
||||
// );
|
||||
|
||||
let blobObj = [];
|
||||
for await (const blob of containerClient.findBlobsByTags(
|
||||
|
||||
+3
-2
@@ -1264,7 +1264,7 @@ export const uploadFiles = async (
|
||||
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
for (let j = 0; j < files[i].length; j++) {
|
||||
console.log(files[i][j].name);
|
||||
console.log("upload files:", files[i][j].name);
|
||||
formData.append(files[i][j].name, files[i][j]);
|
||||
}
|
||||
}
|
||||
@@ -1308,7 +1308,7 @@ export const uploadRepFiles = async (
|
||||
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
for (let j = 0; j < files[i].length; j++) {
|
||||
console.log(files[i][j].name);
|
||||
console.log("upload rep files:", files[i][j].name);
|
||||
formData.append(files[i][j].name, files[i][j]);
|
||||
}
|
||||
}
|
||||
@@ -1335,6 +1335,7 @@ export const uploadRepFiles = async (
|
||||
|
||||
export const getFilesFromBlob = (containerName, casefolderID) => {
|
||||
console.log(
|
||||
" get files from blob",
|
||||
BASE_URL +
|
||||
"/api/file/getbloblist?container=" +
|
||||
containerName +
|
||||
|
||||
@@ -101,7 +101,16 @@ const RegisterComplete = (props) => {
|
||||
onClick={() => {
|
||||
setLogout(),
|
||||
window.localStorage.clear(),
|
||||
destroyCookie({}, "pinsUser"),
|
||||
destroyCookie(
|
||||
null,
|
||||
"next-auth.csrf-token"
|
||||
),
|
||||
destroyCookie(
|
||||
null,
|
||||
"next-auth.callback-url"
|
||||
),
|
||||
destroyCookie(null, "pedw_locale"),
|
||||
destroyCookie(null, "pinsUser"),
|
||||
signOut({ callbackUrl: "/logout" });
|
||||
}}
|
||||
>
|
||||
|
||||
+51
-20
@@ -87,7 +87,9 @@ const Breadcrumbs = (props) => {
|
||||
<a
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
className="govuk-breadcrumbs__link"
|
||||
@@ -123,10 +125,13 @@ const Breadcrumbs = (props) => {
|
||||
{router.pathname == "/myportal/advancedsearch" ? (
|
||||
<>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
www
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
@@ -177,7 +182,9 @@ const Breadcrumbs = (props) => {
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
@@ -217,7 +224,9 @@ const Breadcrumbs = (props) => {
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
@@ -239,7 +248,9 @@ const Breadcrumbs = (props) => {
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
@@ -261,7 +272,9 @@ const Breadcrumbs = (props) => {
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
@@ -286,7 +299,9 @@ const Breadcrumbs = (props) => {
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
@@ -299,7 +314,9 @@ const Breadcrumbs = (props) => {
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
@@ -321,7 +338,9 @@ const Breadcrumbs = (props) => {
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
@@ -331,7 +350,7 @@ const Breadcrumbs = (props) => {
|
||||
</Link>
|
||||
</li>
|
||||
<li className="govuk-breadcrumbs__list-item">
|
||||
Your cases
|
||||
{t("common:breadcrumb-your-cases")}
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
@@ -345,7 +364,7 @@ const Breadcrumbs = (props) => {
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/myportal"
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
@@ -380,7 +399,9 @@ const Breadcrumbs = (props) => {
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
@@ -393,12 +414,14 @@ const Breadcrumbs = (props) => {
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/viewall"
|
||||
: "/viewall"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth/gweldpopeth"
|
||||
: "/myportal/viewall"
|
||||
}
|
||||
>
|
||||
<a className="govuk-breadcrumbs__link">
|
||||
Your cases{" "}
|
||||
{t("common:breadcrumb-your-cases")}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
@@ -421,7 +444,9 @@ const Breadcrumbs = (props) => {
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
@@ -443,7 +468,9 @@ const Breadcrumbs = (props) => {
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
@@ -564,7 +591,9 @@ const Breadcrumbs = (props) => {
|
||||
<Link
|
||||
href={
|
||||
router.locale == "cy"
|
||||
? router.locale + "/myportal"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
@@ -595,7 +624,9 @@ const Breadcrumbs = (props) => {
|
||||
<Link
|
||||
href={
|
||||
router.locale == "cy"
|
||||
? router.locale + "/myportal"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
@@ -814,7 +845,7 @@ const Breadcrumbs = (props) => {
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
? "/" + router.locale +"/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
|
||||
@@ -447,15 +447,19 @@ const CaseSummary = (props) => {
|
||||
"watchedCases"
|
||||
);
|
||||
alert(
|
||||
"You have stopped watching case " +
|
||||
t(
|
||||
"case:you-have-stopped-watching-label"
|
||||
) +
|
||||
props.currentView
|
||||
.caseReference
|
||||
.currentReference
|
||||
);
|
||||
}}
|
||||
title="Stop watching this case"
|
||||
title={t(
|
||||
"case:stop-watching-case-link"
|
||||
)}
|
||||
>
|
||||
Stop watching this case{" "}
|
||||
{t("case:stop-watching-case-link")}{" "}
|
||||
</span>
|
||||
) : (
|
||||
<span
|
||||
@@ -472,14 +476,17 @@ const CaseSummary = (props) => {
|
||||
.appealType
|
||||
);
|
||||
alert(
|
||||
"You are watching case " +
|
||||
t(
|
||||
"case:you-are-watching-label"
|
||||
) +
|
||||
" " +
|
||||
props.currentView
|
||||
.caseReference
|
||||
.currentReference
|
||||
);
|
||||
}}
|
||||
>
|
||||
Watch this case
|
||||
{t("case:watch-this-case-link")}
|
||||
</span>
|
||||
))}
|
||||
|
||||
@@ -505,9 +512,9 @@ const CaseSummary = (props) => {
|
||||
// item.title
|
||||
// );
|
||||
}}
|
||||
title="Watch this case"
|
||||
title={t("case:watch-this-case-link")}
|
||||
>
|
||||
Watch this case
|
||||
{t("case:watch-this-case-link")}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
@@ -524,7 +531,10 @@ const CaseSummary = (props) => {
|
||||
detailsObj.pinswg_representation_period_end_date
|
||||
) && (
|
||||
<div className="govuk-body">
|
||||
Representation Period ended on{" "}
|
||||
{t(
|
||||
"case:representation-period-ended-on-label"
|
||||
)}
|
||||
|
||||
{formatDates(
|
||||
detailsObj.pinswg_representation_period_end_date
|
||||
)}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { Field, reduxForm } from "redux-form";
|
||||
import { useRouter } from "next/router";
|
||||
import DatePicker, { registerLocale, setDefaultLocale } from "react-datepicker";
|
||||
import cy from "date-fns/locale/cy";
|
||||
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import "react-datepicker/dist/react-datepicker.css";
|
||||
import moment from "moment";
|
||||
@@ -288,7 +287,6 @@ const RenderDatePicker = ({
|
||||
...custom
|
||||
}) => {
|
||||
const router = useRouter();
|
||||
registerLocale("cy", cy);
|
||||
|
||||
var startDateArr =
|
||||
custom.dateStart != "0" ? custom.dateStart.split("") : custom.dateStart;
|
||||
|
||||
+26
-2
@@ -220,8 +220,22 @@ const Header = (props) => {
|
||||
<a
|
||||
onClick={() => {
|
||||
window.localStorage.clear(),
|
||||
destroyCookie({}, "pinsUser"),
|
||||
signOut({ callbackUrl: "/logout" });
|
||||
destroyCookie(
|
||||
null,
|
||||
"next-auth.csrf-token"
|
||||
),
|
||||
destroyCookie(
|
||||
null,
|
||||
"next-auth.callback-url"
|
||||
),
|
||||
destroyCookie(null, "pedw_locale"),
|
||||
destroyCookie(null, "pinsUser"),
|
||||
signOut({
|
||||
callbackUrl:
|
||||
locale == "cy"
|
||||
? "/allgofnodi"
|
||||
: "/logout",
|
||||
});
|
||||
}}
|
||||
className="govuk-header__link govuk-!-margin-right-3"
|
||||
>
|
||||
@@ -272,6 +286,16 @@ const Header = (props) => {
|
||||
? "Dewiswch Cymraeg"
|
||||
: "Select English"
|
||||
}
|
||||
onClick={() => {
|
||||
setCookie(
|
||||
null,
|
||||
"pedw_locale",
|
||||
locale == "en" ? "cy" : "en",
|
||||
{
|
||||
path: "/",
|
||||
}
|
||||
);
|
||||
}}
|
||||
>
|
||||
{" "}
|
||||
{t("common:available-in")}
|
||||
|
||||
@@ -184,6 +184,16 @@ let Login = (props) => {
|
||||
</button>
|
||||
</>;
|
||||
}
|
||||
|
||||
const signInButton = () => {
|
||||
router.push(
|
||||
`${
|
||||
router.locale == "cy" ? "/awd/mewngofnodi" : "/auth/signin"
|
||||
}?callbackUrl=${encodeURIComponent(
|
||||
window.location.href
|
||||
)}&error=EmailSignin`
|
||||
);
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<div className="card" id="login-card">
|
||||
@@ -197,14 +207,19 @@ let Login = (props) => {
|
||||
{session && "Signed in as " + session.user?.email}
|
||||
</div>
|
||||
<br />
|
||||
|
||||
{!session && (
|
||||
<button
|
||||
className="govuk-button withChevron govuk-button-cta"
|
||||
type="button"
|
||||
onClick={() =>
|
||||
signIn("email", {
|
||||
callbackUrl: "/",
|
||||
})
|
||||
onClick={
|
||||
() => signInButton()
|
||||
// signIn("email", {
|
||||
// callbackUrl:
|
||||
// (router.locale != "en"
|
||||
// ? "/cy"
|
||||
// : "") + "/",
|
||||
// })
|
||||
}
|
||||
>
|
||||
{t("home:login-via-nextuth-label")}
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@ import Dns from "./homepage/dns";
|
||||
const MainHome = (props) => {
|
||||
let { t } = useTranslation();
|
||||
|
||||
const { showLogin, session } = props;
|
||||
const { showLogin, session, siteurl } = props;
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
|
||||
@@ -34,7 +34,7 @@ const MainHome = (props) => {
|
||||
{showLogin == "true" && (
|
||||
<>
|
||||
<CaseSearch />
|
||||
<Login session={session} />
|
||||
<Login session={session} siteurl={siteurl} />
|
||||
</>
|
||||
)}{" "}
|
||||
<CaseComment />
|
||||
|
||||
@@ -25,7 +25,10 @@ const MyPortal = (props) => {
|
||||
const handleLogout = () => {
|
||||
console.info("////////////\n" + "logout" + "\n////////////");
|
||||
window.localStorage.clear(),
|
||||
destroyCookie({}, "pinsUser"),
|
||||
destroyCookie(null, "next-auth.csrf-token"),
|
||||
destroyCookie(null, "next-auth.callback-url"),
|
||||
destroyCookie(null, "pedw_locale"),
|
||||
destroyCookie(null, "pinsUser"),
|
||||
signOut({ callbackUrl: "/logout" });
|
||||
};
|
||||
|
||||
|
||||
@@ -32,7 +32,15 @@ const AwaitingSubmission = (props) => {
|
||||
{props.awaitingSubmission.awaitingSubmission["@odata.count"] >
|
||||
3 && (
|
||||
<div className="cardVieAll">
|
||||
<Link href="/myportal/viewall">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth/gweldpopeth"
|
||||
: "/myportal/viewall"
|
||||
}
|
||||
>
|
||||
<a
|
||||
className="govuk-link--no-underline"
|
||||
onClick={() => {
|
||||
|
||||
@@ -60,22 +60,21 @@ const AwaitingSubmissionFromBlob = (props) => {
|
||||
|
||||
<Link
|
||||
href={
|
||||
router.locale == "cy"
|
||||
? "/fymhorth/parhauigyflwyno"
|
||||
: "/myportal" +
|
||||
"/" +
|
||||
urlname +
|
||||
"?lpa=" +
|
||||
showTopThreeArr[key][
|
||||
"_pinswg_associatedlpa_value"
|
||||
] +
|
||||
"&apt=" +
|
||||
showTopThreeArr[key]
|
||||
.pinswg_appealcasetype +
|
||||
"&casereference=" +
|
||||
showTopThreeArr[key].pinswg_name +
|
||||
"&inid=" +
|
||||
showTopThreeArr[key].incidentid
|
||||
(router.locale == "cy"
|
||||
? "/fymhorth"
|
||||
: "/myportal") +
|
||||
"/" +
|
||||
urlname +
|
||||
"?lpa=" +
|
||||
showTopThreeArr[key][
|
||||
"_pinswg_associatedlpa_value"
|
||||
] +
|
||||
"&apt=" +
|
||||
showTopThreeArr[key].pinswg_appealcasetype +
|
||||
"&casereference=" +
|
||||
showTopThreeArr[key].pinswg_name +
|
||||
"&inid=" +
|
||||
showTopThreeArr[key].incidentid
|
||||
}
|
||||
>
|
||||
<a
|
||||
@@ -215,7 +214,15 @@ const AwaitingSubmissionFromBlob = (props) => {
|
||||
</div>
|
||||
{props.awaitingSubmissionFromBlob["@odata.count"] > 3 && (
|
||||
<div className="cardVieAll">
|
||||
<Link href="/myportal/viewall">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth/gweldpopeth"
|
||||
: "/myportal/viewall"
|
||||
}
|
||||
>
|
||||
<a
|
||||
className="govuk-link--no-underline"
|
||||
onClick={() => {
|
||||
|
||||
@@ -26,7 +26,15 @@ const MyCases = (props) => {
|
||||
</div>
|
||||
{props.myCases.myCases["@odata.count"] > 3 && (
|
||||
<div className="cardVieAll">
|
||||
<Link href="/myportal/viewall">
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth/gweldpopeth"
|
||||
: "/myportal/viewall"
|
||||
}
|
||||
>
|
||||
<a
|
||||
className="govuk-link--no-underline"
|
||||
onClick={() => {
|
||||
|
||||
@@ -31,7 +31,16 @@ const MyRepresentations = (props) => {
|
||||
{props.myRepresentations.myRepresentations["@odata.count"] >
|
||||
3 && (
|
||||
<div className="cardVieAll">
|
||||
<Link href="/myportal/viewall" shallow>
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth/gweldpopeth"
|
||||
: "/myportal/viewall"
|
||||
}
|
||||
shallow
|
||||
>
|
||||
<a
|
||||
className="govuk-link--no-underline"
|
||||
onClick={() => {
|
||||
|
||||
@@ -31,7 +31,16 @@ const MyRepresentations = (props) => {
|
||||
{props.myRepresentations.myRepresentations["@odata.count"] >
|
||||
3 && (
|
||||
<div className="cardVieAll">
|
||||
<Link href="/myportal/viewall" shallow>
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth/gweldpopeth"
|
||||
: "/myportal/viewall"
|
||||
}
|
||||
shallow
|
||||
>
|
||||
<a
|
||||
className="govuk-link--no-underline"
|
||||
onClick={() => {
|
||||
|
||||
@@ -28,7 +28,16 @@ const WatchedCases = (props) => {
|
||||
|
||||
{props.watchedCases.watchedCases["@odata.count"] > 3 && (
|
||||
<div className="cardVieAll">
|
||||
<Link href="/myportal/viewall" shallow>
|
||||
<Link
|
||||
href={
|
||||
router.locale != "en"
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth/gweldpopeth"
|
||||
: "/myportal/viewall"
|
||||
}
|
||||
shallow
|
||||
>
|
||||
<a
|
||||
className="govuk-link--no-underline"
|
||||
onClick={() => {
|
||||
|
||||
@@ -175,13 +175,14 @@ let BuildSection = (props) => {
|
||||
|
||||
const reference = "PEDW-PARTIAL";
|
||||
const templateId = "021b0a7b-df00-41f1-b94e-c269bee98c75";
|
||||
const templateIdCY = "f3c4a56b-bfb8-4d39-97dd-888df3062b0a";
|
||||
const emailAddress = props.props.accountDetails.loggedinUserEmail;
|
||||
const personalisation = {
|
||||
"caseReference": props.appealType.caseReference.ticketnumber,
|
||||
"emailAddress": props.props.accountDetails.loggedinUserEmail,
|
||||
"returnLink":
|
||||
props.props.url +
|
||||
"/myportal/" +
|
||||
(router.locale != "en" ? "/cy/fymhorth/" : "/myportal/") +
|
||||
appTypeCollection.UrlName +
|
||||
"?lpa=" +
|
||||
props.appealType.appealLPA +
|
||||
@@ -195,12 +196,17 @@ let BuildSection = (props) => {
|
||||
};
|
||||
|
||||
sendSavedEmail == true &&
|
||||
sendEmail(templateId, emailAddress, personalisation, reference);
|
||||
sendEmail(
|
||||
router.locale != "en" ? templateIdCY : templateId,
|
||||
emailAddress,
|
||||
personalisation,
|
||||
reference
|
||||
);
|
||||
|
||||
useSaveStatus &&
|
||||
router.replace(
|
||||
router.locale != "en"
|
||||
? router.locale + "/myportal"
|
||||
? "/" + router.locale + "/myportal"
|
||||
: "/myportal"
|
||||
);
|
||||
};
|
||||
|
||||
@@ -542,11 +542,14 @@ const DNSSearchResults = (props) => {
|
||||
"watchedCases"
|
||||
);
|
||||
alert(
|
||||
"You have stopped watching case " +
|
||||
item.title
|
||||
t(
|
||||
"case:you-have-stopped-watching-label"
|
||||
) + item.title
|
||||
);
|
||||
}}
|
||||
title="Stop watching this case"
|
||||
title={t(
|
||||
"case:stop-watching-case-link"
|
||||
)}
|
||||
>
|
||||
<span className="eye"></span>
|
||||
</span>
|
||||
@@ -560,11 +563,14 @@ const DNSSearchResults = (props) => {
|
||||
item.pinswg_appealcasetype
|
||||
);
|
||||
alert(
|
||||
"You are watching case " +
|
||||
item.title
|
||||
t(
|
||||
"case:you-are-watching-label"
|
||||
) + item.title
|
||||
);
|
||||
}}
|
||||
title="Watch this case"
|
||||
title={t(
|
||||
"case:watch-this-case-link"
|
||||
)}
|
||||
>
|
||||
<span className="eye"></span>
|
||||
</span>
|
||||
|
||||
@@ -504,11 +504,14 @@ const SearchResults = (props) => {
|
||||
"watchedCases"
|
||||
);
|
||||
alert(
|
||||
"You have stopped watching case " +
|
||||
item.title
|
||||
t(
|
||||
"case:you-have-stopped-watching-label"
|
||||
) + item.title
|
||||
);
|
||||
}}
|
||||
title="Stop watching this case"
|
||||
title={t(
|
||||
"case:stop-watching-case-link"
|
||||
)}
|
||||
>
|
||||
<span className="eye"></span>
|
||||
</span>
|
||||
@@ -522,11 +525,14 @@ const SearchResults = (props) => {
|
||||
item.pinswg_appealcasetype
|
||||
);
|
||||
alert(
|
||||
"You are watching case " +
|
||||
item.title
|
||||
t(
|
||||
"case:you-are-watching-label"
|
||||
) + item.title
|
||||
);
|
||||
}}
|
||||
title="Watch this case"
|
||||
title={t(
|
||||
"case:watch-this-case-link"
|
||||
)}
|
||||
>
|
||||
<span className="eye"></span>
|
||||
</span>
|
||||
@@ -554,7 +560,9 @@ const SearchResults = (props) => {
|
||||
item.title
|
||||
);
|
||||
}}
|
||||
title="Watch this case"
|
||||
title={t(
|
||||
"case:watch-this-case-link"
|
||||
)}
|
||||
>
|
||||
<span className="eye"></span>
|
||||
</span>
|
||||
|
||||
@@ -41,7 +41,10 @@ const TimeOut = (props) => {
|
||||
const handleLogout = () => {
|
||||
console.info("////////////\n" + "logout" + "\n////////////");
|
||||
window.localStorage.clear(),
|
||||
destroyCookie({}, "pinsUser"),
|
||||
destroyCookie(null, "next-auth.csrf-token"),
|
||||
destroyCookie(null, "next-auth.callback-url"),
|
||||
destroyCookie(null, "pedw_locale"),
|
||||
destroyCookie(null, "pinsUser"),
|
||||
signOut({ callbackUrl: "/logout" });
|
||||
};
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ module.exports = {
|
||||
"/myportal/viewall": ["search", "myportal"],
|
||||
"/myportal/advancedsearch": ["search", "myportal"],
|
||||
"/myportal/advancedsearchresults": ["search", "myportal"],
|
||||
"/myportal/searchresults": ["search", "myportal"],
|
||||
"/myportal/searchresults": ["search", "myportal", "case"],
|
||||
"/myportal/case": ["case"],
|
||||
"/myportal/dnsapplications": ["search", "dnsCommon", "dnsApplications"],
|
||||
"/myportal/dnsdetails": [
|
||||
|
||||
@@ -84,5 +84,10 @@
|
||||
"representation-onbehalfof": "A ydych yn gweithredu ar ran cwmni, grŵp neu sefydliad",
|
||||
"representation-onbehalfof-details": "Enw'r cwmni/grŵp/sefydliad",
|
||||
"representation-comments": "Sylwadau",
|
||||
"representation-files": "Ffeiliau perthnasol"
|
||||
"representation-files": "Ffeiliau perthnasol",
|
||||
"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 "
|
||||
}
|
||||
@@ -47,6 +47,7 @@
|
||||
"breadcrumb-my-portal": "Fy mhorth",
|
||||
"breadcrumb-new-appeal": "Apêl newydd",
|
||||
"breadcrumb-case-reference": "Cyfeirnod Achos",
|
||||
"breadcrumb-your-cases": "Eich achosion",
|
||||
"spinner-loading": "Llwytho...",
|
||||
"spinner-searching": "Chwilio...",
|
||||
"spinner-fetching-data": "Nôl data",
|
||||
|
||||
@@ -84,5 +84,10 @@
|
||||
"representation-onbehalfof": "Are you acting on behalf of a company, group or organisation",
|
||||
"representation-onbehalfof-details": "Name of the company/group/organisation",
|
||||
"representation-comments": "Comments",
|
||||
"representation-files": "Relevant files"
|
||||
"representation-files": "Relevant files",
|
||||
"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 "
|
||||
}
|
||||
@@ -47,6 +47,7 @@
|
||||
"breadcrumb-my-portal": "My portal",
|
||||
"breadcrumb-new-appeal": "New appeal",
|
||||
"breadcrumb-case-reference": "Case Reference",
|
||||
"breadcrumb-your-cases": "Your cases",
|
||||
"spinner-loading": "Loading...",
|
||||
"spinner-searching": "Searching...",
|
||||
"spinner-fetching-data": "Fetching data",
|
||||
|
||||
@@ -122,6 +122,14 @@ module.exports = {
|
||||
source: "/fymhorth/achos",
|
||||
destination: "/myportal/case",
|
||||
},
|
||||
{
|
||||
source: "/fymhorth/gweldpopeth",
|
||||
destination: "/myportal/viewall",
|
||||
},
|
||||
{
|
||||
source: "/fymhorth/:slug",
|
||||
destination: "/myportal/:slug",
|
||||
},
|
||||
{
|
||||
source: "/allgofnodi",
|
||||
destination: "/logout",
|
||||
@@ -158,6 +166,26 @@ module.exports = {
|
||||
source: "/telerau-ac-amodau",
|
||||
destination: "/terms-and-conditions",
|
||||
},
|
||||
{
|
||||
source: "/awd/mewngofnodi",
|
||||
destination: "/auth/signin",
|
||||
},
|
||||
{
|
||||
source: "/awd/mewngofnodi/ebost",
|
||||
destination: "/auth/signin/email",
|
||||
},
|
||||
{
|
||||
source: "/awd/gwall",
|
||||
destination: "/auth/error",
|
||||
},
|
||||
{
|
||||
source: "/awd/gwirio-cais",
|
||||
destination: "/auth/verify-request",
|
||||
},
|
||||
{
|
||||
source: "/cyfrif/cofrestr",
|
||||
destination: "/account/register",
|
||||
},
|
||||
|
||||
// {
|
||||
// source: "/cy:path*",
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@
|
||||
"mysql": "^2.18.1",
|
||||
"nanoid": "^3.2.0",
|
||||
"next": "^12.0.8",
|
||||
"next-auth": "4.19.2",
|
||||
"next-auth": "^4.22.1",
|
||||
"next-connect": "^0.12.2",
|
||||
"next-redux-wrapper": "^7.0.5",
|
||||
"next-swagger-doc": "^0.3.6",
|
||||
|
||||
+7
-2
@@ -2,6 +2,7 @@ import Document, { Html, Head, Main, NextScript } from "next/document";
|
||||
import SkipLink from "../components/skiplink";
|
||||
import { Tracking, TrackingNoScript } from "../components/tracking";
|
||||
import { nanoid } from "nanoid";
|
||||
import { setCookie } from "nookies";
|
||||
|
||||
class MyDocument extends Document {
|
||||
static async getInitialProps(ctx) {
|
||||
@@ -19,12 +20,16 @@ class MyDocument extends Document {
|
||||
useGATracking = false;
|
||||
}
|
||||
|
||||
setCookie(ctx, "pedw_locale", ctx.locale, {
|
||||
path: "/",
|
||||
});
|
||||
|
||||
return { ...initialProps, useGATracking };
|
||||
}
|
||||
|
||||
render() {
|
||||
const googleTagManagerID = process.env.GOOGLE_TAG_MANAGER || null;
|
||||
const { useGATracking } = this.props;
|
||||
const { useGATracking, locale } = this.props;
|
||||
|
||||
const generatedNonce = nanoid();
|
||||
|
||||
@@ -39,7 +44,7 @@ class MyDocument extends Document {
|
||||
csp += `style-src 'self' https://fonts.googleapis.com 'unsafe-inline' data:;`;
|
||||
|
||||
return (
|
||||
<Html lang="en">
|
||||
<Html lang={locale}>
|
||||
<Head>
|
||||
<meta httpEquiv="Content-Security-Policy" content={csp} />
|
||||
{useGATracking && (
|
||||
|
||||
+10
-1
@@ -39,7 +39,16 @@ function Error({ statusCode }, props) {
|
||||
className="govuk-link"
|
||||
onClick={() => {
|
||||
window.localStorage.clear(),
|
||||
destroyCookie({}, "pinsUser"),
|
||||
destroyCookie(
|
||||
null,
|
||||
"next-auth.csrf-token"
|
||||
),
|
||||
destroyCookie(
|
||||
null,
|
||||
"next-auth.callback-url"
|
||||
),
|
||||
destroyCookie(null, "pedw_locale"),
|
||||
destroyCookie(null, "pinsUser"),
|
||||
session != null
|
||||
? signOut({
|
||||
callbackUrl: "/",
|
||||
|
||||
+217
-66
@@ -16,77 +16,228 @@ import { PrismaAdapter } from "@next-auth/prisma-adapter";
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
import nodemailer from "nodemailer";
|
||||
import { consoleLogger } from "../../../actions";
|
||||
import { useRouter } from "next/router";
|
||||
import nookies from "nookies";
|
||||
import { getCsrfToken } from "next-auth/react";
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
// For more information on each option (and a full list of options) go to
|
||||
// https://next-auth.js.org/configuration/options
|
||||
export default NextAuth({
|
||||
// https://next-auth.js.org/configuration/providers
|
||||
providers: [
|
||||
EmailProvider({
|
||||
// server: {
|
||||
// host: process.env.EMAIL_SERVER_HOST,
|
||||
// port: process.env.EMAIL_SERVER_PORT,
|
||||
// auth: {
|
||||
// user: process.env.EMAIL_SERVER_USER,
|
||||
// pass: process.env.EMAIL_SERVER_PASSWORD,
|
||||
// },
|
||||
// },
|
||||
// from: process.env.EMAIL_FROM,
|
||||
maxAge: 10 * 60, // Magic links are valid for 10 min only
|
||||
async sendVerificationRequest({
|
||||
identifier: email,
|
||||
url,
|
||||
provider: { server, from },
|
||||
}) {
|
||||
const { host } = new URL(url);
|
||||
const templateId = "b1b5704b-9bb8-4deb-a75c-d887ca902661";
|
||||
const emailAddress = email;
|
||||
const personalisation = {
|
||||
"emailAddress": email,
|
||||
"signInLink": url,
|
||||
"linkExpiry": 10 * 60,
|
||||
};
|
||||
const reference = "PEDW-SIGNIN";
|
||||
// export default NextAuth({
|
||||
// // https://next-auth.js.org/configuration/providers
|
||||
// providers: [
|
||||
// EmailProvider({
|
||||
// // server: {
|
||||
// // host: process.env.EMAIL_SERVER_HOST,
|
||||
// // port: process.env.EMAIL_SERVER_PORT,
|
||||
// // auth: {
|
||||
// // user: process.env.EMAIL_SERVER_USER,
|
||||
// // pass: process.env.EMAIL_SERVER_PASSWORD,
|
||||
// // },
|
||||
// // },
|
||||
// // from: process.env.EMAIL_FROM,
|
||||
// maxAge: 10 * 60, // Magic links are valid for 10 min only
|
||||
// async sendVerificationRequest({
|
||||
// identifier: email,
|
||||
// url,
|
||||
// provider: { server, from },
|
||||
// }) {
|
||||
// const { host } = new URL(url);
|
||||
// const templateId = "b1b5704b-9bb8-4deb-a75c-d887ca902661";
|
||||
// const emailAddress = email;
|
||||
// const personalisation = {
|
||||
// "emailAddress": email,
|
||||
// "signInLink": url,
|
||||
// "linkExpiry": 10 * 60,
|
||||
// };
|
||||
// const reference = "PEDW-SIGNIN";
|
||||
|
||||
var NotifyClient =
|
||||
require("notifications-node-client").NotifyClient;
|
||||
// var NotifyClient =
|
||||
// require("notifications-node-client").NotifyClient;
|
||||
|
||||
const notifyClient = new NotifyClient(
|
||||
process.env.NOTIFY_API_KEY
|
||||
);
|
||||
// const notifyClient = new NotifyClient(
|
||||
// process.env.NOTIFY_API_KEY
|
||||
// );
|
||||
|
||||
await notifyClient
|
||||
.sendEmail(templateId, emailAddress, {
|
||||
personalisation: personalisation,
|
||||
reference: reference,
|
||||
// emailReplyToId: emailReplyToId,
|
||||
})
|
||||
//.then((response) => console.log(response))
|
||||
.catch((err) => consoleLogger(err));
|
||||
},
|
||||
}),
|
||||
],
|
||||
adapter: PrismaAdapter(prisma),
|
||||
secret: process.env.SECRET,
|
||||
session: {
|
||||
jwt: true,
|
||||
pages: {},
|
||||
theme: "dark",
|
||||
debug: true,
|
||||
},
|
||||
pages: {
|
||||
signIn: "/auth/signin",
|
||||
//signOut: "/auth/signout",
|
||||
error: "/auth/error", // Error code passed in query string as ?error=
|
||||
verifyRequest: "/auth/verify-request", // (used for check email message)
|
||||
newUser: "/account/register", // New users will be directed here on first sign in (leave the property out if not of interest)
|
||||
},
|
||||
callbacks: {
|
||||
session: async (session, user) => {
|
||||
//console.log(user);
|
||||
return Promise.resolve(session);
|
||||
// await notifyClient
|
||||
// .sendEmail(templateId, emailAddress, {
|
||||
// personalisation: personalisation,
|
||||
// reference: reference,
|
||||
// // emailReplyToId: emailReplyToId,
|
||||
// })
|
||||
// //.then((response) => console.log(response))
|
||||
// .catch((err) => consoleLogger(err));
|
||||
// },
|
||||
// }),
|
||||
// ],
|
||||
// adapter: PrismaAdapter(prisma),
|
||||
// secret: process.env.SECRET,
|
||||
// session: {
|
||||
// jwt: true,
|
||||
// pages: {},
|
||||
// theme: "dark",
|
||||
// debug: true,
|
||||
// },
|
||||
// pages: {
|
||||
// signIn: "/auth/signin",
|
||||
// //signOut: "/auth/signout",
|
||||
// error: "/auth/error", // Error code passed in query string as ?error=
|
||||
// verifyRequest: "/auth/verify-request", // (used for check email message)
|
||||
// newUser: "/account/register", // New users will be directed here on first sign in (leave the property out if not of interest)
|
||||
// },
|
||||
// callbacks: {
|
||||
// session: async (session, user) => {
|
||||
// //console.log(user);
|
||||
// return Promise.resolve(session);
|
||||
// },
|
||||
// },
|
||||
// });
|
||||
|
||||
const parseUrl = (url) => {
|
||||
const defaultUrl = new URL(
|
||||
$(
|
||||
(locale == "cy"
|
||||
? process.env.CY_API_ROOT
|
||||
: process.env.NEXTAUTH_URL) + `/api/auth`
|
||||
)
|
||||
);
|
||||
|
||||
if (url && !url.startsWith("http")) {
|
||||
url = `https://${url}`;
|
||||
}
|
||||
|
||||
const _url = new URL(url ?? defaultUrl);
|
||||
const path = (_url.pathname === "/" ? defaultUrl.pathname : _url.pathname)
|
||||
// Remove trailing slash
|
||||
.replace(/\/$/, "");
|
||||
|
||||
const base = `${_url.origin}${path}`;
|
||||
|
||||
return {
|
||||
origin: _url.origin,
|
||||
host: _url.host,
|
||||
path,
|
||||
base,
|
||||
toString: () => base,
|
||||
};
|
||||
};
|
||||
|
||||
const authOptions = (locale, req) => {
|
||||
//console.log(req.query.callbackUrl);
|
||||
// let newURL = parseUrl(
|
||||
// locale == "cy"
|
||||
// ? "https://" + process.env.I18N_DOMAIN + ":3000"
|
||||
// : process.env.NEXTAUTH_URL
|
||||
// );
|
||||
|
||||
return {
|
||||
providers: [
|
||||
EmailProvider({
|
||||
maxAge: 10 * 60, // Magic links are valid for 10 min only
|
||||
async sendVerificationRequest({ identifier: email, url }) {
|
||||
const { host, port, protocol, token, searchParams } =
|
||||
new URL(url);
|
||||
|
||||
const templateId = "b1b5704b-9bb8-4deb-a75c-d887ca902661";
|
||||
const templateIdcy = "0614ce53-cd5f-421f-a1a5-8c8486a9113a";
|
||||
const emailAddress = email;
|
||||
console.log("verifciation url", url);
|
||||
let newURL =
|
||||
locale == "cy"
|
||||
? process.env.CY_API_ROOT
|
||||
: process.env.NEXTAUTH_URL;
|
||||
|
||||
const csrfToken = await getCsrfToken({ req });
|
||||
|
||||
console.log(newURL, searchParams.get("token"));
|
||||
const personalisation = {
|
||||
"emailAddress": email,
|
||||
"signInLink": url,
|
||||
"signInLink":
|
||||
newURL +
|
||||
"/api/auth/callback/email?callbackUrl=" +
|
||||
encodeURIComponent(newURL) +
|
||||
"&token=" +
|
||||
searchParams.get("token") +
|
||||
"&email=" +
|
||||
encodeURIComponent(email),
|
||||
"linkExpiry": 10 * 60,
|
||||
};
|
||||
const reference = "PEDW-SIGNIN";
|
||||
|
||||
var NotifyClient =
|
||||
require("notifications-node-client").NotifyClient;
|
||||
|
||||
const notifyClient = new NotifyClient(
|
||||
process.env.NOTIFY_API_KEY
|
||||
);
|
||||
|
||||
await notifyClient
|
||||
.sendEmail(
|
||||
locale == "cy" ? templateIdcy : templateId,
|
||||
emailAddress,
|
||||
{
|
||||
personalisation: personalisation,
|
||||
reference: reference,
|
||||
// emailReplyToId: emailReplyToId,
|
||||
}
|
||||
)
|
||||
//.then((response) => console.log(response))
|
||||
.catch((err) => consoleLogger(err));
|
||||
},
|
||||
}),
|
||||
],
|
||||
adapter: PrismaAdapter(prisma),
|
||||
secret: process.env.SECRET,
|
||||
session: {
|
||||
jwt: true,
|
||||
pages: {},
|
||||
theme: "dark",
|
||||
debug: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
cookies: {
|
||||
callbackUrl: {
|
||||
name: `__Secure-next-auth.callback-url`,
|
||||
options: {
|
||||
sameSite: "lax",
|
||||
path: "/",
|
||||
secure: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
signIn: (locale == "cy" ? "/cy" : "") + "/auth/signin",
|
||||
//signOut: "/logout/signout",
|
||||
error: (locale == "cy" ? "/cy" : "") + "/auth/error", // Error code passed in query string as ?error=
|
||||
verifyRequest:
|
||||
(locale == "cy" ? "/cy" : "") + "/auth/verify-request", // (used for check email message)
|
||||
newUser: locale + "/account/register", // New users will be directed here on first sign in (leave the property out if not of interest)
|
||||
},
|
||||
callbacks: {
|
||||
session: async (session, user) => {
|
||||
//console.log(user);
|
||||
return Promise.resolve(session);
|
||||
},
|
||||
async redirect({ url, baseUrl }) {
|
||||
// // Allows relative callback URLs
|
||||
// if (url.startsWith("/")) return `${baseUrl}${url}`;
|
||||
// // Allows callback URLs on the same origin
|
||||
// else if (new URL(url).origin === baseUrl) return url;
|
||||
let newURL =
|
||||
locale == "cy"
|
||||
? process.env.CY_API_ROOT
|
||||
: process.env.NEXTAUTH_URL;
|
||||
console.log("baseurl:", newURL);
|
||||
//return baseUrl;
|
||||
return newURL;
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default (req, res) => {
|
||||
//console.log("----------", authOptions(req.cookies["pedw_locale"]));
|
||||
|
||||
//console.log("----------",
|
||||
return NextAuth(req, res, authOptions(req.cookies["pedw_locale"], req));
|
||||
};
|
||||
|
||||
@@ -49,7 +49,11 @@ export default async function ApiProxy(req, res) {
|
||||
searchString +
|
||||
"')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||
|
||||
//console.log("basic search ", queryUrl);
|
||||
console.log(
|
||||
"basic search ",
|
||||
queryUrl,
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl)
|
||||
);
|
||||
|
||||
var apiResponse = _.isEmpty(req.query)
|
||||
? res.status(400).json()
|
||||
|
||||
@@ -48,7 +48,7 @@ export default async function ApiProxy(req, res) {
|
||||
var caseReference = req.query.caseReference.split("'").join("''");
|
||||
var token = await getToken();
|
||||
|
||||
console.log("the case:", req.query, caseReference);
|
||||
//console.log("the case:", req.query, caseReference);
|
||||
|
||||
var queryUrl =
|
||||
appealType +
|
||||
|
||||
@@ -27,7 +27,7 @@ ApiProxy.get(async (req, res) => {
|
||||
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
|
||||
const blobObj = await getProgressBlobs(containerName, casefolderID)
|
||||
.then((data) => {
|
||||
console.log("Progress blob path:", data.path);
|
||||
//console.log("Progress blob path:", data.path);
|
||||
return downloadProgressFile(
|
||||
containerName,
|
||||
data.path,
|
||||
|
||||
+41
-3
@@ -6,10 +6,20 @@ import Footer from "../../components/footer";
|
||||
import Header from "../../components/header";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import { getCsrfToken } from "next-auth/react";
|
||||
import { parseCookies, setCookie, destroyCookie } from "nookies";
|
||||
import { ca } from "date-fns/locale";
|
||||
|
||||
const SignIn = (props) => {
|
||||
let { t, lang } = useTranslation();
|
||||
const { footerLinks, pages, csrfToken } = props;
|
||||
const { footerLinks, pages, csrfToken, callbackUrl } = props;
|
||||
|
||||
let formURL =
|
||||
new URL(window.location.href).protocol +
|
||||
"//" +
|
||||
new URL(window.location.href).hostname +
|
||||
":" +
|
||||
new URL(window.location.href).port +
|
||||
"/api/auth/signin/email";
|
||||
|
||||
return (
|
||||
<div>
|
||||
@@ -33,7 +43,7 @@ const SignIn = (props) => {
|
||||
<div className="govuk-grid-column-two-thirds ">
|
||||
<form
|
||||
method="post"
|
||||
action="/api/auth/signin/email"
|
||||
action={"/api/auth/signin/email"}
|
||||
>
|
||||
<div className="govuk-form-group">
|
||||
<input
|
||||
@@ -42,6 +52,12 @@ const SignIn = (props) => {
|
||||
type="hidden"
|
||||
defaultValue={csrfToken}
|
||||
/>
|
||||
<input
|
||||
className="govuk-input"
|
||||
name="callbackUrl"
|
||||
type="hidden"
|
||||
defaultValue={callbackUrl}
|
||||
/>
|
||||
<label
|
||||
className="govuk-label"
|
||||
htmlFor="email"
|
||||
@@ -75,9 +91,31 @@ const SignIn = (props) => {
|
||||
};
|
||||
|
||||
export async function getServerSideProps(context) {
|
||||
console.log("-1-1-1-1-", context.query.callbackUrl, context.locale);
|
||||
console.log("------ " + context.query.callbackUrl);
|
||||
// setCookie(context, "next-auth.callback-url", context.query.callbackUrl, {
|
||||
// path: "/",
|
||||
// });
|
||||
|
||||
const csrfToken = await getCsrfToken(context);
|
||||
let callback =
|
||||
context.locale != "cy"
|
||||
? process.env.NEXTAUTH_URL
|
||||
: "https://" + process.env.I18N_DOMAIN + ":3000";
|
||||
|
||||
context.query.callbackUrl = callback;
|
||||
|
||||
let formURL =
|
||||
new URL(callback).protocol +
|
||||
"//" +
|
||||
new URL(callback).hostname +
|
||||
":" +
|
||||
new URL(callback).port; // +
|
||||
// "/api/auth/signin/email";
|
||||
|
||||
console.log("******", formURL, callback, csrfToken);
|
||||
return {
|
||||
props: { csrfToken },
|
||||
props: { csrfToken: csrfToken, callbackUrl: formURL, redirect: true },
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ const SignIn = (props) => {
|
||||
export async function getServerSideProps(context) {
|
||||
const csrfToken = await getCsrfToken(context);
|
||||
return {
|
||||
props: { csrfToken },
|
||||
props: { csrfToken, locale: context.locale },
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+10
-1
@@ -43,7 +43,16 @@ function Error({ statusCode }, props) {
|
||||
className="govuk-link"
|
||||
onClick={() => {
|
||||
window.localStorage.clear(),
|
||||
destroyCookie({}, "pinsUser"),
|
||||
destroyCookie(
|
||||
null,
|
||||
"next-auth.csrf-token"
|
||||
),
|
||||
destroyCookie(
|
||||
null,
|
||||
"next-auth.callback-url"
|
||||
),
|
||||
destroyCookie(null, "pedw_locale"),
|
||||
destroyCookie(null, "pinsUser"),
|
||||
session != null
|
||||
? signOut({
|
||||
callbackUrl: "/",
|
||||
|
||||
+3
-1
@@ -28,6 +28,7 @@ const Home = (props) => {
|
||||
loginEmailStr,
|
||||
loggedInUserEmail,
|
||||
hasLoginCode,
|
||||
siteurl,
|
||||
} = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
@@ -60,7 +61,6 @@ const Home = (props) => {
|
||||
})
|
||||
: (setCookie(null, "pinsUser", loggedInUserId.value[0].contactid, {
|
||||
path: "/",
|
||||
expires: expDate,
|
||||
}),
|
||||
router.replace({
|
||||
pathname:
|
||||
@@ -137,6 +137,7 @@ const Home = (props) => {
|
||||
showLogin={showLogin}
|
||||
showMap={showMap}
|
||||
loggedInUserId={loggedInUserId}
|
||||
siteurl={siteurl}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
@@ -195,6 +196,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
loggedInUserId: portalUserObj,
|
||||
loggedInUserEmail: loginEmailStr,
|
||||
hasLoginCode: hasLoginCode,
|
||||
siteurl: process.env.API_ROOT,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
+3
-1
@@ -91,7 +91,9 @@ const LogOut = (props) => {
|
||||
<div className="govuk-width-container">
|
||||
<h2>{t("common:logged-out-title")}</h2>
|
||||
<div className="govuk-!-margin-top-9 govuk-!-margin-bottom-9">
|
||||
<Link href="/">{t("common:logged-out-link")}</Link>
|
||||
<Link href={locale == "cy" ? "/cy" : "/"}>
|
||||
{t("common:logged-out-link")}
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
<Footer footerLinks={footerLinks} />
|
||||
|
||||
@@ -217,7 +217,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
const { cookies } = req;
|
||||
|
||||
//console.log(cookies);
|
||||
//console.log("the query", query.appealtypes);
|
||||
console.log("the query", query);
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
|
||||
let thisSession = await getSession(ctx);
|
||||
@@ -228,6 +228,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
//console.log("logged ident:", loggedInUserIdent);
|
||||
|
||||
console.log("which appeal: ", query.appealtypes);
|
||||
|
||||
const [appealTypeData, mandatoryFieldsData, pickListData, blobList] =
|
||||
await Promise.all([
|
||||
await getAppealsTypesForNewAppeal(),
|
||||
|
||||
+62
-12
@@ -263,13 +263,33 @@ const getDetails = (resultsObj, detailsType) => {
|
||||
resultsObj = resultsObj.value;
|
||||
if (detailsType == "myRepresentations") {
|
||||
const repsObj = resultsObj.map((searchDetail, index) => {
|
||||
console.log("==== ", searchDetail["_pinswg_case_value"]);
|
||||
detailsArr.push(
|
||||
getCase(searchDetail["incidentID"]).then((data) => {
|
||||
let caseID = "";
|
||||
|
||||
switch (detailsType) {
|
||||
case "myCases":
|
||||
caseID = data.pinswg_title;
|
||||
break;
|
||||
case "myWatchedCases":
|
||||
caseID =
|
||||
data[
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
];
|
||||
break;
|
||||
case "awaitingSubmission":
|
||||
caseID = data.ticketnumber;
|
||||
break;
|
||||
case "myRepresentations":
|
||||
caseID = data.casereference;
|
||||
break;
|
||||
default:
|
||||
caseID = data.pinswg_title;
|
||||
}
|
||||
return getPortalModuleDetails(
|
||||
getFormCollectionByID(data.pinswg_appealcasetype)
|
||||
.LogicalCollectionName,
|
||||
data.ticketnumber
|
||||
caseID
|
||||
);
|
||||
})
|
||||
);
|
||||
@@ -277,24 +297,54 @@ const getDetails = (resultsObj, detailsType) => {
|
||||
}
|
||||
|
||||
const detailsObj = resultsObj.map((searchDetail, index) => {
|
||||
let caseID = "";
|
||||
|
||||
switch (detailsType) {
|
||||
case "myCases":
|
||||
caseID = searchDetail.pinswg_title;
|
||||
break;
|
||||
case "myWatchedCases":
|
||||
caseID =
|
||||
searchDetail[
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
];
|
||||
break;
|
||||
case "awaitingSubmission":
|
||||
caseID = searchDetail.ticketnumber;
|
||||
break;
|
||||
case "myRepresentations":
|
||||
caseID = searchDetail.casereference;
|
||||
break;
|
||||
default:
|
||||
caseID = searchDetail.pinswg_title;
|
||||
}
|
||||
|
||||
//console.log(detailsType, " case id : ", caseID);
|
||||
|
||||
if (searchDetail.pinswg_appealcasetype == null) {
|
||||
console.log(
|
||||
detailsType != "myWatchedCases"
|
||||
? searchDetail.ticketnumber
|
||||
: searchDetail[
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
"detailsObj:",
|
||||
detailsType,
|
||||
detailsType == "myCases" && searchDetail.pinswg_title,
|
||||
detailsType == "myWatchedCases" &&
|
||||
searchDetail[
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
],
|
||||
detailsType == "awaitingSubmission" &&
|
||||
searchDetail.ticketnumber,
|
||||
detailsType == "myRepresentations" && searchDetail.casereference
|
||||
);
|
||||
} else {
|
||||
detailsArr.push(
|
||||
getPortalModuleDetails(
|
||||
getFormCollectionByID(searchDetail.pinswg_appealcasetype)
|
||||
.LogicalCollectionName,
|
||||
detailsType != "myWatchedCases"
|
||||
? searchDetail.ticketnumber
|
||||
: searchDetail[
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
caseID
|
||||
// detailsType != "myWatchedCases"
|
||||
// ? searchDetail.ticketnumber
|
||||
// : searchDetail[
|
||||
// "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
// ]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ export const getAppealTypeObj = () => (dispatch) => {
|
||||
};
|
||||
|
||||
export const setAppealType = (appealTypeData) => (dispatch) => {
|
||||
//console.log("appeal type data", appealTypeData);
|
||||
return dispatch({
|
||||
type: appealTypeDataActionTypes.SETAPPEALTYPEDATA,
|
||||
appealTypeOptions: appealTypeData,
|
||||
|
||||
+1
-1
@@ -128,7 +128,7 @@ const makeStore = ({ isServer }) => {
|
||||
whitelist: [
|
||||
"currentView",
|
||||
//"searchResultsObj",
|
||||
"appealType",
|
||||
//"appealType",
|
||||
"LPAData",
|
||||
//"accountDetails",
|
||||
"awaitingSubmission",
|
||||
|
||||
-7504
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user