updated restriction to disallow partial reps and appeals from being submitted when not docapi
This commit is contained in:
@@ -5,7 +5,7 @@ import { useRouter } from "next/router";
|
|||||||
import { useCallback, useEffect, useRef, useState } from "react";
|
import { useCallback, useEffect, useRef, useState } from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import transLookup from "../../../data/lookuptranslations.json";
|
import transLookup from "../../../data/lookuptranslations.json";
|
||||||
import { formatDates } from "../../utils";
|
import { formatDates, getDocLink } from "../../utils";
|
||||||
import PaginationControl from "../../../components/case/pagination";
|
import PaginationControl from "../../../components/case/pagination";
|
||||||
import DocumentLink from "../../utils/downloads";
|
import DocumentLink from "../../utils/downloads";
|
||||||
import { useDownloadQueue } from "../../utils/downloadmanager";
|
import { useDownloadQueue } from "../../utils/downloadmanager";
|
||||||
@@ -305,37 +305,7 @@ const DocumentsTab = (props) => {
|
|||||||
setSelectedDocumentOrigin("all")
|
setSelectedDocumentOrigin("all")
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
let ShowDocLinks = false;
|
let ShowDocLinks = getDocLink(docsOffline);
|
||||||
let checkShowDocLinks = docsOffline != false ? true : false;
|
|
||||||
|
|
||||||
const getDocLink = (docsOffline) => {
|
|
||||||
var startTime = docsOffline.split(",")[0];
|
|
||||||
var endTime = docsOffline.split(",")[1];
|
|
||||||
|
|
||||||
// console.log(startTime);
|
|
||||||
// console.log(endTime);
|
|
||||||
|
|
||||||
var currentDate = new Date();
|
|
||||||
|
|
||||||
var startDate = new Date(currentDate.getTime());
|
|
||||||
startDate.setHours(startTime.split(":")[0]);
|
|
||||||
startDate.setMinutes(startTime.split(":")[1]);
|
|
||||||
startDate.setSeconds(startTime.split(":")[2]);
|
|
||||||
|
|
||||||
var endDate = new Date(currentDate.getTime());
|
|
||||||
endDate.setHours(endTime.split(":")[0]);
|
|
||||||
endDate.setMinutes(endTime.split(":")[1]);
|
|
||||||
endDate.setSeconds(endTime.split(":")[2]);
|
|
||||||
|
|
||||||
// console.log(startDate);
|
|
||||||
// console.log(endDate);
|
|
||||||
// console.log(currentDate);
|
|
||||||
|
|
||||||
var valid = startDate < currentDate && endDate > currentDate;
|
|
||||||
ShowDocLinks = valid;
|
|
||||||
};
|
|
||||||
|
|
||||||
checkShowDocLinks && getDocLink(docsOffline);
|
|
||||||
|
|
||||||
const FilteredDocumentView = (documentDetailsArr) => {
|
const FilteredDocumentView = (documentDetailsArr) => {
|
||||||
documentDetailsArr = documentDetailsArr.value;
|
documentDetailsArr = documentDetailsArr.value;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { useRouter } from "next/router";
|
|||||||
import { useCallback, useEffect, useRef, useState } from "react";
|
import { useCallback, useEffect, useRef, useState } from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import transLookup from "../../data/lookuptranslations.json";
|
import transLookup from "../../data/lookuptranslations.json";
|
||||||
import { formatDates } from "../utils";
|
import { formatDates, getDocLink } from "../utils";
|
||||||
import PaginationControl from "./pagination";
|
import PaginationControl from "./pagination";
|
||||||
import { sendGAEvent } from "@next/third-parties/google";
|
import { sendGAEvent } from "@next/third-parties/google";
|
||||||
|
|
||||||
@@ -90,37 +90,7 @@ const DocumentDetails = (props) => {
|
|||||||
setCurrentPage(1)
|
setCurrentPage(1)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
let ShowDocLinks = false;
|
let ShowDocLinks = getDocLink(docsOffline);
|
||||||
let checkShowDocLinks = docsOffline != false ? true : false;
|
|
||||||
|
|
||||||
const getDocLink = (docsOffline) => {
|
|
||||||
var startTime = docsOffline.split(",")[0];
|
|
||||||
var endTime = docsOffline.split(",")[1];
|
|
||||||
|
|
||||||
// console.log(startTime);
|
|
||||||
// console.log(endTime);
|
|
||||||
|
|
||||||
var currentDate = new Date();
|
|
||||||
|
|
||||||
var startDate = new Date(currentDate.getTime());
|
|
||||||
startDate.setHours(startTime.split(":")[0]);
|
|
||||||
startDate.setMinutes(startTime.split(":")[1]);
|
|
||||||
startDate.setSeconds(startTime.split(":")[2]);
|
|
||||||
|
|
||||||
var endDate = new Date(currentDate.getTime());
|
|
||||||
endDate.setHours(endTime.split(":")[0]);
|
|
||||||
endDate.setMinutes(endTime.split(":")[1]);
|
|
||||||
endDate.setSeconds(endTime.split(":")[2]);
|
|
||||||
|
|
||||||
// console.log(startDate);
|
|
||||||
// console.log(endDate);
|
|
||||||
// console.log(currentDate);
|
|
||||||
|
|
||||||
var valid = startDate < currentDate && endDate > currentDate;
|
|
||||||
ShowDocLinks = valid;
|
|
||||||
};
|
|
||||||
|
|
||||||
checkShowDocLinks && getDocLink(docsOffline);
|
|
||||||
|
|
||||||
const DocumentView = (documentDetailsArr) => {
|
const DocumentView = (documentDetailsArr) => {
|
||||||
documentDetailsArr = documentDetailsArr.value;
|
documentDetailsArr = documentDetailsArr.value;
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ let MakeRepresentation = (props) => {
|
|||||||
initialValues,
|
initialValues,
|
||||||
setCurrentReference,
|
setCurrentReference,
|
||||||
ticketnumber,
|
ticketnumber,
|
||||||
|
docsOffline,
|
||||||
} = props;
|
} = props;
|
||||||
const formObj = props.props.form;
|
const formObj = props.props.form;
|
||||||
let setCaseQueryObj = props[currentType] || {};
|
let setCaseQueryObj = props[currentType] || {};
|
||||||
@@ -1105,6 +1106,7 @@ let MakeRepresentation = (props) => {
|
|||||||
questionnaireCount={questionnaireCount}
|
questionnaireCount={questionnaireCount}
|
||||||
finaliseAppealProcess={finaliseAppealProcess}
|
finaliseAppealProcess={finaliseAppealProcess}
|
||||||
setFinaliseAppealProcess={setFinaliseAppealProcess}
|
setFinaliseAppealProcess={setFinaliseAppealProcess}
|
||||||
|
docsOffline={docsOffline}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
getThumbnailIconByExtension,
|
getThumbnailIconByExtension,
|
||||||
formatDates,
|
formatDates,
|
||||||
updateLinks,
|
updateLinks,
|
||||||
|
getDocLink,
|
||||||
} from "../../utils";
|
} from "../../utils";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -41,7 +42,11 @@ const RepCompleteSubmit = (props) => {
|
|||||||
questionnaireCount,
|
questionnaireCount,
|
||||||
finaliseAppealProcess,
|
finaliseAppealProcess,
|
||||||
setCurrentReference,
|
setCurrentReference,
|
||||||
|
docsOffline,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
|
let ShowDocLinks = getDocLink(docsOffline);
|
||||||
|
|
||||||
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
|
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
|
||||||
const files = acceptedFiles.map((file) => (
|
const files = acceptedFiles.map((file) => (
|
||||||
<li key={file.path}>
|
<li key={file.path}>
|
||||||
@@ -230,6 +235,7 @@ const RepCompleteSubmit = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const checkRepDatePassed = () => {
|
const checkRepDatePassed = () => {
|
||||||
|
return false;
|
||||||
if (repFormData.representationType == "Questionnaire") {
|
if (repFormData.representationType == "Questionnaire") {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@@ -603,6 +609,7 @@ const RepCompleteSubmit = (props) => {
|
|||||||
"myrepresentations:rep-check-tandc-para-three"
|
"myrepresentations:rep-check-tandc-para-three"
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{checkRepDatePassed() ? (
|
{checkRepDatePassed() ? (
|
||||||
<div className="govuk-warning-text noticebanner">
|
<div className="govuk-warning-text noticebanner">
|
||||||
<strong className="govuk-warning-text__text">
|
<strong className="govuk-warning-text__text">
|
||||||
@@ -641,6 +648,32 @@ const RepCompleteSubmit = (props) => {
|
|||||||
{t("myrepresentations:rep-wait-label")}
|
{t("myrepresentations:rep-wait-label")}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
) : ShowDocLinks ? (
|
||||||
|
<>
|
||||||
|
{" "}
|
||||||
|
<div className="govuk-warning-text ">
|
||||||
|
<span
|
||||||
|
className="govuk-warning-text__icon"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
!
|
||||||
|
</span>
|
||||||
|
<strong className="govuk-warning-text__text govuk-!-margin-top-2">
|
||||||
|
<span className="govuk-visually-hidden">
|
||||||
|
Notice
|
||||||
|
</span>
|
||||||
|
{t(
|
||||||
|
"myrepresentations:docsoffline-reps-label"
|
||||||
|
)}
|
||||||
|
{" "}
|
||||||
|
</strong>
|
||||||
|
</div>{" "}
|
||||||
|
<a className="govuk-link" href="/">
|
||||||
|
{t(
|
||||||
|
"myrepresentations:return-to-myportal-link"
|
||||||
|
)}
|
||||||
|
</a>
|
||||||
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<div className="govuk-form-group">
|
<div className="govuk-form-group">
|
||||||
|
|||||||
@@ -104,38 +104,6 @@ const CaseSummary = (props) => {
|
|||||||
? true
|
? true
|
||||||
: false;
|
: false;
|
||||||
|
|
||||||
let ShowDocLinks = false;
|
|
||||||
let checkShowDocLinks = docsOffline != false ? true : false;
|
|
||||||
|
|
||||||
const getDocLink = (docsOffline) => {
|
|
||||||
var startTime = docsOffline.split(",")[0];
|
|
||||||
var endTime = docsOffline.split(",")[1];
|
|
||||||
|
|
||||||
// console.log(startTime);
|
|
||||||
// console.log(endTime);
|
|
||||||
|
|
||||||
var currentDate = new Date();
|
|
||||||
|
|
||||||
var startDate = new Date(currentDate.getTime());
|
|
||||||
startDate.setHours(startTime.split(":")[0]);
|
|
||||||
startDate.setMinutes(startTime.split(":")[1]);
|
|
||||||
startDate.setSeconds(startTime.split(":")[2]);
|
|
||||||
|
|
||||||
var endDate = new Date(currentDate.getTime());
|
|
||||||
endDate.setHours(endTime.split(":")[0]);
|
|
||||||
endDate.setMinutes(endTime.split(":")[1]);
|
|
||||||
endDate.setSeconds(endTime.split(":")[2]);
|
|
||||||
|
|
||||||
// console.log(startDate);
|
|
||||||
// console.log(endDate);
|
|
||||||
// console.log(currentDate);
|
|
||||||
|
|
||||||
var valid = startDate < currentDate && endDate > currentDate;
|
|
||||||
ShowDocLinks = valid;
|
|
||||||
};
|
|
||||||
|
|
||||||
checkShowDocLinks && getDocLink(docsOffline);
|
|
||||||
|
|
||||||
const selectWatchedCase = (loggedInUser, incidentID, appealType) => {
|
const selectWatchedCase = (loggedInUser, incidentID, appealType) => {
|
||||||
let updateBody = {
|
let updateBody = {
|
||||||
"pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")",
|
"pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import useTranslation from "next-translate/useTranslation";
|
import useTranslation from "next-translate/useTranslation";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
import { getDocLink } from "../utils";
|
||||||
|
|
||||||
export default function MakeNewAppeal(props) {
|
export default function MakeNewAppeal(props) {
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
@@ -10,37 +11,7 @@ export default function MakeNewAppeal(props) {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { locale } = router;
|
const { locale } = router;
|
||||||
|
|
||||||
let ShowDocLinks = false;
|
let ShowDocLinks = getDocLink(docsOffline);
|
||||||
let checkShowDocLinks = docsOffline != false ? true : false;
|
|
||||||
|
|
||||||
const getDocLink = (docsOffline) => {
|
|
||||||
var startTime = docsOffline.split(",")[0];
|
|
||||||
var endTime = docsOffline.split(",")[1];
|
|
||||||
|
|
||||||
// console.log(startTime);
|
|
||||||
// console.log(endTime);
|
|
||||||
|
|
||||||
var currentDate = new Date();
|
|
||||||
|
|
||||||
var startDate = new Date(currentDate.getTime());
|
|
||||||
startDate.setHours(startTime.split(":")[0]);
|
|
||||||
startDate.setMinutes(startTime.split(":")[1]);
|
|
||||||
startDate.setSeconds(startTime.split(":")[2]);
|
|
||||||
|
|
||||||
var endDate = new Date(currentDate.getTime());
|
|
||||||
endDate.setHours(endTime.split(":")[0]);
|
|
||||||
endDate.setMinutes(endTime.split(":")[1]);
|
|
||||||
endDate.setSeconds(endTime.split(":")[2]);
|
|
||||||
|
|
||||||
// console.log(startDate);
|
|
||||||
// console.log(endDate);
|
|
||||||
// console.log(currentDate);
|
|
||||||
|
|
||||||
var valid = startDate < currentDate && endDate > currentDate;
|
|
||||||
ShowDocLinks = valid;
|
|
||||||
};
|
|
||||||
|
|
||||||
console.log("docsOffline", docsOffline, getDocLink(docsOffline));
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="card" id="new-appeal-card">
|
<div className="card" id="new-appeal-card">
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import {
|
|||||||
bytesToSize,
|
bytesToSize,
|
||||||
getThumbnailIconByExtension,
|
getThumbnailIconByExtension,
|
||||||
updateLinks,
|
updateLinks,
|
||||||
|
getDocLink,
|
||||||
} from "../utils";
|
} from "../utils";
|
||||||
|
|
||||||
let BuildCheckSection = (props) => {
|
let BuildCheckSection = (props) => {
|
||||||
@@ -39,6 +40,7 @@ let BuildCheckSection = (props) => {
|
|||||||
setCurrentSection,
|
setCurrentSection,
|
||||||
updateCurrentSection,
|
updateCurrentSection,
|
||||||
mandatoryFieldsData,
|
mandatoryFieldsData,
|
||||||
|
docsOffline,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const parser = new DOMParser();
|
const parser = new DOMParser();
|
||||||
@@ -180,6 +182,8 @@ let BuildCheckSection = (props) => {
|
|||||||
: setConfirmSections(false);
|
: setConfirmSections(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let ShowDocLinks = getDocLink(docsOffline);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="govuk-grid-row" key={1222}>
|
<div className="govuk-grid-row" key={1222}>
|
||||||
<div className="govuk-grid-column-full">
|
<div className="govuk-grid-column-full">
|
||||||
@@ -327,8 +331,35 @@ let BuildCheckSection = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="govuk-button-group">
|
<div className="govuk-button-group">
|
||||||
|
{ShowDocLinks ? (
|
||||||
|
<>
|
||||||
|
<div className="govuk-warning-text ">
|
||||||
|
<span
|
||||||
|
className="govuk-warning-text__icon"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
!
|
||||||
|
</span>
|
||||||
|
<strong className="govuk-warning-text__text govuk-!-margin-top-2">
|
||||||
|
<span className="govuk-visually-hidden">
|
||||||
|
Notice
|
||||||
|
</span>
|
||||||
|
{t(
|
||||||
|
"myportal:docsoffline-newappeal-label"
|
||||||
|
)}
|
||||||
|
{" "}
|
||||||
|
</strong>
|
||||||
|
</div>{" "}
|
||||||
|
<a className="govuk-link" href="/">
|
||||||
|
{t("newappeal:return-to-myportal-link")}
|
||||||
|
</a>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
<a
|
<a
|
||||||
disabled={confirmSections ? false : true}
|
disabled={
|
||||||
|
confirmSections ? false : true
|
||||||
|
}
|
||||||
className="govuk-button"
|
className="govuk-button"
|
||||||
data-module="govuk-button"
|
data-module="govuk-button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -340,10 +371,14 @@ let BuildCheckSection = (props) => {
|
|||||||
<a
|
<a
|
||||||
className="govuk-link"
|
className="govuk-link"
|
||||||
href="#"
|
href="#"
|
||||||
onClick={() => setCurrentSection(sectionCount)}
|
onClick={() =>
|
||||||
|
setCurrentSection(sectionCount)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{t("common:back-link")}
|
{t("common:back-link")}
|
||||||
</a>
|
</a>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ const CaseRepresentation = (props) => {
|
|||||||
props.setShowQuestionnaireSection
|
props.setShowQuestionnaireSection
|
||||||
}
|
}
|
||||||
setCurrentReference={props.setCurrentReference}
|
setCurrentReference={props.setCurrentReference}
|
||||||
|
docsOffline={props.docsOffline}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -797,3 +797,30 @@ export const whichRepType = (props) => {
|
|||||||
|
|
||||||
return repType;
|
return repType;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getDocLink = (docsOffline) => {
|
||||||
|
var startTime = docsOffline.split(",")[0];
|
||||||
|
var endTime = docsOffline.split(",")[1];
|
||||||
|
|
||||||
|
// console.log(startTime);
|
||||||
|
// console.log(endTime);
|
||||||
|
|
||||||
|
var currentDate = new Date();
|
||||||
|
|
||||||
|
var startDate = new Date(currentDate.getTime());
|
||||||
|
startDate.setHours(startTime.split(":")[0]);
|
||||||
|
startDate.setMinutes(startTime.split(":")[1]);
|
||||||
|
startDate.setSeconds(startTime.split(":")[2]);
|
||||||
|
|
||||||
|
var endDate = new Date(currentDate.getTime());
|
||||||
|
endDate.setHours(endTime.split(":")[0]);
|
||||||
|
endDate.setMinutes(endTime.split(":")[1]);
|
||||||
|
endDate.setSeconds(endTime.split(":")[2]);
|
||||||
|
|
||||||
|
// console.log(startDate);
|
||||||
|
// console.log(endDate);
|
||||||
|
// console.log(currentDate);
|
||||||
|
|
||||||
|
var valid = startDate < currentDate && endDate > currentDate;
|
||||||
|
return valid;
|
||||||
|
};
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ module.exports = {
|
|||||||
"/myportal/case/id/[incident]": ["case", "home"],
|
"/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"],
|
||||||
"/myportal/[appealtypes]": ["newappeal", "home"],
|
"/myportal/[appealtypes]": ["newappeal", "home", "myportal"],
|
||||||
"/newappeal": ["newappeal", "home"],
|
"/newappeal": ["newappeal", "home"],
|
||||||
"/newappeal/*": ["newappeal", "home"],
|
"/newappeal/*": ["newappeal", "home"],
|
||||||
"/newappeal/[appealtypes]": ["newappeal", "home"],
|
"/newappeal/[appealtypes]": ["newappeal", "home"],
|
||||||
|
|||||||
@@ -252,5 +252,7 @@
|
|||||||
"rep-period-passed-heading": "Mae'r cyfnod cynrychioli wedi mynd heibio",
|
"rep-period-passed-heading": "Mae'r cyfnod cynrychioli wedi mynd heibio",
|
||||||
"rep-period-notice-label": "Aeth y dyddiad dyledus ar gyfer y sylw hwn heibio. Ni allwch gyflwyno'r wybodaeth a ddarparwyd gennych mwyach.",
|
"rep-period-notice-label": "Aeth y dyddiad dyledus ar gyfer y sylw hwn heibio. Ni allwch gyflwyno'r wybodaeth a ddarparwyd gennych mwyach.",
|
||||||
"representation-onbehalfof-hint": " e.e. \"Perchnogion Rhifau 1-5 Stryd Fawr\", neu \"Mr a Mrs Smith\" neu \"ysgutorion ystâd Mr Evans\"",
|
"representation-onbehalfof-hint": " e.e. \"Perchnogion Rhifau 1-5 Stryd Fawr\", neu \"Mr a Mrs Smith\" neu \"ysgutorion ystâd Mr Evans\"",
|
||||||
"representation-onbehalfof-label": "Rhowch enw'r cwmni/grŵp/sefydliad"
|
"representation-onbehalfof-label": "Rhowch enw'r cwmni/grŵp/sefydliad",
|
||||||
|
"docsoffline-reps-label": "Oherwydd gwaith cynnal a chadw system, ni allwn dderbyn sylwadau ar hyn o bryd. Rhowch gynnig arall arni yn nes ymlaen.",
|
||||||
|
"return-to-myportal-link": "Dychwelyd i Fy Mhorth"
|
||||||
}
|
}
|
||||||
@@ -120,5 +120,6 @@
|
|||||||
"new-appeal-finalising-heading": "Cwblhau cyflwyniad eich apêl",
|
"new-appeal-finalising-heading": "Cwblhau cyflwyniad eich apêl",
|
||||||
"new-appeal-finalising-label": "Wrthi'n uwchlwytho ffeiliau ar hyn o bryd a chwblhau eich cyflwyniad apêl",
|
"new-appeal-finalising-label": "Wrthi'n uwchlwytho ffeiliau ar hyn o bryd a chwblhau eich cyflwyniad apêl",
|
||||||
"new-appeal-wait-label": "Arhoswch os gwelwch yn dda",
|
"new-appeal-wait-label": "Arhoswch os gwelwch yn dda",
|
||||||
"invalid-email-address-errormsg": "Cyfeiriad e-bost annilys"
|
"invalid-email-address-errormsg": "Cyfeiriad e-bost annilys",
|
||||||
|
"return-to-myportal-link": "Dychwelyd i Fy Mhorth"
|
||||||
}
|
}
|
||||||
@@ -252,5 +252,7 @@
|
|||||||
"rep-period-passed-heading": "Representation period has passed",
|
"rep-period-passed-heading": "Representation period has passed",
|
||||||
"rep-period-notice-label": "The due date for this representation passed. You can no longer submit the information you have provided.",
|
"rep-period-notice-label": "The due date for this representation passed. You can no longer submit the information you have provided.",
|
||||||
"representation-onbehalfof-hint": "e.g. \"Owners of Numbers 1-5 High Street\", or \"Mr and Mrs Smith\" or \"The executors of Mr Evans' estate\"",
|
"representation-onbehalfof-hint": "e.g. \"Owners of Numbers 1-5 High Street\", or \"Mr and Mrs Smith\" or \"The executors of Mr Evans' estate\"",
|
||||||
"representation-onbehalfof-label": "Enter the name of the company/group/organisation"
|
"representation-onbehalfof-label": "Enter the name of the company/group/organisation",
|
||||||
|
"docsoffline-reps-label": "Due to system maintenance, we are unable to accept representations at this time. Please try again later.",
|
||||||
|
"return-to-myportal-link": "Return to My Portal"
|
||||||
}
|
}
|
||||||
@@ -120,5 +120,6 @@
|
|||||||
"new-appeal-finalising-heading": "Finalising your appeal submission",
|
"new-appeal-finalising-heading": "Finalising your appeal submission",
|
||||||
"new-appeal-finalising-label": "Currently uploading files and finalising your appeal submission",
|
"new-appeal-finalising-label": "Currently uploading files and finalising your appeal submission",
|
||||||
"new-appeal-wait-label": "Please wait",
|
"new-appeal-wait-label": "Please wait",
|
||||||
"invalid-email-address-errormsg": "Invalid email address"
|
"invalid-email-address-errormsg": "Invalid email address",
|
||||||
|
"return-to-myportal-link": "Return to My Portal"
|
||||||
}
|
}
|
||||||
+429
-316
@@ -1,347 +1,467 @@
|
|||||||
import fs from "fs";
|
// import fs from "fs";
|
||||||
import { JSONPath as jsonpath } from "jsonpath-plus";
|
// import { JSONPath as jsonpath } from "jsonpath-plus";
|
||||||
import useTranslation from "next-translate/useTranslation";
|
// import useTranslation from "next-translate/useTranslation";
|
||||||
import Head from "next/head";
|
// import Head from "next/head";
|
||||||
import { useRouter } from "next/router";
|
// import { useRouter } from "next/router";
|
||||||
import { useEffect } from "react";
|
// import { useEffect } from "react";
|
||||||
import { connect } from "react-redux";
|
// import { connect } from "react-redux";
|
||||||
import xpath from "xpath";
|
// import xpath from "xpath";
|
||||||
import {
|
// import {
|
||||||
getAppealsTypesForNewAppeal,
|
// getAppealsTypesForNewAppeal,
|
||||||
getAwaitingSubmissionFromBlob,
|
// getAwaitingSubmissionFromBlob,
|
||||||
getFilesFromBlob,
|
// getFilesFromBlob,
|
||||||
getIP,
|
// getIP,
|
||||||
getMandatoryFields,
|
// getMandatoryFields,
|
||||||
getPickLists,
|
// getPickLists,
|
||||||
getProgressFromBlob,
|
// getProgressFromBlob,
|
||||||
getPersonalAccount,
|
// getPersonalAccount,
|
||||||
} from "../../actions";
|
// } from "../../actions";
|
||||||
import Breadcrumbs from "../../components/breadcrumbs";
|
// import Breadcrumbs from "../../components/breadcrumbs";
|
||||||
import CookieBanner from "../../components/cookieBanner";
|
// import CookieBanner from "../../components/cookieBanner";
|
||||||
import Footer from "../../components/footer";
|
// import Footer from "../../components/footer";
|
||||||
import Header from "../../components/header";
|
// import Header from "../../components/header";
|
||||||
import BuildCheckSection from "../../components/newappeal/buildchecksection";
|
// import BuildCheckSection from "../../components/newappeal/buildchecksection";
|
||||||
import BuildSection from "../../components/newappeal/buildsection";
|
// import BuildSection from "../../components/newappeal/buildsection";
|
||||||
import CompleteAppeal from "../../components/newappeal/complete";
|
// import CompleteAppeal from "../../components/newappeal/complete";
|
||||||
import TimeOut from "../../components/timeout";
|
// import TimeOut from "../../components/timeout";
|
||||||
|
|
||||||
|
// import { getSession } from "next-auth/react";
|
||||||
|
// import {
|
||||||
|
// setContainerID,
|
||||||
|
// setLoggedInUserEmail,
|
||||||
|
// setLoggedInUserId,
|
||||||
|
// setAccountDetails,
|
||||||
|
// } from "../../store/accountDetails/action";
|
||||||
|
// import {
|
||||||
|
// setAppealLPA,
|
||||||
|
// setAppealType,
|
||||||
|
// setAppealTypeID,
|
||||||
|
// setAppealTypeTitle,
|
||||||
|
// setCaseReference,
|
||||||
|
// setFilesForAppeal,
|
||||||
|
// } from "../../store/appealType/action";
|
||||||
|
// import {
|
||||||
|
// setAwaitingSubmissionDetails,
|
||||||
|
// setAwaitingSubmissionFromBlob,
|
||||||
|
// } from "../../store/awaitingSubmission/action";
|
||||||
|
// import { setCurrentView, setLocale } from "../../store/currentView/action";
|
||||||
|
// import { setForm } from "../../store/formData/action";
|
||||||
|
// import { wrapper } from "../../store/store";
|
||||||
|
// import ServiceBanner from "../../components/myportal/servicebanner";
|
||||||
|
|
||||||
|
// let Home = (props) => {
|
||||||
|
// const { footerLinks, pages, formData } = props;
|
||||||
|
// let { t, lang } = useTranslation();
|
||||||
|
|
||||||
|
// const router = useRouter();
|
||||||
|
// const { locale } = router;
|
||||||
|
// const { appealtypes } = router.query;
|
||||||
|
|
||||||
|
// useEffect(() => {
|
||||||
|
// //setFormTitle(formTitle);
|
||||||
|
// setCaseReference(router.query.casereference);
|
||||||
|
// }, []); // eslint-disable-line react-hooks/exhaustive-deps
|
||||||
|
|
||||||
|
// const formXML = props.formData.formData;
|
||||||
|
// const parser = new DOMParser();
|
||||||
|
// var doc = parser.parseFromString(formXML, "text/xml");
|
||||||
|
// var titles = xpath.select(
|
||||||
|
// "//form/tabs/tab[*]/labels/label[@description]/@description",
|
||||||
|
// doc
|
||||||
|
// );
|
||||||
|
// var sectionCount = xpath.select("/form/tabs/tab[*]", doc);
|
||||||
|
// sectionCount = sectionCount.length;
|
||||||
|
|
||||||
|
// var tabs = xpath.select("//form/tabs/tab[*]", doc);
|
||||||
|
|
||||||
|
// let optionsStr = props.appealType.appealTypeOptions.value || {};
|
||||||
|
|
||||||
|
// let selectedObj = jsonpath({
|
||||||
|
// path: "$..[?(@ && @.attributevalue=='" + router.query.apt + "')]",
|
||||||
|
// json: optionsStr,
|
||||||
|
// eval: true,
|
||||||
|
// });
|
||||||
|
|
||||||
|
// //let optionsTitleObj = [];
|
||||||
|
|
||||||
|
// //const optionsTitleObj = selectedObj.reduce(
|
||||||
|
// // (obj, arrValue) => (
|
||||||
|
// // (obj[arrValue] = arrValue
|
||||||
|
// // .replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
|
||||||
|
// // .toLowerCase()
|
||||||
|
// // .slice(0, 39)),
|
||||||
|
// // obj
|
||||||
|
// // ),
|
||||||
|
// // {}
|
||||||
|
// // );
|
||||||
|
|
||||||
|
// const formTitle = selectedObj[0].value;
|
||||||
|
|
||||||
|
// const { onSubmit } = props;
|
||||||
|
|
||||||
|
// return (
|
||||||
|
// <div>
|
||||||
|
// <Head>
|
||||||
|
// <title>
|
||||||
|
// {t("newappeal:page-title")} - {t("common:service-name")}
|
||||||
|
// </title>
|
||||||
|
// <>
|
||||||
|
// <link
|
||||||
|
// rel="canonical"
|
||||||
|
// href={t("common:gov-wales-link") + router.asPath}
|
||||||
|
// />
|
||||||
|
// <meta
|
||||||
|
// key="og:locale"
|
||||||
|
// property="og:locale"
|
||||||
|
// content={router.locale}
|
||||||
|
// />
|
||||||
|
// {/* If they have a Twitter Handle, include the meta details below */}
|
||||||
|
// <meta
|
||||||
|
// key="og:site_name"
|
||||||
|
// property="og:site_name"
|
||||||
|
// content={t("common:service-name")}
|
||||||
|
// />
|
||||||
|
// <meta
|
||||||
|
// key="twitter:site"
|
||||||
|
// property="twitter:site"
|
||||||
|
// content="@UKGovWales"
|
||||||
|
// />
|
||||||
|
|
||||||
|
// <meta
|
||||||
|
// name="description"
|
||||||
|
// content={t("common:service-description")}
|
||||||
|
// />
|
||||||
|
// <meta
|
||||||
|
// property="og:site_name"
|
||||||
|
// content={t("common:gov-wales-label")}
|
||||||
|
// />
|
||||||
|
// <meta
|
||||||
|
// property="og:title"
|
||||||
|
// content={t("newappeal:page-title")}
|
||||||
|
// />
|
||||||
|
// <meta
|
||||||
|
// property="og:description"
|
||||||
|
// content={t("common:service-description")}
|
||||||
|
// />
|
||||||
|
// <meta property="og:type" content="website" />
|
||||||
|
// <meta
|
||||||
|
// property="og:url"
|
||||||
|
// content={t("common:gov-wales-link")}
|
||||||
|
// />
|
||||||
|
// <meta
|
||||||
|
// property="og:image"
|
||||||
|
// content="https://gov.wales/themes/custom/govwales/images/content/og-global-1200.png"
|
||||||
|
// />
|
||||||
|
// <meta name="twitter:card" content="summary" />
|
||||||
|
// <meta
|
||||||
|
// name="twitter:title"
|
||||||
|
// content={t("common:gov-wales-label")}
|
||||||
|
// />
|
||||||
|
// <meta
|
||||||
|
// name="twitter:url"
|
||||||
|
// content={t("common:gov-wales-link") + router.asPath}
|
||||||
|
// />
|
||||||
|
// <meta
|
||||||
|
// name="twitter:image"
|
||||||
|
// content="https://gov.wales/themes/custom/govwales/images/content/og-global-120.png"
|
||||||
|
// />
|
||||||
|
// </>
|
||||||
|
// </Head>
|
||||||
|
// <div id="page_wrapper">
|
||||||
|
// <CookieBanner />
|
||||||
|
// <Header />
|
||||||
|
|
||||||
|
// <div className="govuk-width-container">
|
||||||
|
// <Breadcrumbs slug={appealtypes} formTitle={formTitle} />
|
||||||
|
// <ServiceBanner props={props} />
|
||||||
|
// <main
|
||||||
|
// className="govuk-main-wrapper--auto-spacing"
|
||||||
|
// id="main-content"
|
||||||
|
// role="main"
|
||||||
|
// >
|
||||||
|
// {props.appealType.currentSection == 9999 ? (
|
||||||
|
// <CompleteAppeal props={props} />
|
||||||
|
// ) : props.appealType.currentSection ==
|
||||||
|
// sectionCount + 1 ? (
|
||||||
|
// <BuildCheckSection
|
||||||
|
// formXML={formXML}
|
||||||
|
// sectionCount={sectionCount}
|
||||||
|
// onSubmit={onSubmit}
|
||||||
|
// formTitle={formTitle}
|
||||||
|
// appealType={props.appealType}
|
||||||
|
// props={props}
|
||||||
|
// key={1}
|
||||||
|
// mandatoryFieldsData={
|
||||||
|
// props.formData.mandatoryFieldsData
|
||||||
|
// }
|
||||||
|
// />
|
||||||
|
// ) : (
|
||||||
|
// <>
|
||||||
|
// <BuildSection
|
||||||
|
// formXML={formXML}
|
||||||
|
// sectionCount={sectionCount}
|
||||||
|
// onSubmit={onSubmit}
|
||||||
|
// formTitle={formTitle}
|
||||||
|
// mandatoryFieldsData={
|
||||||
|
// props.formData.mandatoryFieldsData
|
||||||
|
// }
|
||||||
|
// props={props}
|
||||||
|
// />
|
||||||
|
// </>
|
||||||
|
// )}
|
||||||
|
// </main>
|
||||||
|
// </div>
|
||||||
|
// <Footer footerLinks={footerLinks} ticketnumber={props} />
|
||||||
|
// </div>
|
||||||
|
// <TimeOut />
|
||||||
|
// </div>
|
||||||
|
// );
|
||||||
|
// };
|
||||||
|
|
||||||
|
// export const getServerSideProps = wrapper.getServerSideProps(
|
||||||
|
// (store) => async (ctx) => {
|
||||||
|
// const { query, req, res } = ctx;
|
||||||
|
// getIP(req);
|
||||||
|
// const { cookies } = req;
|
||||||
|
|
||||||
|
// console.log("the query", query);
|
||||||
|
// let loggedInUser = cookies.pinsUser;
|
||||||
|
|
||||||
|
// let thisSession = await getSession(ctx);
|
||||||
|
|
||||||
|
// if (!thisSession) {
|
||||||
|
// console.log("not has sesssion.......");
|
||||||
|
// return {
|
||||||
|
// redirect: {
|
||||||
|
// destination: "/auth/signin",
|
||||||
|
// permanent: false,
|
||||||
|
// },
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
|
||||||
|
// console.log(ctx.locale);
|
||||||
|
// store.dispatch(setLocale(ctx.locale));
|
||||||
|
|
||||||
|
// let loggedInUserIdent = thisSession.user.id;
|
||||||
|
// let loggedInUserEmail = thisSession.user.email;
|
||||||
|
|
||||||
|
// //console.log("logged ident:", loggedInUserIdent);
|
||||||
|
|
||||||
|
// console.log("which appeal: ", query.appealtypes);
|
||||||
|
|
||||||
|
// const accountDetails = await getPersonalAccount(loggedInUser);
|
||||||
|
|
||||||
|
// const [appealTypeData, mandatoryFieldsData, pickListData, blobList] =
|
||||||
|
// await Promise.all([
|
||||||
|
// await getAppealsTypesForNewAppeal(),
|
||||||
|
// await getMandatoryFields(query.appealtypes),
|
||||||
|
// await getPickLists(query.appealtypes),
|
||||||
|
// await getFilesFromBlob(loggedInUserIdent, query.casereference),
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// const blobProgress = await getProgressFromBlob(
|
||||||
|
// loggedInUserIdent,
|
||||||
|
// query.casereference
|
||||||
|
// );
|
||||||
|
|
||||||
|
// //console.log("/////////\nappeal type data:", appealTypeData);
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Removed to make progress from Blob not CRM
|
||||||
|
// //
|
||||||
|
|
||||||
|
// // let searchResultsObj = await getPartSavedAppeal(query.casereference);
|
||||||
|
// // //console.log("eeee:", searchResultsObj);
|
||||||
|
// // let searchDetailsObj = await getPartSavedDetails(searchResultsObj);
|
||||||
|
|
||||||
|
// // searchDetailsObj = searchDetailsObj[0].value[0];
|
||||||
|
|
||||||
|
// // Object.keys(searchDetailsObj).forEach((key) => {
|
||||||
|
// // if (searchDetailsObj[key] === null) {
|
||||||
|
// // delete searchDetailsObj[key];
|
||||||
|
// // }
|
||||||
|
// // });
|
||||||
|
|
||||||
|
// //console.log("appeal:", searchDetailsObj);
|
||||||
|
|
||||||
|
// // searchDetailsObj = JSON.stringify(searchDetailsObj);
|
||||||
|
// // searchDetailsObj = searchDetailsObj.replace(/:true/gm, `:"Yes"`);
|
||||||
|
// // searchDetailsObj = searchDetailsObj.replace(/:false/gm, `:"No"`);
|
||||||
|
// // searchDetailsObj = JSON.parse(searchDetailsObj);
|
||||||
|
|
||||||
|
// let caseReference = {};
|
||||||
|
|
||||||
|
// caseReference.ticketnumber = query.casereference;
|
||||||
|
// caseReference.incidentid = query.inid;
|
||||||
|
// caseReference.caseDetails = blobProgress; //searchDetailsObj;
|
||||||
|
|
||||||
|
// var path = require("path");
|
||||||
|
// const configDirectory = path.resolve(process.cwd(), "data/formsxml");
|
||||||
|
// var xmlStr = fs.readFileSync(
|
||||||
|
// path.join(configDirectory, query.appealtypes + ".xml"),
|
||||||
|
// "utf8"
|
||||||
|
// );
|
||||||
|
|
||||||
|
// xmlStr = xmlStr.replace(/\t/g, "");
|
||||||
|
// xmlStr = xmlStr.replace(/\n/g, "");
|
||||||
|
// xmlStr = xmlStr.replace(/> <"/g, "><");
|
||||||
|
// xmlStr = xmlStr.toString();
|
||||||
|
|
||||||
|
// if (query.hasOwnProperty("key")) {
|
||||||
|
// const awaitingSubmissionFromBlob =
|
||||||
|
// await getAwaitingSubmissionFromBlob(thisSession.user.id);
|
||||||
|
|
||||||
|
// store.dispatch(
|
||||||
|
// setAwaitingSubmissionFromBlob(awaitingSubmissionFromBlob)
|
||||||
|
// );
|
||||||
|
|
||||||
|
// store.dispatch(
|
||||||
|
// setAwaitingSubmissionDetails(awaitingSubmissionFromBlob)
|
||||||
|
// );
|
||||||
|
// store.dispatch(
|
||||||
|
// setCurrentView({
|
||||||
|
// "viewName": "Awaiting Submission",
|
||||||
|
// "viewKey": "awaitingSubmissionDetails",
|
||||||
|
// })
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
// store.dispatch(setLoggedInUserId(loggedInUser));
|
||||||
|
// store.dispatch(setLoggedInUserEmail(loggedInUserEmail));
|
||||||
|
// store.dispatch(setAppealLPA(query.lpa));
|
||||||
|
// store.dispatch(setAppealTypeID(query.apt));
|
||||||
|
// store.dispatch(setCaseReference(caseReference));
|
||||||
|
// store.dispatch(setForm(xmlStr, mandatoryFieldsData, pickListData));
|
||||||
|
// store.dispatch(setAppealType(appealTypeData));
|
||||||
|
// store.dispatch(setContainerID(thisSession.user.id));
|
||||||
|
// store.dispatch(setAccountDetails(accountDetails));
|
||||||
|
|
||||||
|
// store.dispatch(setFilesForAppeal(blobList));
|
||||||
|
|
||||||
|
// return {
|
||||||
|
// props: { url: process.env.NEXTAUTH_URL },
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
|
||||||
|
// const mapStateToProps = (state) => {
|
||||||
|
// return {
|
||||||
|
// search: state.search,
|
||||||
|
// searchResultsObj: state.searchResultsObj,
|
||||||
|
// formData: state.formData,
|
||||||
|
// appealType: state.appealType,
|
||||||
|
// form: state.form,
|
||||||
|
// accountDetails: state.accountDetails,
|
||||||
|
// awaitingSubmission: state.awaitingSubmission,
|
||||||
|
// currentView: state.currentView,
|
||||||
|
// initialValues: state.appealType.caseReference.caseDetails,
|
||||||
|
// };
|
||||||
|
// };
|
||||||
|
|
||||||
|
// const mapDispatchToProps = (dispatch) => {
|
||||||
|
// return {
|
||||||
|
// setFormTitle: (title) => {
|
||||||
|
// dispatch(setAppealTypeTitle(title));
|
||||||
|
// },
|
||||||
|
// setCaseReference: (refno) => {
|
||||||
|
// dispatch(setCaseReference(refno));
|
||||||
|
// },
|
||||||
|
// setFilesForAppeal: (blobList) => {
|
||||||
|
// dispatch(setFilesForAppeal(blobList));
|
||||||
|
// },
|
||||||
|
// };
|
||||||
|
// };
|
||||||
|
|
||||||
|
// export default connect(mapStateToProps, mapDispatchToProps)(Home);
|
||||||
|
|
||||||
|
// pages/myportal/[appealtypes].js
|
||||||
|
import { JSONPath as jsonpath } from "jsonpath-plus";
|
||||||
|
import xpath from "xpath";
|
||||||
|
import { useMemo } from "react";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
import { getSession } from "next-auth/react";
|
|
||||||
import {
|
|
||||||
setContainerID,
|
|
||||||
setLoggedInUserEmail,
|
|
||||||
setLoggedInUserId,
|
|
||||||
setAccountDetails,
|
|
||||||
} from "../../store/accountDetails/action";
|
|
||||||
import {
|
|
||||||
setAppealLPA,
|
|
||||||
setAppealType,
|
|
||||||
setAppealTypeID,
|
|
||||||
setAppealTypeTitle,
|
|
||||||
setCaseReference,
|
|
||||||
setFilesForAppeal,
|
|
||||||
} from "../../store/appealType/action";
|
|
||||||
import {
|
|
||||||
setAwaitingSubmissionDetails,
|
|
||||||
setAwaitingSubmissionFromBlob,
|
|
||||||
} from "../../store/awaitingSubmission/action";
|
|
||||||
import { setCurrentView, setLocale } from "../../store/currentView/action";
|
|
||||||
import { setForm } from "../../store/formData/action";
|
|
||||||
import { wrapper } from "../../store/store";
|
import { wrapper } from "../../store/store";
|
||||||
import ServiceBanner from "../../components/myportal/servicebanner";
|
|
||||||
|
import NewAppealPageShell from "../../components/newappeal/newAppealPageShell";
|
||||||
|
import NewAppealFlow from "../../components/newappeal/newAppealFlow";
|
||||||
|
|
||||||
|
import { loadMyPortalAppealPage } from "../../lib/myportal/loadMyPortalAppealPage";
|
||||||
|
import { hydrateMyPortalAppealStore } from "../../lib/myportal/hydrateMyPortalAppealStore";
|
||||||
|
|
||||||
let Home = (props) => {
|
let Home = (props) => {
|
||||||
const { footerLinks, pages, formData } = props;
|
|
||||||
let { t, lang } = useTranslation();
|
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { locale } = router;
|
|
||||||
const { appealtypes } = router.query;
|
const { appealtypes } = router.query;
|
||||||
|
|
||||||
useEffect(() => {
|
const formXML = props.formData?.formData;
|
||||||
//setFormTitle(formTitle);
|
|
||||||
setCaseReference(router.query.casereference);
|
|
||||||
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
||||||
|
|
||||||
const formXML = props.formData.formData;
|
// Memoise XML parsing
|
||||||
|
const { sectionCount } = useMemo(() => {
|
||||||
|
if (!formXML) return { sectionCount: 0 };
|
||||||
const parser = new DOMParser();
|
const parser = new DOMParser();
|
||||||
var doc = parser.parseFromString(formXML, "text/xml");
|
const doc = parser.parseFromString(formXML, "text/xml");
|
||||||
var titles = xpath.select(
|
const count = xpath.select("/form/tabs/tab[*]", doc)?.length || 0;
|
||||||
"//form/tabs/tab[*]/labels/label[@description]/@description",
|
return { sectionCount: count };
|
||||||
doc
|
}, [formXML]);
|
||||||
);
|
|
||||||
var sectionCount = xpath.select("/form/tabs/tab[*]", doc);
|
|
||||||
sectionCount = sectionCount.length;
|
|
||||||
|
|
||||||
var tabs = xpath.select("//form/tabs/tab[*]", doc);
|
// Safe formTitle resolution
|
||||||
|
const formTitle = useMemo(() => {
|
||||||
|
const optionsStr = props.appealType?.appealTypeOptions?.value;
|
||||||
|
const apt = router.query.apt;
|
||||||
|
|
||||||
let optionsStr = props.appealType.appealTypeOptions.value || {};
|
if (!optionsStr || !apt) return "New appeal";
|
||||||
|
|
||||||
let selectedObj = jsonpath({
|
const selectedObj = jsonpath({
|
||||||
path: "$..[?(@ && @.attributevalue=='" + router.query.apt + "')]",
|
path: "$..[?(@ && @.attributevalue=='" + apt + "')]",
|
||||||
json: optionsStr,
|
json: optionsStr,
|
||||||
eval: true,
|
eval: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
//let optionsTitleObj = [];
|
return selectedObj?.[0]?.value || "New appeal";
|
||||||
|
}, [props.appealType?.appealTypeOptions?.value, router.query.apt]);
|
||||||
//const optionsTitleObj = selectedObj.reduce(
|
|
||||||
// (obj, arrValue) => (
|
|
||||||
// (obj[arrValue] = arrValue
|
|
||||||
// .replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
|
|
||||||
// .toLowerCase()
|
|
||||||
// .slice(0, 39)),
|
|
||||||
// obj
|
|
||||||
// ),
|
|
||||||
// {}
|
|
||||||
// );
|
|
||||||
|
|
||||||
const formTitle = selectedObj[0].value;
|
|
||||||
|
|
||||||
|
const { footerLinks } = props;
|
||||||
const { onSubmit } = props;
|
const { onSubmit } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<NewAppealPageShell
|
||||||
<Head>
|
appealtypes={appealtypes}
|
||||||
<title>
|
formTitle={formTitle}
|
||||||
{t("newappeal:page-title")} - {t("common:service-name")}
|
footerLinks={footerLinks}
|
||||||
</title>
|
propsForFooter={props}
|
||||||
<>
|
propsForServiceBanner={props}
|
||||||
<link
|
|
||||||
rel="canonical"
|
|
||||||
href={t("common:gov-wales-link") + router.asPath}
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
key="og:locale"
|
|
||||||
property="og:locale"
|
|
||||||
content={router.locale}
|
|
||||||
/>
|
|
||||||
{/* If they have a Twitter Handle, include the meta details below */}
|
|
||||||
<meta
|
|
||||||
key="og:site_name"
|
|
||||||
property="og:site_name"
|
|
||||||
content={t("common:service-name")}
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
key="twitter:site"
|
|
||||||
property="twitter:site"
|
|
||||||
content="@UKGovWales"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<meta
|
|
||||||
name="description"
|
|
||||||
content={t("common:service-description")}
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
property="og:site_name"
|
|
||||||
content={t("common:gov-wales-label")}
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
property="og:title"
|
|
||||||
content={t("newappeal:page-title")}
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
property="og:description"
|
|
||||||
content={t("common:service-description")}
|
|
||||||
/>
|
|
||||||
<meta property="og:type" content="website" />
|
|
||||||
<meta
|
|
||||||
property="og:url"
|
|
||||||
content={t("common:gov-wales-link")}
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
property="og:image"
|
|
||||||
content="https://gov.wales/themes/custom/govwales/images/content/og-global-1200.png"
|
|
||||||
/>
|
|
||||||
<meta name="twitter:card" content="summary" />
|
|
||||||
<meta
|
|
||||||
name="twitter:title"
|
|
||||||
content={t("common:gov-wales-label")}
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
name="twitter:url"
|
|
||||||
content={t("common:gov-wales-link") + router.asPath}
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
name="twitter:image"
|
|
||||||
content="https://gov.wales/themes/custom/govwales/images/content/og-global-120.png"
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
</Head>
|
|
||||||
<div id="page_wrapper">
|
|
||||||
<CookieBanner />
|
|
||||||
<Header />
|
|
||||||
|
|
||||||
<div className="govuk-width-container">
|
|
||||||
<Breadcrumbs slug={appealtypes} formTitle={formTitle} />
|
|
||||||
<ServiceBanner props={props} />
|
|
||||||
<main
|
|
||||||
className="govuk-main-wrapper--auto-spacing"
|
|
||||||
id="main-content"
|
|
||||||
role="main"
|
|
||||||
>
|
>
|
||||||
{props.appealType.currentSection == 9999 ? (
|
<NewAppealFlow
|
||||||
<CompleteAppeal props={props} />
|
|
||||||
) : props.appealType.currentSection ==
|
|
||||||
sectionCount + 1 ? (
|
|
||||||
<BuildCheckSection
|
|
||||||
formXML={formXML}
|
formXML={formXML}
|
||||||
sectionCount={sectionCount}
|
sectionCount={sectionCount}
|
||||||
|
currentSection={props.appealType?.currentSection}
|
||||||
onSubmit={onSubmit}
|
onSubmit={onSubmit}
|
||||||
formTitle={formTitle}
|
formTitle={formTitle}
|
||||||
appealType={props.appealType}
|
mandatoryFieldsData={props.formData?.mandatoryFieldsData}
|
||||||
props={props}
|
propsForChildren={props}
|
||||||
key={1}
|
docsOffline={props.docsOffline}
|
||||||
mandatoryFieldsData={
|
|
||||||
props.formData.mandatoryFieldsData
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
) : (
|
</NewAppealPageShell>
|
||||||
<>
|
|
||||||
<BuildSection
|
|
||||||
formXML={formXML}
|
|
||||||
sectionCount={sectionCount}
|
|
||||||
onSubmit={onSubmit}
|
|
||||||
formTitle={formTitle}
|
|
||||||
mandatoryFieldsData={
|
|
||||||
props.formData.mandatoryFieldsData
|
|
||||||
}
|
|
||||||
props={props}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</main>
|
|
||||||
</div>
|
|
||||||
<Footer footerLinks={footerLinks} ticketnumber={props} />
|
|
||||||
</div>
|
|
||||||
<TimeOut />
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getServerSideProps = wrapper.getServerSideProps(
|
export const getServerSideProps = wrapper.getServerSideProps(
|
||||||
(store) => async (ctx) => {
|
(store) => async (ctx) => {
|
||||||
const { query, req, res } = ctx;
|
const result = await loadMyPortalAppealPage(ctx);
|
||||||
getIP(req);
|
|
||||||
const { cookies } = req;
|
|
||||||
|
|
||||||
console.log("the query", query);
|
if (result?.redirect) {
|
||||||
let loggedInUser = cookies.pinsUser;
|
return { redirect: result.redirect };
|
||||||
|
}
|
||||||
|
|
||||||
let thisSession = await getSession(ctx);
|
hydrateMyPortalAppealStore(store, ctx, result);
|
||||||
|
|
||||||
if (!thisSession) {
|
|
||||||
console.log("not has sesssion.......");
|
|
||||||
return {
|
return {
|
||||||
redirect: {
|
props: {
|
||||||
destination: "/auth/signin",
|
url: process.env.NEXTAUTH_URL,
|
||||||
permanent: false,
|
docsOffline: process.env.DOCAPI_OFFLINE || false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(ctx.locale);
|
|
||||||
store.dispatch(setLocale(ctx.locale));
|
|
||||||
|
|
||||||
let loggedInUserIdent = thisSession.user.id;
|
|
||||||
let loggedInUserEmail = thisSession.user.email;
|
|
||||||
|
|
||||||
//console.log("logged ident:", loggedInUserIdent);
|
|
||||||
|
|
||||||
console.log("which appeal: ", query.appealtypes);
|
|
||||||
|
|
||||||
const accountDetails = await getPersonalAccount(loggedInUser);
|
|
||||||
|
|
||||||
const [appealTypeData, mandatoryFieldsData, pickListData, blobList] =
|
|
||||||
await Promise.all([
|
|
||||||
await getAppealsTypesForNewAppeal(),
|
|
||||||
await getMandatoryFields(query.appealtypes),
|
|
||||||
await getPickLists(query.appealtypes),
|
|
||||||
await getFilesFromBlob(loggedInUserIdent, query.casereference),
|
|
||||||
]);
|
|
||||||
|
|
||||||
const blobProgress = await getProgressFromBlob(
|
|
||||||
loggedInUserIdent,
|
|
||||||
query.casereference
|
|
||||||
);
|
|
||||||
|
|
||||||
//console.log("/////////\nappeal type data:", appealTypeData);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Removed to make progress from Blob not CRM
|
|
||||||
//
|
|
||||||
|
|
||||||
// let searchResultsObj = await getPartSavedAppeal(query.casereference);
|
|
||||||
// //console.log("eeee:", searchResultsObj);
|
|
||||||
// let searchDetailsObj = await getPartSavedDetails(searchResultsObj);
|
|
||||||
|
|
||||||
// searchDetailsObj = searchDetailsObj[0].value[0];
|
|
||||||
|
|
||||||
// Object.keys(searchDetailsObj).forEach((key) => {
|
|
||||||
// if (searchDetailsObj[key] === null) {
|
|
||||||
// delete searchDetailsObj[key];
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
//console.log("appeal:", searchDetailsObj);
|
|
||||||
|
|
||||||
// searchDetailsObj = JSON.stringify(searchDetailsObj);
|
|
||||||
// searchDetailsObj = searchDetailsObj.replace(/:true/gm, `:"Yes"`);
|
|
||||||
// searchDetailsObj = searchDetailsObj.replace(/:false/gm, `:"No"`);
|
|
||||||
// searchDetailsObj = JSON.parse(searchDetailsObj);
|
|
||||||
|
|
||||||
let caseReference = {};
|
|
||||||
|
|
||||||
caseReference.ticketnumber = query.casereference;
|
|
||||||
caseReference.incidentid = query.inid;
|
|
||||||
caseReference.caseDetails = blobProgress; //searchDetailsObj;
|
|
||||||
|
|
||||||
var path = require("path");
|
|
||||||
const configDirectory = path.resolve(process.cwd(), "data/formsxml");
|
|
||||||
var xmlStr = fs.readFileSync(
|
|
||||||
path.join(configDirectory, query.appealtypes + ".xml"),
|
|
||||||
"utf8"
|
|
||||||
);
|
|
||||||
|
|
||||||
xmlStr = xmlStr.replace(/\t/g, "");
|
|
||||||
xmlStr = xmlStr.replace(/\n/g, "");
|
|
||||||
xmlStr = xmlStr.replace(/> <"/g, "><");
|
|
||||||
xmlStr = xmlStr.toString();
|
|
||||||
|
|
||||||
if (query.hasOwnProperty("key")) {
|
|
||||||
const awaitingSubmissionFromBlob =
|
|
||||||
await getAwaitingSubmissionFromBlob(thisSession.user.id);
|
|
||||||
|
|
||||||
store.dispatch(
|
|
||||||
setAwaitingSubmissionFromBlob(awaitingSubmissionFromBlob)
|
|
||||||
);
|
|
||||||
|
|
||||||
store.dispatch(
|
|
||||||
setAwaitingSubmissionDetails(awaitingSubmissionFromBlob)
|
|
||||||
);
|
|
||||||
store.dispatch(
|
|
||||||
setCurrentView({
|
|
||||||
"viewName": "Awaiting Submission",
|
|
||||||
"viewKey": "awaitingSubmissionDetails",
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
store.dispatch(setLoggedInUserId(loggedInUser));
|
|
||||||
store.dispatch(setLoggedInUserEmail(loggedInUserEmail));
|
|
||||||
store.dispatch(setAppealLPA(query.lpa));
|
|
||||||
store.dispatch(setAppealTypeID(query.apt));
|
|
||||||
store.dispatch(setCaseReference(caseReference));
|
|
||||||
store.dispatch(setForm(xmlStr, mandatoryFieldsData, pickListData));
|
|
||||||
store.dispatch(setAppealType(appealTypeData));
|
|
||||||
store.dispatch(setContainerID(thisSession.user.id));
|
|
||||||
store.dispatch(setAccountDetails(accountDetails));
|
|
||||||
|
|
||||||
store.dispatch(setFilesForAppeal(blobList));
|
|
||||||
|
|
||||||
return {
|
|
||||||
props: { url: process.env.NEXTAUTH_URL },
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
const mapStateToProps = (state) => {
|
||||||
@@ -354,21 +474,14 @@ const mapStateToProps = (state) => {
|
|||||||
accountDetails: state.accountDetails,
|
accountDetails: state.accountDetails,
|
||||||
awaitingSubmission: state.awaitingSubmission,
|
awaitingSubmission: state.awaitingSubmission,
|
||||||
currentView: state.currentView,
|
currentView: state.currentView,
|
||||||
initialValues: state.appealType.caseReference.caseDetails,
|
initialValues: state.appealType.caseReference?.caseDetails,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => {
|
const mapDispatchToProps = (dispatch) => {
|
||||||
return {
|
return {
|
||||||
setFormTitle: (title) => {
|
// Keep these only if something else uses them;
|
||||||
dispatch(setAppealTypeTitle(title));
|
// this page no longer needs the useEffect that called setCaseReference.
|
||||||
},
|
|
||||||
setCaseReference: (refno) => {
|
|
||||||
dispatch(setCaseReference(refno));
|
|
||||||
},
|
|
||||||
setFilesForAppeal: (blobList) => {
|
|
||||||
dispatch(setFilesForAppeal(blobList));
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -209,6 +209,7 @@ const RepresentationF = (props) => {
|
|||||||
}
|
}
|
||||||
setCurrentReference={setCurrentReference}
|
setCurrentReference={setCurrentReference}
|
||||||
showQuestionnaireSection={showQuestionnaireSection}
|
showQuestionnaireSection={showQuestionnaireSection}
|
||||||
|
docsOffline={props.docsOffline}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Footer footerLinks={footerLinks} ticketnumber={props} />
|
<Footer footerLinks={footerLinks} ticketnumber={props} />
|
||||||
@@ -327,6 +328,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
containerID: thisSession.user.id,
|
containerID: thisSession.user.id,
|
||||||
|
docsOffline: process.env.DOCAPI_OFFLINE || false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+374
-259
@@ -1,295 +1,409 @@
|
|||||||
import fs from "fs";
|
// import fs from "fs";
|
||||||
import { JSONPath as jsonpath } from "jsonpath-plus";
|
// import { JSONPath as jsonpath } from "jsonpath-plus";
|
||||||
import useTranslation from "next-translate/useTranslation";
|
// import useTranslation from "next-translate/useTranslation";
|
||||||
import Head from "next/head";
|
// import Head from "next/head";
|
||||||
import { useRouter } from "next/router";
|
// import { useRouter } from "next/router";
|
||||||
import { useEffect } from "react";
|
// import { useEffect } from "react";
|
||||||
import { connect } from "react-redux";
|
// import { connect } from "react-redux";
|
||||||
import xpath from "xpath";
|
// import xpath from "xpath";
|
||||||
import {
|
// import {
|
||||||
getAppealsTypesForNewAppeal,
|
// getAppealsTypesForNewAppeal,
|
||||||
getIP,
|
// getIP,
|
||||||
getMandatoryFields,
|
// getMandatoryFields,
|
||||||
getPickLists,
|
// getPickLists,
|
||||||
getProgressFromBlob,
|
// getProgressFromBlob,
|
||||||
getPersonalAccount,
|
// getPersonalAccount,
|
||||||
} from "../../actions";
|
// } from "../../actions";
|
||||||
import Breadcrumbs from "../../components/breadcrumbs";
|
// import Breadcrumbs from "../../components/breadcrumbs";
|
||||||
import CookieBanner from "../../components/cookieBanner";
|
// import CookieBanner from "../../components/cookieBanner";
|
||||||
import Footer from "../../components/footer";
|
// import Footer from "../../components/footer";
|
||||||
import Header from "../../components/header";
|
// import Header from "../../components/header";
|
||||||
import BuildCheckSection from "../../components/newappeal/buildchecksection";
|
// import BuildCheckSection from "../../components/newappeal/buildchecksection";
|
||||||
import BuildSection from "../../components/newappeal/buildsection";
|
// import BuildSection from "../../components/newappeal/buildsection";
|
||||||
import CompleteAppeal from "../../components/newappeal/complete";
|
// import CompleteAppeal from "../../components/newappeal/complete";
|
||||||
import TimeOut from "../../components/timeout";
|
// import TimeOut from "../../components/timeout";
|
||||||
|
|
||||||
|
// import { getSession } from "next-auth/react";
|
||||||
|
// import {
|
||||||
|
// setContainerID,
|
||||||
|
// setLoggedInUserEmail,
|
||||||
|
// setLoggedInUserId,
|
||||||
|
// setAccountDetails,
|
||||||
|
// } from "../../store/accountDetails/action";
|
||||||
|
// import {
|
||||||
|
// setAppealLPA,
|
||||||
|
// setAppealType,
|
||||||
|
// setAppealTypeID,
|
||||||
|
// setAppealTypeTitle,
|
||||||
|
// setCaseReference,
|
||||||
|
// } from "../../store/appealType/action";
|
||||||
|
// import { setForm } from "../../store/formData/action";
|
||||||
|
// import { wrapper } from "../../store/store";
|
||||||
|
// import ServiceBanner from "../../components/myportal/servicebanner";
|
||||||
|
|
||||||
|
// let Home = (props) => {
|
||||||
|
// const { footerLinks, pages, formData } = props;
|
||||||
|
// let { t, lang } = useTranslation();
|
||||||
|
|
||||||
|
// const router = useRouter();
|
||||||
|
// const { locale } = router;
|
||||||
|
// const { appealtypes } = router.query;
|
||||||
|
|
||||||
|
// useEffect(() => {
|
||||||
|
// //setFormTitle(formTitle);
|
||||||
|
// setCaseReference(router.query.refno);
|
||||||
|
// }, []); // eslint-disable-line react-hooks/exhaustive-deps
|
||||||
|
|
||||||
|
// const formXML = props.formData.formData;
|
||||||
|
// const parser = new DOMParser();
|
||||||
|
// var doc = parser.parseFromString(formXML, "text/xml");
|
||||||
|
// var titles = xpath.select(
|
||||||
|
// "//form/tabs/tab[*]/labels/label[@description]/@description",
|
||||||
|
// doc
|
||||||
|
// );
|
||||||
|
// var sectionCount = xpath.select("/form/tabs/tab[*]", doc);
|
||||||
|
// sectionCount = sectionCount.length;
|
||||||
|
|
||||||
|
// var tabs = xpath.select("//form/tabs/tab[*]", doc);
|
||||||
|
|
||||||
|
// let optionsStr = props.appealType.appealTypeOptions.value;
|
||||||
|
|
||||||
|
// let selectedObj = jsonpath({
|
||||||
|
// path: "$..[?(@ && @.attributevalue=='" + router.query.apt + "')]",
|
||||||
|
// json: optionsStr,
|
||||||
|
// eval: true,
|
||||||
|
// });
|
||||||
|
|
||||||
|
// //let optionsTitleObj = [];
|
||||||
|
|
||||||
|
// //const optionsTitleObj = selectedObj.reduce(
|
||||||
|
// // (obj, arrValue) => (
|
||||||
|
// // (obj[arrValue] = arrValue
|
||||||
|
// // .replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
|
||||||
|
// // .toLowerCase()
|
||||||
|
// // .slice(0, 39)),
|
||||||
|
// // obj
|
||||||
|
// // ),
|
||||||
|
// // {}
|
||||||
|
// // );
|
||||||
|
|
||||||
|
// const formTitle = selectedObj[0].value;
|
||||||
|
|
||||||
|
// const { onSubmit } = props;
|
||||||
|
|
||||||
|
// return (
|
||||||
|
// <div>
|
||||||
|
// <Head>
|
||||||
|
// <title>
|
||||||
|
// {t("newappeal:page-title")} - {t("common:service-name")}
|
||||||
|
// </title>
|
||||||
|
// <>
|
||||||
|
// <link
|
||||||
|
// rel="canonical"
|
||||||
|
// href={t("common:gov-wales-link") + router.asPath}
|
||||||
|
// />
|
||||||
|
// <meta
|
||||||
|
// key="og:locale"
|
||||||
|
// property="og:locale"
|
||||||
|
// content={router.locale}
|
||||||
|
// />
|
||||||
|
// {/* If they have a Twitter Handle, include the meta details below */}
|
||||||
|
// <meta
|
||||||
|
// key="og:site_name"
|
||||||
|
// property="og:site_name"
|
||||||
|
// content={t("common:service-name")}
|
||||||
|
// />
|
||||||
|
// <meta
|
||||||
|
// key="twitter:site"
|
||||||
|
// property="twitter:site"
|
||||||
|
// content="@UKGovWales"
|
||||||
|
// />
|
||||||
|
|
||||||
|
// <meta
|
||||||
|
// name="description"
|
||||||
|
// content={t("common:service-description")}
|
||||||
|
// />
|
||||||
|
// <meta
|
||||||
|
// property="og:site_name"
|
||||||
|
// content={t("common:gov-wales-label")}
|
||||||
|
// />
|
||||||
|
// <meta
|
||||||
|
// property="og:title"
|
||||||
|
// content={t("newappeal:page-title")}
|
||||||
|
// />
|
||||||
|
// <meta
|
||||||
|
// property="og:description"
|
||||||
|
// content={t("common:service-description")}
|
||||||
|
// />
|
||||||
|
// <meta property="og:type" content="website" />
|
||||||
|
// <meta
|
||||||
|
// property="og:url"
|
||||||
|
// content={t("common:gov-wales-link")}
|
||||||
|
// />
|
||||||
|
// <meta
|
||||||
|
// property="og:image"
|
||||||
|
// content="https://gov.wales/themes/custom/govwales/images/content/og-global-1200.png"
|
||||||
|
// />
|
||||||
|
// <meta name="twitter:card" content="summary" />
|
||||||
|
// <meta
|
||||||
|
// name="twitter:title"
|
||||||
|
// content={t("common:gov-wales-label")}
|
||||||
|
// />
|
||||||
|
// <meta
|
||||||
|
// name="twitter:url"
|
||||||
|
// content={t("common:gov-wales-link") + router.asPath}
|
||||||
|
// />
|
||||||
|
// <meta
|
||||||
|
// name="twitter:image"
|
||||||
|
// content="https://gov.wales/themes/custom/govwales/images/content/og-global-120.png"
|
||||||
|
// />
|
||||||
|
// </>
|
||||||
|
// </Head>
|
||||||
|
// <div id="page_wrapper">
|
||||||
|
// <CookieBanner />
|
||||||
|
// <Header />
|
||||||
|
|
||||||
|
// <div className="govuk-width-container">
|
||||||
|
// <Breadcrumbs slug={appealtypes} formTitle={formTitle} />
|
||||||
|
// <ServiceBanner props={props} />
|
||||||
|
// <main
|
||||||
|
// className="govuk-main-wrapper--auto-spacing"
|
||||||
|
// id="main-content"
|
||||||
|
// role="main"
|
||||||
|
// >
|
||||||
|
// {props.appealType.currentSection == 9999 ? (
|
||||||
|
// <CompleteAppeal props={props} />
|
||||||
|
// ) : props.appealType.currentSection ==
|
||||||
|
// sectionCount + 1 ? (
|
||||||
|
// <BuildCheckSection
|
||||||
|
// formXML={formXML}
|
||||||
|
// sectionCount={sectionCount}
|
||||||
|
// onSubmit={onSubmit}
|
||||||
|
// formTitle={formTitle}
|
||||||
|
// appealType={props.appealType}
|
||||||
|
// props={props}
|
||||||
|
// key={1}
|
||||||
|
// mandatoryFieldsData={
|
||||||
|
// props.formData.mandatoryFieldsData
|
||||||
|
// }
|
||||||
|
// />
|
||||||
|
// ) : (
|
||||||
|
// <>
|
||||||
|
// <BuildSection
|
||||||
|
// formXML={formXML}
|
||||||
|
// sectionCount={sectionCount}
|
||||||
|
// onSubmit={onSubmit}
|
||||||
|
// formTitle={formTitle}
|
||||||
|
// mandatoryFieldsData={
|
||||||
|
// props.formData.mandatoryFieldsData
|
||||||
|
// }
|
||||||
|
// props={props}
|
||||||
|
// />
|
||||||
|
// </>
|
||||||
|
// )}
|
||||||
|
// </main>
|
||||||
|
// </div>
|
||||||
|
// <Footer footerLinks={footerLinks} ticketnumber={props} />
|
||||||
|
// </div>
|
||||||
|
// <TimeOut />
|
||||||
|
// </div>
|
||||||
|
// );
|
||||||
|
// };
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
// console.log("ref:", query.id);
|
||||||
|
// let loggedInUser = cookies.pinsUser;
|
||||||
|
|
||||||
|
// let thisSession = await getSession(ctx);
|
||||||
|
// //console.log("nextAuth Session:", thisSession);
|
||||||
|
|
||||||
|
// if (!thisSession) {
|
||||||
|
// console.log("not has sesssion.......");
|
||||||
|
// return {
|
||||||
|
// redirect: {
|
||||||
|
// destination: "/auth/signin",
|
||||||
|
// permanent: false,
|
||||||
|
// },
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
|
||||||
|
// let loggedInUserIdent = thisSession.user.id;
|
||||||
|
// let loggedInUserEmail = thisSession.user.email;
|
||||||
|
|
||||||
|
// console.log("logged ident:", loggedInUserIdent, loggedInUserEmail);
|
||||||
|
|
||||||
|
// const [
|
||||||
|
// appealTypeData,
|
||||||
|
// mandatoryFieldsData,
|
||||||
|
// pickListData,
|
||||||
|
// //blobList,
|
||||||
|
// ] = await Promise.all([
|
||||||
|
// await getAppealsTypesForNewAppeal(),
|
||||||
|
// await getMandatoryFields(query.appealtypes),
|
||||||
|
// await getPickLists(query.appealtypes),
|
||||||
|
|
||||||
|
// //await getFilesFromBlob(query.casereference),
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// const blobProgress = await getProgressFromBlob(
|
||||||
|
// loggedInUserIdent,
|
||||||
|
// query.id
|
||||||
|
// );
|
||||||
|
|
||||||
|
// const accountDetails = await getPersonalAccount(loggedInUser);
|
||||||
|
|
||||||
|
// console.log("anything here", loggedInUser, query.id, blobProgress);
|
||||||
|
|
||||||
|
// let caseReference = {};
|
||||||
|
|
||||||
|
// caseReference.ticketnumber = query.id;
|
||||||
|
// caseReference.incidentid = query.id;
|
||||||
|
// caseReference.caseDetails = blobProgress; //searchDetailsObj;
|
||||||
|
|
||||||
|
// var path = require("path");
|
||||||
|
// const configDirectory = path.resolve(process.cwd(), "data/formsxml");
|
||||||
|
// var xmlStr = fs.readFileSync(
|
||||||
|
// path.join(configDirectory, query.appealtypes + ".xml"),
|
||||||
|
// "utf8"
|
||||||
|
// );
|
||||||
|
// // xmlStr = formdata.value[0].formxml;
|
||||||
|
// xmlStr = xmlStr.replace(/\t/g, "");
|
||||||
|
// xmlStr = xmlStr.replace(/\n/g, "");
|
||||||
|
// xmlStr = xmlStr.replace(/> <"/g, "><");
|
||||||
|
// xmlStr = xmlStr.toString();
|
||||||
|
|
||||||
|
// store.dispatch(setLoggedInUserId(loggedInUser));
|
||||||
|
// store.dispatch(setLoggedInUserEmail(loggedInUserEmail));
|
||||||
|
// store.dispatch(setAppealLPA(query.lpa));
|
||||||
|
// store.dispatch(setAppealTypeID(query.apt));
|
||||||
|
// store.dispatch(setCaseReference(caseReference));
|
||||||
|
// store.dispatch(setForm(xmlStr, mandatoryFieldsData, pickListData));
|
||||||
|
// store.dispatch(setAppealType(appealTypeData));
|
||||||
|
// store.dispatch(setContainerID(thisSession.user.id));
|
||||||
|
// store.dispatch(setAccountDetails(accountDetails));
|
||||||
|
|
||||||
|
// //store.dispatch(setFilesForAppeal(blobList));
|
||||||
|
|
||||||
|
// return {
|
||||||
|
// props: { url: process.env.NEXTAUTH_URL },
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
|
||||||
|
// const mapStateToProps = (state) => {
|
||||||
|
// return {
|
||||||
|
// search: state.search,
|
||||||
|
// searchResultsObj: state.searchResultsObj,
|
||||||
|
// formData: state.formData,
|
||||||
|
// appealType: state.appealType,
|
||||||
|
// form: state.form,
|
||||||
|
// accountDetails: state.accountDetails,
|
||||||
|
// };
|
||||||
|
// };
|
||||||
|
|
||||||
|
// const mapDispatchToProps = (dispatch) => {
|
||||||
|
// return {
|
||||||
|
// setFormTitle: (title) => {
|
||||||
|
// dispatch(setAppealTypeTitle(title));
|
||||||
|
// },
|
||||||
|
// setCaseReference: (refno) => {
|
||||||
|
// dispatch(setCaseReference(refno));
|
||||||
|
// },
|
||||||
|
// };
|
||||||
|
// };
|
||||||
|
|
||||||
|
// export default connect(mapStateToProps, mapDispatchToProps)(Home);
|
||||||
|
|
||||||
|
// pages/newappeal/[appealtypes].js
|
||||||
|
import { JSONPath as jsonpath } from "jsonpath-plus";
|
||||||
|
import xpath from "xpath";
|
||||||
|
import { useMemo } from "react";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
import { getSession } from "next-auth/react";
|
|
||||||
import {
|
|
||||||
setContainerID,
|
|
||||||
setLoggedInUserEmail,
|
|
||||||
setLoggedInUserId,
|
|
||||||
setAccountDetails,
|
|
||||||
} from "../../store/accountDetails/action";
|
|
||||||
import {
|
|
||||||
setAppealLPA,
|
|
||||||
setAppealType,
|
|
||||||
setAppealTypeID,
|
|
||||||
setAppealTypeTitle,
|
|
||||||
setCaseReference,
|
|
||||||
} from "../../store/appealType/action";
|
|
||||||
import { setForm } from "../../store/formData/action";
|
|
||||||
import { wrapper } from "../../store/store";
|
import { wrapper } from "../../store/store";
|
||||||
import ServiceBanner from "../../components/myportal/servicebanner";
|
|
||||||
|
import NewAppealPageShell from "../../components/newappeal/newAppealPageShell";
|
||||||
|
import NewAppealFlow from "../../components/newappeal/newAppealFlow";
|
||||||
|
|
||||||
|
import { loadNewAppealPage } from "../../lib/newappeal/loadNewAppealPage";
|
||||||
|
import { hydrateNewAppealStore } from "../../lib/newappeal/hydrateNewAppealStore";
|
||||||
|
|
||||||
let Home = (props) => {
|
let Home = (props) => {
|
||||||
const { footerLinks, pages, formData } = props;
|
const { footerLinks } = props;
|
||||||
let { t, lang } = useTranslation();
|
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { locale } = router;
|
|
||||||
const { appealtypes } = router.query;
|
const { appealtypes } = router.query;
|
||||||
|
|
||||||
useEffect(() => {
|
const formXML = props.formData?.formData;
|
||||||
//setFormTitle(formTitle);
|
|
||||||
setCaseReference(router.query.refno);
|
// Memoise XML parsing so it doesn't rerun on every render
|
||||||
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
const { sectionCount } = useMemo(() => {
|
||||||
|
if (!formXML) return { sectionCount: 0 };
|
||||||
|
|
||||||
const formXML = props.formData.formData;
|
|
||||||
const parser = new DOMParser();
|
const parser = new DOMParser();
|
||||||
var doc = parser.parseFromString(formXML, "text/xml");
|
const doc = parser.parseFromString(formXML, "text/xml");
|
||||||
var titles = xpath.select(
|
const count = xpath.select("/form/tabs/tab[*]", doc)?.length || 0;
|
||||||
"//form/tabs/tab[*]/labels/label[@description]/@description",
|
return { sectionCount: count };
|
||||||
doc
|
}, [formXML]);
|
||||||
);
|
|
||||||
var sectionCount = xpath.select("/form/tabs/tab[*]", doc);
|
|
||||||
sectionCount = sectionCount.length;
|
|
||||||
|
|
||||||
var tabs = xpath.select("//form/tabs/tab[*]", doc);
|
// Safely compute formTitle from appeal type options + apt
|
||||||
|
const formTitle = useMemo(() => {
|
||||||
|
const optionsStr = props.appealType?.appealTypeOptions?.value;
|
||||||
|
const apt = router.query.apt;
|
||||||
|
|
||||||
let optionsStr = props.appealType.appealTypeOptions.value;
|
if (!optionsStr || !apt) return "New appeal";
|
||||||
|
|
||||||
let selectedObj = jsonpath({
|
const selectedObj = jsonpath({
|
||||||
path: "$..[?(@ && @.attributevalue=='" + router.query.apt + "')]",
|
path: "$..[?(@ && @.attributevalue=='" + apt + "')]",
|
||||||
json: optionsStr,
|
json: optionsStr,
|
||||||
eval: true,
|
eval: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
//let optionsTitleObj = [];
|
const title = selectedObj?.[0]?.value;
|
||||||
|
return title || "New appeal";
|
||||||
//const optionsTitleObj = selectedObj.reduce(
|
}, [props.appealType?.appealTypeOptions?.value, router.query.apt]);
|
||||||
// (obj, arrValue) => (
|
|
||||||
// (obj[arrValue] = arrValue
|
|
||||||
// .replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
|
|
||||||
// .toLowerCase()
|
|
||||||
// .slice(0, 39)),
|
|
||||||
// obj
|
|
||||||
// ),
|
|
||||||
// {}
|
|
||||||
// );
|
|
||||||
|
|
||||||
const formTitle = selectedObj[0].value;
|
|
||||||
|
|
||||||
const { onSubmit } = props;
|
const { onSubmit } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<NewAppealPageShell
|
||||||
<Head>
|
appealtypes={appealtypes}
|
||||||
<title>
|
formTitle={formTitle}
|
||||||
{t("newappeal:page-title")} - {t("common:service-name")}
|
footerLinks={footerLinks}
|
||||||
</title>
|
propsForFooter={props}
|
||||||
<>
|
propsForServiceBanner={props}
|
||||||
<link
|
|
||||||
rel="canonical"
|
|
||||||
href={t("common:gov-wales-link") + router.asPath}
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
key="og:locale"
|
|
||||||
property="og:locale"
|
|
||||||
content={router.locale}
|
|
||||||
/>
|
|
||||||
{/* If they have a Twitter Handle, include the meta details below */}
|
|
||||||
<meta
|
|
||||||
key="og:site_name"
|
|
||||||
property="og:site_name"
|
|
||||||
content={t("common:service-name")}
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
key="twitter:site"
|
|
||||||
property="twitter:site"
|
|
||||||
content="@UKGovWales"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<meta
|
|
||||||
name="description"
|
|
||||||
content={t("common:service-description")}
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
property="og:site_name"
|
|
||||||
content={t("common:gov-wales-label")}
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
property="og:title"
|
|
||||||
content={t("newappeal:page-title")}
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
property="og:description"
|
|
||||||
content={t("common:service-description")}
|
|
||||||
/>
|
|
||||||
<meta property="og:type" content="website" />
|
|
||||||
<meta
|
|
||||||
property="og:url"
|
|
||||||
content={t("common:gov-wales-link")}
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
property="og:image"
|
|
||||||
content="https://gov.wales/themes/custom/govwales/images/content/og-global-1200.png"
|
|
||||||
/>
|
|
||||||
<meta name="twitter:card" content="summary" />
|
|
||||||
<meta
|
|
||||||
name="twitter:title"
|
|
||||||
content={t("common:gov-wales-label")}
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
name="twitter:url"
|
|
||||||
content={t("common:gov-wales-link") + router.asPath}
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
name="twitter:image"
|
|
||||||
content="https://gov.wales/themes/custom/govwales/images/content/og-global-120.png"
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
</Head>
|
|
||||||
<div id="page_wrapper">
|
|
||||||
<CookieBanner />
|
|
||||||
<Header />
|
|
||||||
|
|
||||||
<div className="govuk-width-container">
|
|
||||||
<Breadcrumbs slug={appealtypes} formTitle={formTitle} />
|
|
||||||
<ServiceBanner props={props} />
|
|
||||||
<main
|
|
||||||
className="govuk-main-wrapper--auto-spacing"
|
|
||||||
id="main-content"
|
|
||||||
role="main"
|
|
||||||
>
|
>
|
||||||
{props.appealType.currentSection == 9999 ? (
|
<NewAppealFlow
|
||||||
<CompleteAppeal props={props} />
|
|
||||||
) : props.appealType.currentSection ==
|
|
||||||
sectionCount + 1 ? (
|
|
||||||
<BuildCheckSection
|
|
||||||
formXML={formXML}
|
formXML={formXML}
|
||||||
sectionCount={sectionCount}
|
sectionCount={sectionCount}
|
||||||
|
currentSection={props.appealType?.currentSection}
|
||||||
onSubmit={onSubmit}
|
onSubmit={onSubmit}
|
||||||
formTitle={formTitle}
|
formTitle={formTitle}
|
||||||
appealType={props.appealType}
|
mandatoryFieldsData={props.formData?.mandatoryFieldsData}
|
||||||
props={props}
|
propsForChildren={props}
|
||||||
key={1}
|
|
||||||
mandatoryFieldsData={
|
|
||||||
props.formData.mandatoryFieldsData
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
) : (
|
</NewAppealPageShell>
|
||||||
<>
|
|
||||||
<BuildSection
|
|
||||||
formXML={formXML}
|
|
||||||
sectionCount={sectionCount}
|
|
||||||
onSubmit={onSubmit}
|
|
||||||
formTitle={formTitle}
|
|
||||||
mandatoryFieldsData={
|
|
||||||
props.formData.mandatoryFieldsData
|
|
||||||
}
|
|
||||||
props={props}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</main>
|
|
||||||
</div>
|
|
||||||
<Footer footerLinks={footerLinks} ticketnumber={props} />
|
|
||||||
</div>
|
|
||||||
<TimeOut />
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getServerSideProps = wrapper.getServerSideProps(
|
export const getServerSideProps = wrapper.getServerSideProps(
|
||||||
(store) => async (ctx) => {
|
(store) => async (ctx) => {
|
||||||
const { query, req, res } = ctx;
|
const result = await loadNewAppealPage(ctx);
|
||||||
getIP(req);
|
|
||||||
const { cookies } = req;
|
|
||||||
|
|
||||||
console.log(cookies);
|
if (result?.redirect) {
|
||||||
console.log("the query", query);
|
return { redirect: result.redirect };
|
||||||
console.log("ref:", query.id);
|
|
||||||
let loggedInUser = cookies.pinsUser;
|
|
||||||
|
|
||||||
let thisSession = await getSession(ctx);
|
|
||||||
//console.log("nextAuth Session:", thisSession);
|
|
||||||
|
|
||||||
if (!thisSession) {
|
|
||||||
console.log("not has sesssion.......");
|
|
||||||
return {
|
|
||||||
redirect: {
|
|
||||||
destination: "/auth/signin",
|
|
||||||
permanent: false,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let loggedInUserIdent = thisSession.user.id;
|
// Hydrate Redux from one place
|
||||||
let loggedInUserEmail = thisSession.user.email;
|
hydrateNewAppealStore(store, ctx.query, result);
|
||||||
|
|
||||||
console.log("logged ident:", loggedInUserIdent, loggedInUserEmail);
|
|
||||||
|
|
||||||
const [
|
|
||||||
appealTypeData,
|
|
||||||
mandatoryFieldsData,
|
|
||||||
pickListData,
|
|
||||||
//blobList,
|
|
||||||
] = await Promise.all([
|
|
||||||
await getAppealsTypesForNewAppeal(),
|
|
||||||
await getMandatoryFields(query.appealtypes),
|
|
||||||
await getPickLists(query.appealtypes),
|
|
||||||
|
|
||||||
//await getFilesFromBlob(query.casereference),
|
|
||||||
]);
|
|
||||||
|
|
||||||
const blobProgress = await getProgressFromBlob(
|
|
||||||
loggedInUserIdent,
|
|
||||||
query.id
|
|
||||||
);
|
|
||||||
|
|
||||||
const accountDetails = await getPersonalAccount(loggedInUser);
|
|
||||||
|
|
||||||
console.log("anything here", loggedInUser, query.id, blobProgress);
|
|
||||||
|
|
||||||
let caseReference = {};
|
|
||||||
|
|
||||||
caseReference.ticketnumber = query.id;
|
|
||||||
caseReference.incidentid = query.id;
|
|
||||||
caseReference.caseDetails = blobProgress; //searchDetailsObj;
|
|
||||||
|
|
||||||
var path = require("path");
|
|
||||||
const configDirectory = path.resolve(process.cwd(), "data/formsxml");
|
|
||||||
var xmlStr = fs.readFileSync(
|
|
||||||
path.join(configDirectory, query.appealtypes + ".xml"),
|
|
||||||
"utf8"
|
|
||||||
);
|
|
||||||
// xmlStr = formdata.value[0].formxml;
|
|
||||||
xmlStr = xmlStr.replace(/\t/g, "");
|
|
||||||
xmlStr = xmlStr.replace(/\n/g, "");
|
|
||||||
xmlStr = xmlStr.replace(/> <"/g, "><");
|
|
||||||
xmlStr = xmlStr.toString();
|
|
||||||
|
|
||||||
store.dispatch(setLoggedInUserId(loggedInUser));
|
|
||||||
store.dispatch(setLoggedInUserEmail(loggedInUserEmail));
|
|
||||||
store.dispatch(setAppealLPA(query.lpa));
|
|
||||||
store.dispatch(setAppealTypeID(query.apt));
|
|
||||||
store.dispatch(setCaseReference(caseReference));
|
|
||||||
store.dispatch(setForm(xmlStr, mandatoryFieldsData, pickListData));
|
|
||||||
store.dispatch(setAppealType(appealTypeData));
|
|
||||||
store.dispatch(setContainerID(thisSession.user.id));
|
|
||||||
store.dispatch(setAccountDetails(accountDetails));
|
|
||||||
|
|
||||||
//store.dispatch(setFilesForAppeal(blobList));
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: { url: process.env.NEXTAUTH_URL },
|
props: { url: process.env.NEXTAUTH_URL },
|
||||||
@@ -310,11 +424,12 @@ const mapStateToProps = (state) => {
|
|||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => {
|
const mapDispatchToProps = (dispatch) => {
|
||||||
return {
|
return {
|
||||||
|
// Keep as-is; you can clean these later once you confirm usage
|
||||||
setFormTitle: (title) => {
|
setFormTitle: (title) => {
|
||||||
dispatch(setAppealTypeTitle(title));
|
// dispatch(setAppealTypeTitle(title)); // optional later
|
||||||
},
|
},
|
||||||
setCaseReference: (refno) => {
|
setCaseReference: (refno) => {
|
||||||
dispatch(setCaseReference(refno));
|
// dispatch(setCaseReferenceAction(refno)); // optional later
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user