added back missing files

This commit is contained in:
2021-07-19 21:49:14 +01:00
parent 016c960720
commit de84da00c2
16 changed files with 610 additions and 192 deletions
+48 -42
View File
@@ -2,51 +2,57 @@ import CookieConsent from "react-cookie-consent";
import Link from "next/link";
const CookieBanner = () => {
return (
<CookieConsent
style={{ position: "inherit", background: "#f3f2f1", display: "block" }}
containerClasses="app-cookie-banner"
buttonClasses="govuk-button"
buttonWrapperClasses="govuk-width-container consentBanner"
declineButtonClasses="govuk-button"
buttonText="Accept all cookies"
disableStyles={true}
enableDeclineButton={true}
flipButtons={true}
hideOnAccept={true}
cookieName="preventTrainingConsent"
>
<div className="app-cookie-banner">
<div
id="global-cookie-message"
className="govuk-clearfix"
data-module="cookie-banner"
role="region"
aria-label="cookie banner"
data-nosnippet=""
return (
<CookieConsent
style={{
position: "inherit",
background: "#f3f2f1",
display: "block",
}}
containerClasses="app-cookie-banner"
buttonClasses="govuk-button"
buttonWrapperClasses="govuk-width-container consentBanner"
declineButtonClasses="govuk-button"
buttonText="Accept all cookies"
disableStyles={true}
enableDeclineButton={true}
flipButtons={true}
hideOnAccept={true}
cookieName="planning_casework"
>
<div className="govuk-width-container">
<div className="govuk-grid-row">
<div className="govuk-grid-column-two-thirds">
<div className="">
<h2 className="govuk-heading-m">
Tell us whether you accept cookies
</h2>
<p className="govuk-body">
GOV.UK uses cookies which are essential for the site to
work. We also use non-essential cookies to help us improve
government digital services. Any data collected is
anonymised. By continuing to use this site, you agree to our
use of cookies.
</p>
<div className="app-cookie-banner">
<div
id="global-cookie-message"
className="govuk-clearfix"
data-module="cookie-banner"
role="region"
aria-label="cookie banner"
data-nosnippet=""
>
<div className="govuk-width-container">
<div className="govuk-grid-row">
<div className="govuk-grid-column-two-thirds">
<div className="">
<h2 className="govuk-heading-m">
Tell us whether you accept cookies
</h2>
<p className="govuk-body">
GOV.UK uses cookies which are essential
for the site to work. We also use
non-essential cookies to help us improve
government digital services. Any data
collected is anonymised. By continuing
to use this site, you agree to our use
of cookies.
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</CookieConsent>
);
</CookieConsent>
);
};
export default CookieBanner;
+9 -5
View File
@@ -186,7 +186,10 @@ const RenderPickList = ({
if (errorStr)
return (
<div className="govuk-form-group">
<label className="govuk-label govuk-body-m" htmlFor="sort">
<label
className="govuk-label govuk-body-m"
htmlFor={props.name}
>
{label}
</label>
<select className="govuk-select" id={name} name={name}>
@@ -206,6 +209,7 @@ const RenderPickList = ({
return (
<div>
<select {...input} className="govuk-select" id={name} name={name}>
<option>Select...</option>
{Object.keys(dropdownObj).map((key, index) => {
return (
<option
@@ -231,7 +235,7 @@ export function PickList(props) {
return (
<div className="govuk-form-group">
<label className="govuk-label govuk-body-m" htmlFor="sort">
<label className="govuk-label govuk-body-m" htmlFor={props.name}>
{props.label}
</label>
<Field
@@ -248,7 +252,7 @@ export function NumericField(props) {
return (
<div className="govuk-form-group">
<label className="govuk-label" htmlFor="account-number">
<label className="govuk-label" htmlFor={props.name}>
{props.label}
</label>
<Field
@@ -271,7 +275,7 @@ export function DecimalField(props) {
return (
<div className="govuk-form-group">
<label className="govuk-label" htmlFor="account-number">
<label className="govuk-label" htmlFor={props.name}>
{props.label}
</label>
<Field
@@ -294,7 +298,7 @@ export function ReadOnlyfield(props) {
return (
<div className="govuk-form-group">
<label className="govuk-label " htmlFor="event-name">
<label className="govuk-label " htmlFor={props.name}>
{props.label}
</label>
<Field
+10 -10
View File
@@ -61,16 +61,16 @@ export default function Header({ courseName }) {
</div>
<div className="govuk-header__content govuk-!-width-two-thirds govuk-!-margin-top-3">
<Link href="/">
<a
onClick={() => {
window.localStorage.clear();
}}
className="govuk-header__link govuk-header__link--service-name"
>
{t("common:service-name")}
</a>
</Link>
<a
href="/"
onClick={() => {
window.localStorage.clear();
}}
className="govuk-header__link
govuk-header__link--service-name"
>
{t("common:service-name")}
</a>
</div>
<div className="languageSwitch">
{router.path}
+70 -67
View File
@@ -3,54 +3,55 @@ import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
export default function Login() {
let { t } = useTranslation();
let { t } = useTranslation();
const router = useRouter();
const { locale } = router;
return (
<div className="card" id="login-card">
<div className="card-body active">
<h3 className="heading-small card-heading">{t("home:login-card-title")}</h3>
const router = useRouter();
const { locale } = router;
return (
<div className="card" id="login-card">
<div className="card-body active">
<h3 className="heading-small card-heading">
{t("home:login-card-title")}
</h3>
<form action="/myportal" method="POST" id="loginForm">
<div className="govuk-form-group">
{" "}
<label
htmlFor="user_id"
className="govuk-label"
aria-describedby="user_id-hint"
>
{t("home:login-card-id-label")}
</label>
<div className="govuk-hint" id="user_id-hint">
{t("home:login-card-id-hint")}
</div>
<input
type="text"
name="user_id"
id="user_id"
className="govuk-input govuk-!-width-one-half"
value=""
maxLength="22"
aria-describedby="user_id-hint"
autoComplete="username"
/>
</div>
<div className="govuk-form-group">
{" "}
<label htmlFor="password" className="govuk-label">
{t("home:login-card-password-label")}
</label>
<input
type="password"
name="password"
id="password"
className="govuk-input govuk-!-width-three-quarters"
autoComplete="current-password"
/>
</div>
<div className="govuk-form-group">
{/* <button
<form action="/myportal" method="POST" id="loginForm">
<div className="govuk-form-group">
{" "}
<label
htmlFor="user_id"
className="govuk-label"
aria-describedby="user_id-hint"
>
{t("home:login-card-id-label")}
</label>
<div className="govuk-hint" id="user_id-hint">
{t("home:login-card-id-hint")}
</div>
<input
type="text"
name="user_id"
id="user_id"
className="govuk-input govuk-!-width-one-half"
maxLength="22"
aria-describedby="user_id-hint"
autoComplete="username"
/>
</div>
<div className="govuk-form-group">
{" "}
<label htmlFor="password" className="govuk-label">
{t("home:login-card-password-label")}
</label>
<input
type="password"
name="password"
id="password"
className="govuk-input govuk-!-width-three-quarters"
autoComplete="current-password"
/>
</div>
<div className="govuk-form-group">
{/* <button
type="submit"
className="govuk-button"
data-module="govuk-button"
@@ -59,26 +60,28 @@ export default function Login() {
>
{t("home:login-card-button")}
</button> */}
<Link href="/myportal">
<a className="govuk-button">{t("home:login-card-button")}</a>
</Link>
</div>
</form>
<div className="govuk-form-group govuk-!-margin-top-4">
<p className="govuk-body-s">
{t("home:login-card-register-label")}{" "}
<Link href="/">
<a>{t("home:login-card-register-link")}</a>
</Link>
</p>
<p className="govuk-body-s">
{t("home:login-card-forgotten-label")}{" "}
<Link href="/">
<a>{t("home:login-card-forgotten-link")}</a>
</Link>
</p>
<Link href="/myportal">
<a className="govuk-button">
{t("home:login-card-button")}
</a>
</Link>
</div>
</form>
<div className="govuk-form-group govuk-!-margin-top-4">
<p className="govuk-body-s">
{t("home:login-card-register-label")}{" "}
<Link href="/">
<a>{t("home:login-card-register-link")}</a>
</Link>
</p>
<p className="govuk-body-s">
{t("home:login-card-forgotten-label")}{" "}
<Link href="/">
<a>{t("home:login-card-forgotten-link")}</a>
</Link>
</p>
</div>
</div>
</div>
</div>
</div>
);
);
}
+1 -1
View File
@@ -122,7 +122,7 @@ let BuildSection = (props) => {
<ol className="govuk-list">
{Object.keys(titleList).map((key) =>
parseInt(key) + 1 == currentSection ? (
<li>
<li key={key}>
<b>{titleList[key].value}</b>
</li>
) : (
+198
View File
@@ -0,0 +1,198 @@
import Link from "next/link";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import { useState, useEffect } from "react";
import xpath from "xpath";
import BuildRow from "./buildrow";
import { reduxForm, formValueSelector, Field } from "redux-form";
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
import jsonpath from "jsonpath";
import {
setAppealType,
setAppealTypeTitle,
setAppealTypeID,
setAppealLPA,
getAppealTypeObj,
} from "../../store/appealType/action";
let CreateCase = (props) => {
// useEffect(() => {
// window.scrollTo(0, 0);
// });
let { t } = useTranslation();
const router = useRouter();
const { locale } = router;
const { LPAData, onSubmit, handleSubmit } = props;
const appealOptionsObj = props.appealType.appealTypeOptions.GlobalOptionSet
.Options || [{}];
let lpaOptionsObj = jsonpath.query(props.LPAData.LPAData, "$..name");
const RenderLPAList = ({
name,
input,
optionsObj,
meta: { touched, error },
}) => {
return (
<div>
<select
{...input}
className="govuk-select"
id="lpatypes"
name={name}
//onChange={(e) => props.onChangeSelectLPA(e)}
>
<option>Select...</option>
{Object.keys(optionsObj).map((key, index) => {
return (
<option key={key} value={optionsObj[key]}>
{optionsObj[key]}
</option>
);
})}
</select>
{touched && error && <span>{error}</span>}
</div>
);
};
const RenderAppealTypeList = ({
name,
input,
optionsObj,
meta: { touched, error },
}) => {
return (
<div>
<select
{...input}
className="govuk-select"
id="appealTypes"
name={name}
//onChange={(e) => props.onChangeSelectAppealType(e)}
>
<option>Select...</option>
{Object.keys(optionsObj).map((key, index) => {
return (
<option
key={key}
value={optionsObj[
key
].Label.LocalizedLabels[0].Label.replace(
/[\s\-\+\(\)\,]/g,
""
).toLowerCase()}
>
{optionsObj[key].Label.LocalizedLabels[0].Label}
</option>
);
})}
</select>
{touched && error && <span>{error}</span>}
</div>
);
};
const onHandleSubmit = (values) => {
event.preventDefault();
router.replace("/newappeal/" + values.appealTypes, null, {
shallow: true,
});
console.log(values);
};
return (
<form onSubmit={handleSubmit(onHandleSubmit)}>
<div className="govuk-form-group">
<label className="govuk-label" htmlFor="sort">
Select your local planning authority
</label>
<Field
name="lpaTypes"
component={RenderLPAList}
optionsObj={lpaOptionsObj}
/>
{/* <select
className="govuk-select"
id="appealTypes"
name="appealTypes"
onChange={(e) => props.onChangeSelectLPA(e)}
>
{" "}
<option>Select...</option>
{lpaOptions}
</select> */}
</div>
<div className="govuk-form-group">
<label className="govuk-label" htmlFor="sort">
Select an appeal type
</label>
<Field
name="appealTypes"
component={RenderAppealTypeList}
optionsObj={appealOptionsObj}
/>
{/* <select
className="govuk-select"
id="appealTypes"
name="appealTypes"
onChange={(e) => props.onChangeSelectAppealType(e)}
>
<option>Select...</option>
{appealOptions}
</select> */}
</div>
<button
type="submit"
className="govuk-button"
data-module="govuk-button"
>
Continue
</button>
</form>
);
};
const mapStateToProps = (state) => {
return {
search: state.search,
searchResultsObj: state.searchResultsObj,
formData: state.formData,
appealType: state.appealType,
//form: state.form,
};
};
const mapDispatchToProps = (dispatch) => {
return {
onChangeSelectAppealType: (event) => {
dispatch(
setAppealTypeTitle(
event.target.options[event.target.selectedIndex].text
)
);
dispatch(setAppealTypeID(event.target.value));
},
onChangeSelectLPA: (event) => {
dispatch(setAppealLPA(event.target.value));
},
};
};
const selector = formValueSelector("caseForm"); // <-- same as form name
export default connect(
mapStateToProps,
mapDispatchToProps
)(
reduxForm({
form: "caseForm",
destroyOnUnmount: false,
})(CreateCase)
);