diff --git a/components/case/representation/index.js b/components/case/representation/index.js
index 5abedbfb..b45db9ba 100644
--- a/components/case/representation/index.js
+++ b/components/case/representation/index.js
@@ -179,7 +179,6 @@ let MakeRepresentation = (props) => {
("0" + repDate.getMinutes()).slice(-2) +
":" +
("0" + repDate.getSeconds()).slice(-2) +
- ":" +
"_-_" +
repCap +
"_-_" +
@@ -752,9 +751,8 @@ let MakeRepresentation = (props) => {
props.props.accountDetails.accountDetails.emailaddress1,
"siteAddress":
detailsObj.pinswg_siteaddressline1 +
- " " +
- detailsObj.pinswg_siteaddressline2 +
- " " +
+ (detailsObj.pinswg_siteaddressline2 != null &&
+ " " + detailsObj.pinswg_siteaddressline2 + " ") +
detailsObj.pinswg_siteaddresstown +
" " +
detailsObj.pinswg_siteaddresspostcode,
@@ -956,8 +954,8 @@ let MakeRepresentation = (props) => {
props.props.accountDetails.accountDetails.emailaddress1,
"siteAddress":
detailsObj.pinswg_siteaddressline1 +
- " " +
- detailsObj.pinswg_siteaddressline2 +
+ (detailsObj.pinswg_siteaddressline2 != null &&
+ " " + detailsObj.pinswg_siteaddressline2 + " ") +
" " +
detailsObj.pinswg_siteaddresstown +
" " +
diff --git a/components/case/representation/representationCompleteSubmit.js b/components/case/representation/representationCompleteSubmit.js
index 0a6f4a89..2bee283a 100644
--- a/components/case/representation/representationCompleteSubmit.js
+++ b/components/case/representation/representationCompleteSubmit.js
@@ -7,7 +7,7 @@ import { connect } from "react-redux";
import RepComplete from "./representationComplete";
import RepLPAQuestionnaireCheck_enforcement from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_enforcement";
import RepLPAQuestionnaireCheck_s78 from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_s78";
-
+import Link from "next/link";
import { bytesToSize, getThumbnailIconByExtension } from "../../utils";
const RepCompleteSubmit = (props) => {
@@ -90,7 +90,7 @@ const RepCompleteSubmit = (props) => {
// "caseRef": props.props.currentView.caseReference.currentReference,
// });
- console.log("///////// repFormData:", repFormData);
+ //console.log("///////// repFormData:", repFormData);
const whichQuestionnaireCheck = () => {
{
@@ -153,10 +153,10 @@ const RepCompleteSubmit = (props) => {
});
}
- console.log(
- buildAppealFilesArray,
- formObj.representationForm.values.filesList
- );
+ // console.log(
+ // buildAppealFilesArray,
+ // formObj.representationForm.values.filesList
+ // );
// buildAppealFilesArray = formObj.representationForm.values.hasOwnProperty(
// "filesList"
@@ -438,7 +438,13 @@ const RepCompleteSubmit = (props) => {
{t(
"myrepresentations:rep-check-tandc-para-two"
- )}
+ )}{" "}
+
+ {t(
+ "common:footer-privacy-notice-link-label"
+ )}
+
+ .
diff --git a/components/case/representation/representationElements.js b/components/case/representation/representationElements.js
index 10e5e7bf..7baa3d04 100644
--- a/components/case/representation/representationElements.js
+++ b/components/case/representation/representationElements.js
@@ -287,9 +287,8 @@ export const RenderCondtionalRadioList = ({
- e.g. ‘Owners of Numbers 1-5 High Street‘, or
- ‘Mr and Mrs Smith‘ or ‘The executors
- of Mr Evans‘ estate‘
+ e.g. "Owners of Numbers 1-5 High Street", or "Mr and Mrs
+ Smith" or "The executors of Mr Evans" estate"
{Object.keys(options).map((key, index) => (
@@ -334,7 +333,7 @@ export const RenderCondtionalRadioList = ({
htmlFor={id + "_details"}
>
Enter the name of the
- company/group/organisation *
+ company/group/organisation
{
3. {t("myrepresentations:enf-section-question-3")}:{" "}
{detailsObj.pinswg_siteaddressline1 +
- " " +
- detailsObj.pinswg_siteaddressline2 +
- " " +
+ (detailsObj.pinswg_siteaddressline2 != null &&
+ " " +
+ detailsObj.pinswg_siteaddressline2 +
+ " ") +
detailsObj.pinswg_siteaddresstown +
" " +
detailsObj.pinswg_siteaddresspostcode}
diff --git a/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js b/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js
index 11380192..3e0dd819 100644
--- a/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js
+++ b/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js
@@ -134,9 +134,10 @@ let S78_Questionnaire = (props) => {
3. {t("myrepresentations:s78-section-question-3")}{" "}
{detailsObj.pinswg_siteaddressline1 +
- " " +
- detailsObj.pinswg_siteaddressline2 +
- " " +
+ (detailsObj.pinswg_siteaddressline2 != null &&
+ " " +
+ detailsObj.pinswg_siteaddressline2 +
+ " ") +
detailsObj.pinswg_siteaddresstown +
" " +
detailsObj.pinswg_siteaddresspostcode}
diff --git a/components/pdftemplates/finalComments_pdf.js b/components/pdftemplates/finalComments_pdf.js
index a61e56e0..1f4cce17 100644
--- a/components/pdftemplates/finalComments_pdf.js
+++ b/components/pdftemplates/finalComments_pdf.js
@@ -112,8 +112,13 @@ export const finalComments_pdf = ({ docProps }) => {
let values = docProps;
let datestr = values.repfile_name.split("-");
- let signedDate = datestr[2] + "/" + datestr[1] + "/" + datestr[0];
+ let signedDate = formatDates(new Date()); // datestr[2] + "/" + datestr[1] + "/" + datestr[0];
let appealTypeValue = getFormCollectionByID(values.appealType);
+ let filterFilesList = values.hasOwnProperty("filesList")
+ ? values.filesList.filter(function (el) {
+ return el != null;
+ })
+ : [];
return (
@@ -127,7 +132,6 @@ export const finalComments_pdf = ({ docProps }) => {
fontFamily: "Helvetica-Bold",
}}
>
- F
{getTrans(
docProps.locale,
"final-comments-label"
@@ -359,7 +363,7 @@ export const finalComments_pdf = ({ docProps }) => {
]}
>
{values.hasOwnProperty("filesList") &&
- values.filesList.map(function (p) {
+ filterFilesList.map(function (p) {
return (
{
let values = docProps;
let datestr = values.pinswg_name.split("-");
- let signedDate = datestr[2] + "/" + datestr[1] + "/" + datestr[0];
+ let signedDate = formatDates(new Date()); // datestr[2] + "/" + datestr[1] + "/" + datestr[0];
const isLPA = values.representationCapacity == "lpa" ? true : false;
+ let filterFilesList = values.hasOwnProperty("filesList")
+ ? values.filesList.filter(function (el) {
+ return el != null;
+ })
+ : [];
return (
@@ -293,7 +298,7 @@ export const other_pdf = ({ docProps }) => {
]}
>
{values.hasOwnProperty("filesList") &&
- values.filesList.map(function (p) {
+ filterFilesList.map(function (p) {
return (
{
let values = docProps;
let datestr = values.pinswg_name.split("-");
- let signedDate = datestr[2] + "/" + datestr[1] + "/" + datestr[0];
+ let signedDate = formatDates(new Date()); // datestr[2] + "/" + datestr[1] + "/" + datestr[0];
let appealTypeValue = getFormCollectionByID(values.appealType);
let filterFilesList = values.hasOwnProperty("filesList")
? values.filesList.filter(function (el) {
@@ -195,7 +195,7 @@ export const statement_pdf = ({ docProps }) => {
marginBottom: 10,
}}
>
- 1a.
+ 2.
{getTrans(
docProps.locale,
@@ -214,7 +214,7 @@ export const statement_pdf = ({ docProps }) => {
marginBottom: 10,
}}
>
- 1c.
+ 3.
{getTrans(
docProps.locale,
@@ -243,7 +243,7 @@ export const statement_pdf = ({ docProps }) => {
marginBottom: 10,
}}
>
- 2.
+ 4.
{getTrans(
docProps.locale,
@@ -261,7 +261,7 @@ export const statement_pdf = ({ docProps }) => {
marginBottom: 10,
}}
>
- 3.
+ 5.
{getTrans(
docProps.locale,
@@ -304,7 +304,7 @@ export const statement_pdf = ({ docProps }) => {
}}
>
- 4.
+ 6.
{getTrans(
@@ -343,7 +343,7 @@ export const statement_pdf = ({ docProps }) => {
marginBottom: 10,
}}
>
- 5.
+ 7.
{getTrans(
docProps.locale,
diff --git a/components/pdftemplates/writtenStatement_pdf.js b/components/pdftemplates/writtenStatement_pdf.js
index e3dc1868..09cedad8 100644
--- a/components/pdftemplates/writtenStatement_pdf.js
+++ b/components/pdftemplates/writtenStatement_pdf.js
@@ -96,8 +96,13 @@ export const writtenStatement_pdf = ({ docProps }) => {
let values = docProps;
let datestr = values.pinswg_name.split("-");
- let signedDate = datestr[2] + "/" + datestr[1] + "/" + datestr[0];
+ let signedDate = formatDates(new Date()); // datestr[2] + "/" + datestr[1] + "/" + datestr[0];
let appealTypeValue = getFormCollectionByID(values.appealType);
+ let filterFilesList = values.hasOwnProperty("filesList")
+ ? values.filesList.filter(function (el) {
+ return el != null;
+ })
+ : [];
return (
@@ -270,7 +275,7 @@ export const writtenStatement_pdf = ({ docProps }) => {
]}
>
{values.hasOwnProperty("filesList") &&
- values.filesList.map(function (p) {
+ filterFilesList.map(function (p) {
return (
{
+ let { t, lang } = useTranslation();
+
+ const router = useRouter();
+ const { query } = router;
+
+ const { footerLinks, pages, csrfToken, callbackUrl } = props;
+
+ const [formData, setFormData] = useState({
+ email: query.email || "",
+ callbackUrl: "",
+ csrfToken: "",
+ });
+
+ const [submitForm, setSubmitForm] = useState(false);
+ const [buttonDisabled, setButtonDisabled] = useState(false);
+ const [response, setResponse] = useState(null);
+
+ const handleInputChange = (e) => {
+ const { name, value } = e.target;
+ setFormData((prevState) => ({ ...prevState, [name]: value }));
+ };
+
+ // useEffect(() => {
+ // // Populate form fields if query params exist
+ // if (query.email)
+ // setFormData((prev) => ({ ...prev, email: query.email }));
+
+ // if (query.email) {
+ // handleSubmit(); // Trigger the form submission
+ // }
+ // }, [query]);
+
+ // const handleSubmit = async () => {
+ // setButtonDisabled(true); // Disable the submit button to avoid multiple submissions
+
+ // // Wait a short moment before programmatically submitting the form
+ // setTimeout(() => {
+ // const form = document.getElementById("signin-form"); // Get form by ID
+ // if (form) {
+ // form.submit(); // Submit the form
+ // }
+ // }, 500); // Short delay to ensure form is populated before submission
+ // };
+
+ const handleSubmit = async (event) => {
+ event.preventDefault();
+ setButtonDisabled(true); // Disable the submit button to avoid multiple submissions
+
+ try {
+ const res = await fetch("/api/auth/signin/emailAPI", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify(formData),
+ });
+
+ const data = await res.json();
+ setResponse(data); // Update response state
+ } catch (error) {
+ console.error("Error submitting the form:", error);
+ }
+ };
+
+ // Trigger form submission automatically when data is ready
+ useEffect(() => {
+ // Check if email exists and form data is populated
+ if (query.email && !response) {
+ setFormData((prevState) => ({
+ ...prevState,
+ csrfToken: csrfToken,
+ callbackUrl: callbackUrl || prevState.callbackUrl, // Ensure callback URL is set
+ }));
+ }
+ }, [query.email, csrfToken, callbackUrl, response]);
+
+ useEffect(() => {
+ // Automatically submit the form when data is ready
+ if (formData.email && formData.csrfToken && !response) {
+ handleSubmit(new Event("submit"));
+ }
+ }, [formData, response]);
+
+ // Handle redirection after form submission based on response
+ useEffect(() => {
+ if (response && response.url) {
+ // Redirect to the URL in the response
+ router.push(response.url);
+ }
+ }, [response, router]);
+
+ return (
+
+ );
+};
+
+export async function getServerSideProps(context) {
+ if (process.env.SHOWLOGIN == false) {
+ return {
+ redirect: {
+ destination: "/404",
+ permanent: false,
+ },
+ };
+ }
+
+ const csrfToken = await getCsrfToken(context);
+ console.log(
+ "\n//////////////////////\n",
+ "Sign in callbackurl: " + context.query.callbackUrl,
+ context.locale,
+ csrfToken + "\n//////////////////////\n"
+ );
+ let formURL = context.query.callbackUrl;
+ //console.log("formUrl:", formURL);
+
+ formURL = typeof formURL == "undefined" ? null : formURL;
+ return {
+ props: { csrfToken: csrfToken, callbackUrl: formURL },
+ };
+}
+
+export default SignIn;