make formatdates function shared in utils
This commit is contained in:
@@ -6,7 +6,7 @@ import { useState, useEffect, useRef, useCallback } from "react";
|
|||||||
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
||||||
import transLookup from "../../data/lookuptranslations.json";
|
import transLookup from "../../data/lookuptranslations.json";
|
||||||
import PaginationControl from "./pagination";
|
import PaginationControl from "./pagination";
|
||||||
|
import { formatDates } from "../utils";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
|
|
||||||
import { setCurrentPage } from "../../store/currentView/action";
|
import { setCurrentPage } from "../../store/currentView/action";
|
||||||
@@ -429,15 +429,6 @@ const DocumentDetails = (props) => {
|
|||||||
return docObj;
|
return docObj;
|
||||||
};
|
};
|
||||||
|
|
||||||
function formatDates(dateObj) {
|
|
||||||
var dateObj = new Date(dateObj);
|
|
||||||
var dd = String(dateObj.getDate()).padStart(2, "0");
|
|
||||||
var mm = String(dateObj.getMonth() + 1).padStart(2, "0"); //January is 0!
|
|
||||||
var yyyy = dateObj.getFullYear();
|
|
||||||
|
|
||||||
return dd + "/" + mm + "/" + yyyy;
|
|
||||||
}
|
|
||||||
|
|
||||||
const pagesCount = Math.ceil(documentDetailsObj["@odata.count"] / 10);
|
const pagesCount = Math.ceil(documentDetailsObj["@odata.count"] / 10);
|
||||||
|
|
||||||
let currentPage = 0;
|
let currentPage = 0;
|
||||||
|
|||||||
@@ -39,22 +39,7 @@ import {
|
|||||||
sendEmail,
|
sendEmail,
|
||||||
generateRepPDF,
|
generateRepPDF,
|
||||||
} from "../../../actions";
|
} from "../../../actions";
|
||||||
|
import { formatDates } from "../../../components/utils";
|
||||||
import {
|
|
||||||
RenderPickList,
|
|
||||||
RenderRadioList,
|
|
||||||
RenderTextfield,
|
|
||||||
} from "./representationElements";
|
|
||||||
|
|
||||||
import ReactPDF, {
|
|
||||||
Document,
|
|
||||||
Page,
|
|
||||||
Text,
|
|
||||||
View,
|
|
||||||
StyleSheet,
|
|
||||||
PDFViewer,
|
|
||||||
} from "@react-pdf/renderer";
|
|
||||||
import { object } from "prop-types";
|
|
||||||
|
|
||||||
let MakeRepresentation = (props) => {
|
let MakeRepresentation = (props) => {
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
@@ -87,6 +72,13 @@ let MakeRepresentation = (props) => {
|
|||||||
let setCaseQueryObj = props[currentType] || {};
|
let setCaseQueryObj = props[currentType] || {};
|
||||||
var casesObj = {};
|
var casesObj = {};
|
||||||
|
|
||||||
|
const isLPA =
|
||||||
|
props.props.accountDetails.accountDetails[
|
||||||
|
"pinswg_typeofinvolvement@OData.Community.Display.V1.FormattedValue"
|
||||||
|
] == "LPA"
|
||||||
|
? true
|
||||||
|
: false;
|
||||||
|
|
||||||
currentType == "searchResultsObj"
|
currentType == "searchResultsObj"
|
||||||
? (casesObj = jsonpath.query(
|
? (casesObj = jsonpath.query(
|
||||||
setCaseQueryObj,
|
setCaseQueryObj,
|
||||||
@@ -103,32 +95,52 @@ let MakeRepresentation = (props) => {
|
|||||||
|
|
||||||
const capacityOptionsArr = ["Appellant", "Agent", "Interested Party"];
|
const capacityOptionsArr = ["Appellant", "Agent", "Interested Party"];
|
||||||
|
|
||||||
const appellantApplicantRepresentationArr = [
|
let setCaseDetailsObj = router.query.hasOwnProperty("state")
|
||||||
"Statement",
|
? router.query.state == "edit"
|
||||||
"Final comments",
|
? props.props.myRepresentations.myRepresentations
|
||||||
"Written statement of evidence",
|
: props.props.searchResultsObj.searchDetailsObj
|
||||||
"Other",
|
: props.props.searchResultsObj.searchDetailsObj;
|
||||||
];
|
|
||||||
|
|
||||||
const interestedPersonRepresentationArr = [
|
var detailsObj = {};
|
||||||
"Statement",
|
|
||||||
"Final comments",
|
|
||||||
"Other",
|
|
||||||
];
|
|
||||||
|
|
||||||
const lpaRepresentationArr = [
|
detailsObj = jsonpath.query(
|
||||||
"Questionnaire",
|
setCaseDetailsObj,
|
||||||
"Final comments",
|
'$..[?(@.pinswg_name=="' +
|
||||||
"Written statement of evidence",
|
currentView.caseReference.currentReference +
|
||||||
"Other",
|
'")]'
|
||||||
];
|
);
|
||||||
|
|
||||||
const landOwnerRepresentationArr = [
|
detailsObj = detailsObj[0];
|
||||||
"Statement",
|
|
||||||
"Final comments",
|
const buildRepsArr = (detailsObj) => {
|
||||||
"Written statement of evidence",
|
let buildArr = [];
|
||||||
"Other",
|
|
||||||
];
|
let todaysDate = new Date();
|
||||||
|
|
||||||
|
let startDate = new Date(detailsObj.pinswg_startdate);
|
||||||
|
let questionnaireDate = new Date(
|
||||||
|
detailsObj.pinswg_questionnaireduedate
|
||||||
|
);
|
||||||
|
let finalCommentsDate = new Date(
|
||||||
|
detailsObj.pinswg_finalcommentsduedate
|
||||||
|
);
|
||||||
|
let statementDueDate = new Date(detailsObj.pinswg_statementduedate);
|
||||||
|
|
||||||
|
isLPA &&
|
||||||
|
todaysDate >= startDate &&
|
||||||
|
todaysDate <= questionnaireDate &&
|
||||||
|
buildArr.push("Questionnaire");
|
||||||
|
|
||||||
|
todaysDate >= startDate &&
|
||||||
|
todaysDate <= statementDueDate &&
|
||||||
|
buildArr.push("Statement");
|
||||||
|
|
||||||
|
todaysDate >= statementDueDate &&
|
||||||
|
todaysDate <= finalCommentsDate &&
|
||||||
|
buildArr.push("Final comments");
|
||||||
|
|
||||||
|
return buildArr;
|
||||||
|
};
|
||||||
|
|
||||||
const repCapacityType = () => {
|
const repCapacityType = () => {
|
||||||
return _.isEmpty(formObj["representationForm"])
|
return _.isEmpty(formObj["representationForm"])
|
||||||
@@ -144,19 +156,12 @@ let MakeRepresentation = (props) => {
|
|||||||
.toLowerCase();
|
.toLowerCase();
|
||||||
};
|
};
|
||||||
|
|
||||||
const isLPA =
|
|
||||||
props.props.accountDetails.accountDetails[
|
|
||||||
"pinswg_typeofinvolvement@OData.Community.Display.V1.FormattedValue"
|
|
||||||
] == "LPA"
|
|
||||||
? true
|
|
||||||
: false;
|
|
||||||
|
|
||||||
const whichControl = () => {
|
const whichControl = () => {
|
||||||
console.log(isLPA);
|
// console.log(isLPA);
|
||||||
console.log(
|
// console.log(
|
||||||
currentView.representationCapacity,
|
// currentView.representationCapacity,
|
||||||
_.isEmpty(currentView.representationCapacity)
|
// _.isEmpty(currentView.representationCapacity)
|
||||||
);
|
// );
|
||||||
|
|
||||||
if (isLPA && _.isEmpty(currentView.representationCapacity)) {
|
if (isLPA && _.isEmpty(currentView.representationCapacity)) {
|
||||||
return (
|
return (
|
||||||
@@ -196,9 +201,9 @@ let MakeRepresentation = (props) => {
|
|||||||
return (
|
return (
|
||||||
<RepAppellant
|
<RepAppellant
|
||||||
formObj={formObj}
|
formObj={formObj}
|
||||||
appellantApplicantRepresentationArr={
|
appellantApplicantRepresentationArr={buildRepsArr(
|
||||||
appellantApplicantRepresentationArr
|
detailsObj
|
||||||
}
|
)}
|
||||||
setRepresentationCapacity={
|
setRepresentationCapacity={
|
||||||
setRepresentationCapacity
|
setRepresentationCapacity
|
||||||
}
|
}
|
||||||
@@ -215,9 +220,9 @@ let MakeRepresentation = (props) => {
|
|||||||
return (
|
return (
|
||||||
<RepLPA
|
<RepLPA
|
||||||
formObj={formObj}
|
formObj={formObj}
|
||||||
appellantApplicantRepresentationArr={
|
appellantApplicantRepresentationArr={buildRepsArr(
|
||||||
lpaRepresentationArr
|
detailsObj
|
||||||
}
|
)}
|
||||||
setRepresentationCapacity={
|
setRepresentationCapacity={
|
||||||
setRepresentationCapacity
|
setRepresentationCapacity
|
||||||
}
|
}
|
||||||
@@ -234,9 +239,9 @@ let MakeRepresentation = (props) => {
|
|||||||
return (
|
return (
|
||||||
<RepAgent
|
<RepAgent
|
||||||
formObj={formObj}
|
formObj={formObj}
|
||||||
appellantApplicantRepresentationArr={
|
appellantApplicantRepresentationArr={buildRepsArr(
|
||||||
appellantApplicantRepresentationArr
|
detailsObj
|
||||||
}
|
)}
|
||||||
setRepresentationCapacity={
|
setRepresentationCapacity={
|
||||||
setRepresentationCapacity
|
setRepresentationCapacity
|
||||||
}
|
}
|
||||||
@@ -253,9 +258,9 @@ let MakeRepresentation = (props) => {
|
|||||||
return (
|
return (
|
||||||
<RepInterestedPartyPerson
|
<RepInterestedPartyPerson
|
||||||
formObj={formObj}
|
formObj={formObj}
|
||||||
interestedPersonRepresentationArr={
|
interestedPersonRepresentationArr={buildRepsArr(
|
||||||
interestedPersonRepresentationArr
|
detailsObj
|
||||||
}
|
)}
|
||||||
setRepresentationCapacity={
|
setRepresentationCapacity={
|
||||||
setRepresentationCapacity
|
setRepresentationCapacity
|
||||||
}
|
}
|
||||||
@@ -272,9 +277,9 @@ let MakeRepresentation = (props) => {
|
|||||||
return (
|
return (
|
||||||
<RepLandOwner
|
<RepLandOwner
|
||||||
formObj={formObj}
|
formObj={formObj}
|
||||||
landOwnerRepresentationArr={
|
landOwnerRepresentationArr={buildRepsArr(
|
||||||
landOwnerRepresentationArr
|
detailsObj
|
||||||
}
|
)}
|
||||||
setRepresentationCapacity={
|
setRepresentationCapacity={
|
||||||
setRepresentationCapacity
|
setRepresentationCapacity
|
||||||
}
|
}
|
||||||
@@ -552,15 +557,9 @@ let MakeRepresentation = (props) => {
|
|||||||
|
|
||||||
const repForm = props.props.form;
|
const repForm = props.props.form;
|
||||||
|
|
||||||
console.log(
|
|
||||||
"what is representationSubmit state: " +
|
|
||||||
currentView.representationSubmit,
|
|
||||||
props.initialValues
|
|
||||||
);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let value = props.initialValues;
|
let value = props.initialValues;
|
||||||
console.log("has props"), value;
|
//console.log("has props"), value;
|
||||||
setRepresentationCapacity(
|
setRepresentationCapacity(
|
||||||
props.initialValues.representationCapacity.toLowerCase()
|
props.initialValues.representationCapacity.toLowerCase()
|
||||||
);
|
);
|
||||||
@@ -615,7 +614,392 @@ let MakeRepresentation = (props) => {
|
|||||||
Make a representation on:{" "}
|
Make a representation on:{" "}
|
||||||
{currentView.caseReference.currentReference}
|
{currentView.caseReference.currentReference}
|
||||||
</h1>
|
</h1>
|
||||||
{whichControl()}
|
<div id="rep-form">
|
||||||
|
<div className="govuk-grid-column-three-quarters">
|
||||||
|
{whichControl()}
|
||||||
|
</div>
|
||||||
|
<div className="govuk-grid-column-one-quarter">
|
||||||
|
{" "}
|
||||||
|
<div className="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<h4 className="govuk-heading-s">
|
||||||
|
Timetable
|
||||||
|
</h4>
|
||||||
|
<div className="govuk-summary-list">
|
||||||
|
<div className="govuk-body-s">
|
||||||
|
Questionnaire due:
|
||||||
|
<span className="govuk-body-s">
|
||||||
|
{" "}
|
||||||
|
{formatDates(
|
||||||
|
detailsObj.pinswg_questionnaireduedate
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div className="govuk-body-s">
|
||||||
|
Statements due:
|
||||||
|
<span className="govuk-body-s">
|
||||||
|
{" "}
|
||||||
|
{formatDates(
|
||||||
|
detailsObj.pinswg_statementduedate
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div className="govuk-body-s">
|
||||||
|
Final comments due:
|
||||||
|
<span className="govuk-body-s">
|
||||||
|
{" "}
|
||||||
|
{formatDates(
|
||||||
|
detailsObj.pinswg_finalcommentsduedate
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{formObj.hasOwnProperty(
|
||||||
|
"representationForm"
|
||||||
|
) &&
|
||||||
|
formObj[
|
||||||
|
"representationForm"
|
||||||
|
].hasOwnProperty("values") &&
|
||||||
|
formObj[
|
||||||
|
"representationForm"
|
||||||
|
].values.hasOwnProperty(
|
||||||
|
"representationType"
|
||||||
|
) &&
|
||||||
|
formObj["representationForm"].values
|
||||||
|
.representationType ==
|
||||||
|
"Questionnaire" && (
|
||||||
|
<div
|
||||||
|
id="step-by-step-navigation"
|
||||||
|
data-module="gemstepnav"
|
||||||
|
className="app-step-nav app-step-nav--active"
|
||||||
|
data-id="e01e924b-9c7c-4c71-8241-66a575c2f61f"
|
||||||
|
data-show-text="show"
|
||||||
|
data-hide-text="hide"
|
||||||
|
data-show-all-text="Show all"
|
||||||
|
data-hide-all-text="Hide all"
|
||||||
|
>
|
||||||
|
<ol className="app-step-nav__steps">
|
||||||
|
<li
|
||||||
|
className={
|
||||||
|
"app-step-nav__step js-step app-step-nav__step--active" +
|
||||||
|
" sectionIncomplete"
|
||||||
|
}
|
||||||
|
aria-current="step"
|
||||||
|
data-show=""
|
||||||
|
id="check-youre-allowed-to-drive"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="app-step-nav__header js-toggle-panel "
|
||||||
|
data-position="1"
|
||||||
|
>
|
||||||
|
<h3 className="app-step-nav__title ">
|
||||||
|
<span className="app-step-nav__circle app-step-nav__circle--number">
|
||||||
|
<span className="app-step-nav__circle-inner">
|
||||||
|
<span className="app-step-nav__circle-background">
|
||||||
|
<span className="app-step-nav__circle-step-label govuk-visually-hidden">
|
||||||
|
Step
|
||||||
|
</span>{" "}
|
||||||
|
1
|
||||||
|
<span
|
||||||
|
className="app-step-nav__circle-step-colon govuk-visually-hidden"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
:
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span className="js-step-title">
|
||||||
|
<a
|
||||||
|
href="#"
|
||||||
|
onClick={() => {
|
||||||
|
gotoSection(
|
||||||
|
1
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
className="app-step-nav__button app-step-nav__button--title js-step-title-button"
|
||||||
|
aria-expanded="false"
|
||||||
|
aria-controls="step-panel-check-youre-allowed-to-drive-1"
|
||||||
|
>
|
||||||
|
<span className="js-step-title-text govuk-!-font-size-16">
|
||||||
|
Appeal
|
||||||
|
procedure
|
||||||
|
and
|
||||||
|
site
|
||||||
|
visit
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li
|
||||||
|
className={
|
||||||
|
"app-step-nav__step js-step app-step-nav__step--active" +
|
||||||
|
" sectionComplete"
|
||||||
|
}
|
||||||
|
aria-current="step"
|
||||||
|
data-show=""
|
||||||
|
id="check-youre-allowed-to-drive"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="app-step-nav__header js-toggle-panel "
|
||||||
|
data-position="1"
|
||||||
|
>
|
||||||
|
<h3 className="app-step-nav__title ">
|
||||||
|
<span className="app-step-nav__circle app-step-nav__circle--number">
|
||||||
|
<span className="app-step-nav__circle-inner">
|
||||||
|
<span className="app-step-nav__circle-background">
|
||||||
|
<span className="app-step-nav__circle-step-label govuk-visually-hidden">
|
||||||
|
Step
|
||||||
|
</span>{" "}
|
||||||
|
2
|
||||||
|
<span
|
||||||
|
className="app-step-nav__circle-step-colon govuk-visually-hidden"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
:
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span className="js-step-title">
|
||||||
|
<a
|
||||||
|
href="#"
|
||||||
|
onClick={() => {
|
||||||
|
gotoSection(
|
||||||
|
2
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
className="app-step-nav__button app-step-nav__button--title js-step-title-button"
|
||||||
|
aria-expanded="false"
|
||||||
|
aria-controls="step-panel-check-youre-allowed-to-drive-1"
|
||||||
|
>
|
||||||
|
<span className="js-step-title-text govuk-!-font-size-16">
|
||||||
|
Supporting
|
||||||
|
documents
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li
|
||||||
|
className={
|
||||||
|
"app-step-nav__step js-step app-step-nav__step--active" +
|
||||||
|
" sectionIncomplete"
|
||||||
|
}
|
||||||
|
aria-current="step"
|
||||||
|
data-show=""
|
||||||
|
id="check-youre-allowed-to-drive"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="app-step-nav__header js-toggle-panel "
|
||||||
|
data-position="1"
|
||||||
|
>
|
||||||
|
<h3 className="app-step-nav__title ">
|
||||||
|
<span className="app-step-nav__circle app-step-nav__circle--number">
|
||||||
|
<span className="app-step-nav__circle-inner">
|
||||||
|
<span className="app-step-nav__circle-background">
|
||||||
|
<span className="app-step-nav__circle-step-label govuk-visually-hidden">
|
||||||
|
Step
|
||||||
|
</span>{" "}
|
||||||
|
3
|
||||||
|
<span
|
||||||
|
className="app-step-nav__circle-step-colon govuk-visually-hidden"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
:
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span className="js-step-title">
|
||||||
|
<a
|
||||||
|
href="#"
|
||||||
|
onClick={() => {
|
||||||
|
gotoSection(
|
||||||
|
3
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
className="app-step-nav__button app-step-nav__button--title js-step-title-button"
|
||||||
|
aria-expanded="false"
|
||||||
|
aria-controls="step-panel-check-youre-allowed-to-drive-1"
|
||||||
|
>
|
||||||
|
<span className="js-step-title-text govuk-!-font-size-16">
|
||||||
|
Statutory
|
||||||
|
considerations
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li
|
||||||
|
className={
|
||||||
|
"app-step-nav__step js-step app-step-nav__step--active" +
|
||||||
|
" sectionIncomplete"
|
||||||
|
}
|
||||||
|
aria-current="step"
|
||||||
|
data-show=""
|
||||||
|
id="check-youre-allowed-to-drive"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="app-step-nav__header js-toggle-panel "
|
||||||
|
data-position="1"
|
||||||
|
>
|
||||||
|
<h3 className="app-step-nav__title ">
|
||||||
|
<span className="app-step-nav__circle app-step-nav__circle--number">
|
||||||
|
<span className="app-step-nav__circle-inner">
|
||||||
|
<span className="app-step-nav__circle-background">
|
||||||
|
<span className="app-step-nav__circle-step-label govuk-visually-hidden">
|
||||||
|
Step
|
||||||
|
</span>{" "}
|
||||||
|
4
|
||||||
|
<span
|
||||||
|
className="app-step-nav__circle-step-colon govuk-visually-hidden"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
:
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span className="js-step-title">
|
||||||
|
<a
|
||||||
|
href="#"
|
||||||
|
onClick={() => {
|
||||||
|
gotoSection(
|
||||||
|
4
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
className="app-step-nav__button app-step-nav__button--title js-step-title-button"
|
||||||
|
aria-expanded="false"
|
||||||
|
aria-controls="step-panel-check-youre-allowed-to-drive-1"
|
||||||
|
>
|
||||||
|
<span className="js-step-title-text govuk-!-font-size-16">
|
||||||
|
Suggested
|
||||||
|
considerations
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li
|
||||||
|
className={
|
||||||
|
"app-step-nav__step js-step app-step-nav__step--active" +
|
||||||
|
" sectionIncomplete"
|
||||||
|
}
|
||||||
|
aria-current="step"
|
||||||
|
data-show=""
|
||||||
|
id="check-youre-allowed-to-drive"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="app-step-nav__header js-toggle-panel "
|
||||||
|
data-position="1"
|
||||||
|
>
|
||||||
|
<h3 className="app-step-nav__title ">
|
||||||
|
<span className="app-step-nav__circle app-step-nav__circle--number">
|
||||||
|
<span className="app-step-nav__circle-inner">
|
||||||
|
<span className="app-step-nav__circle-background">
|
||||||
|
<span className="app-step-nav__circle-step-label govuk-visually-hidden">
|
||||||
|
Step
|
||||||
|
</span>{" "}
|
||||||
|
5
|
||||||
|
<span
|
||||||
|
className="app-step-nav__circle-step-colon govuk-visually-hidden"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
:
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span className="js-step-title">
|
||||||
|
<a
|
||||||
|
href="#"
|
||||||
|
onClick={() => {
|
||||||
|
gotoSection(
|
||||||
|
5
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
className="app-step-nav__button app-step-nav__button--title js-step-title-button"
|
||||||
|
aria-expanded="false"
|
||||||
|
aria-controls="step-panel-check-youre-allowed-to-drive-1"
|
||||||
|
>
|
||||||
|
<span className="js-step-title-text govuk-!-font-size-16">
|
||||||
|
Attached
|
||||||
|
links
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li
|
||||||
|
className={
|
||||||
|
"app-step-nav__step js-step app-step-nav__step--active" +
|
||||||
|
" sectionIncomplete"
|
||||||
|
}
|
||||||
|
aria-current="step"
|
||||||
|
data-show=""
|
||||||
|
id="check-youre-allowed-to-drive"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="app-step-nav__header js-toggle-panel "
|
||||||
|
data-position="1"
|
||||||
|
>
|
||||||
|
<h3 className="app-step-nav__title ">
|
||||||
|
<span className="app-step-nav__circle app-step-nav__circle--number">
|
||||||
|
<span className="app-step-nav__circle-inner">
|
||||||
|
<span className="app-step-nav__circle-background">
|
||||||
|
<span className="app-step-nav__circle-step-label govuk-visually-hidden">
|
||||||
|
Step
|
||||||
|
</span>{" "}
|
||||||
|
6
|
||||||
|
<span
|
||||||
|
className="app-step-nav__circle-step-colon govuk-visually-hidden"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
:
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span className="js-step-title">
|
||||||
|
<a
|
||||||
|
href="#"
|
||||||
|
onClick={() => {
|
||||||
|
gotoSection(
|
||||||
|
6
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
className="app-step-nav__button app-step-nav__button--title js-step-title-button"
|
||||||
|
aria-expanded="false"
|
||||||
|
aria-controls="step-panel-check-youre-allowed-to-drive-1"
|
||||||
|
>
|
||||||
|
<span className="js-step-title-text govuk-!-font-size-16">
|
||||||
|
Declaration
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
@@ -626,7 +1010,7 @@ let MakeRepresentation = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
const mapStateToProps = (state) => {
|
||||||
console.log("\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \n in map state", state);
|
//console.log("\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \n in map state", state);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
search: state.search,
|
search: state.search,
|
||||||
|
|||||||
+1
-8
@@ -2,19 +2,12 @@ import _ from "lodash";
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import useTranslation from "next-translate/useTranslation";
|
import useTranslation from "next-translate/useTranslation";
|
||||||
|
import { formatDates } from "../../../utils";
|
||||||
|
|
||||||
let RepLPAQuestionnaireCheck_enforcement = (props) => {
|
let RepLPAQuestionnaireCheck_enforcement = (props) => {
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
const { formObj, currentView, setSubmitBack } = props;
|
const { formObj, currentView, setSubmitBack } = props;
|
||||||
const repFormData = formObj.representationForm.values;
|
const repFormData = formObj.representationForm.values;
|
||||||
function formatDates(dateObj) {
|
|
||||||
var dateObj = new Date(dateObj);
|
|
||||||
var dd = String(dateObj.getDate()).padStart(2, "0");
|
|
||||||
var mm = String(dateObj.getMonth() + 1).padStart(2, "0"); //January is 0!
|
|
||||||
var yyyy = dateObj.getFullYear();
|
|
||||||
|
|
||||||
return dd + "/" + mm + "/" + yyyy;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
+1
-8
@@ -2,19 +2,12 @@ import _ from "lodash";
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import useTranslation from "next-translate/useTranslation";
|
import useTranslation from "next-translate/useTranslation";
|
||||||
|
import { formatDates } from "../../../utils";
|
||||||
|
|
||||||
let RepLPAQuestionnaireCheck_s78 = (props) => {
|
let RepLPAQuestionnaireCheck_s78 = (props) => {
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
const { formObj, currentView, setSubmitBack } = props;
|
const { formObj, currentView, setSubmitBack } = props;
|
||||||
const repFormData = formObj.representationForm.values;
|
const repFormData = formObj.representationForm.values;
|
||||||
function formatDates(dateObj) {
|
|
||||||
var dateObj = new Date(dateObj);
|
|
||||||
var dd = String(dateObj.getDate()).padStart(2, "0");
|
|
||||||
var mm = String(dateObj.getMonth() + 1).padStart(2, "0"); //January is 0!
|
|
||||||
var yyyy = dateObj.getFullYear();
|
|
||||||
|
|
||||||
return dd + "/" + mm + "/" + yyyy;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import transLookup from "../../data/lookuptranslations.json";
|
|||||||
import { getRepresentations } from "../../actions";
|
import { getRepresentations } from "../../actions";
|
||||||
import { setRepresentations } from "../../store/searchOutput/action";
|
import { setRepresentations } from "../../store/searchOutput/action";
|
||||||
import PaginationControl from "./pagination";
|
import PaginationControl from "./pagination";
|
||||||
|
import { formatDates } from "../utils";
|
||||||
|
|
||||||
const RepresentationList = (props) => {
|
const RepresentationList = (props) => {
|
||||||
const { incidentid, representationsObj, setRepresentations } = props;
|
const { incidentid, representationsObj, setRepresentations } = props;
|
||||||
@@ -153,15 +154,6 @@ const RepresentationList = (props) => {
|
|||||||
const representationResultsObj = representationDetailsObj();
|
const representationResultsObj = representationDetailsObj();
|
||||||
}, [incidentid, setRepresentations]);
|
}, [incidentid, setRepresentations]);
|
||||||
|
|
||||||
function formatDates(dateObj) {
|
|
||||||
var dateObj = new Date(dateObj);
|
|
||||||
var dd = String(dateObj.getDate()).padStart(2, "0");
|
|
||||||
var mm = String(dateObj.getMonth() + 1).padStart(2, "0"); //January is 0!
|
|
||||||
var yyyy = dateObj.getFullYear();
|
|
||||||
|
|
||||||
return dd + "/" + mm + "/" + yyyy;
|
|
||||||
}
|
|
||||||
|
|
||||||
const pagesCount = Math.ceil(representationsObj["@odata.count"] / 10);
|
const pagesCount = Math.ceil(representationsObj["@odata.count"] / 10);
|
||||||
|
|
||||||
let currentPage = 0;
|
let currentPage = 0;
|
||||||
|
|||||||
@@ -417,3 +417,21 @@ export const bytesToSize = (bytes) => {
|
|||||||
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
||||||
return Math.round(bytes / Math.pow(1024, i), 2) + " " + sizes[i];
|
return Math.round(bytes / Math.pow(1024, i), 2) + " " + sizes[i];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const formatDates = (dateObj, showTime) => {
|
||||||
|
var dateObj = new Date(dateObj);
|
||||||
|
var dd = String(dateObj.getDate()).padStart(2, "0");
|
||||||
|
var mm = String(dateObj.getMonth() + 1).padStart(2, "0"); //January is 0!
|
||||||
|
var yyyy = dateObj.getFullYear();
|
||||||
|
var hh = dateObj.getHours();
|
||||||
|
hh = ("0" + hh).slice(-2);
|
||||||
|
var mins = dateObj.getMinutes();
|
||||||
|
mins = ("0" + mins).slice(-2);
|
||||||
|
|
||||||
|
const dateStr = showTime
|
||||||
|
? hh == 0 && mins == 0
|
||||||
|
? ""
|
||||||
|
: hh + ":" + mins
|
||||||
|
: dd + "/" + mm + "/" + yyyy + " ";
|
||||||
|
return dateStr;
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user