added back missing files
This commit is contained in:
+4
-3
@@ -5,7 +5,7 @@ import https from "https";
|
||||
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
|
||||
|
||||
let BASE_URL;
|
||||
BASE_URL = process.env.API_ROOT || "http://localhost";
|
||||
BASE_URL = process.env.API_ROOT || "http://localhost:3000";
|
||||
|
||||
const agent = new https.Agent({
|
||||
rejectUnauthorized: false,
|
||||
@@ -182,11 +182,12 @@ export const getAppealTypeDetail = (caseReference, appealcasetype) => {
|
||||
//https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/pinswg_planningappeals78s?$filter=pinswg_name eq 'CAS-00015-L7J9H1'
|
||||
|
||||
export const getLPA = () => {
|
||||
console.log("got to axios", searchString);
|
||||
console.log("api_root: ", BASE_URL);
|
||||
return axios
|
||||
|
||||
.get(
|
||||
"https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/accounts?$select=name",
|
||||
BASE_URL + "/api/lookups/pinswg_lpa",
|
||||
//.get("https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/accounts?$select=name",
|
||||
{ httpsAgent: new https.Agent({ rejectUnauthorized: false }) }
|
||||
)
|
||||
.then((res) => res.data)
|
||||
|
||||
+48
-42
@@ -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;
|
||||
|
||||
@@ -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
@@ -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}
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
) : (
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
@@ -76,8 +76,6 @@ const Home = (props) => {
|
||||
// };
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
console.log(state);
|
||||
|
||||
return {
|
||||
search: state.search,
|
||||
};
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
const ApiResponse = (req, res) => {
|
||||
res.statusCode = 200;
|
||||
res.json({
|
||||
"@odata.context":
|
||||
"https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/$metadata#accounts(name)",
|
||||
"@odata.count": 30,
|
||||
"value": [
|
||||
{
|
||||
"@odata.etag": 'W/"547952"',
|
||||
"name": "Bridgend CBC",
|
||||
"accountid": "56e7ef63-7e64-eb11-aaba-00224800be9c",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"694923"',
|
||||
"name": "Bishop Landaff High School",
|
||||
"accountid": "c9389617-82ad-eb11-aac3-00224800be9c",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"694925"',
|
||||
"name": "Stanwell High school",
|
||||
"accountid": "24537624-82ad-eb11-aac3-00224800be9c",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"762163"',
|
||||
"name": "Barry Boys High School",
|
||||
"accountid": "80d99a34-82ad-eb11-aac3-00224800be9c",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"694929"',
|
||||
"name": "St Sirus High School",
|
||||
"accountid": "6d337b5a-82ad-eb11-aac3-00224800be9c",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"694931"',
|
||||
"name": "Fitzalan High School",
|
||||
"accountid": "984d0e75-82ad-eb11-aac3-00224800be9c",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"757759"',
|
||||
"name": "Zoe",
|
||||
"accountid": "41fead24-29ba-eb11-aac4-00224800be9c",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"755100"',
|
||||
"name": "Blaenau Gwent County Borough Council",
|
||||
"accountid": "744c69f4-48da-eb11-aac5-00224800be9c",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"755102"',
|
||||
"name": "Caerphilly County Borough Council",
|
||||
"accountid": "243c0009-49da-eb11-aac5-00224800be9c",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"757756"',
|
||||
"name": "Test 2",
|
||||
"accountid": "bf14b684-8ee0-eb11-aac5-00224800be9c",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"755104"',
|
||||
"name": "Bridgend County Borough Council",
|
||||
"accountid": "c35f6f84-49da-eb11-aabd-00224800d1bd",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"755106"',
|
||||
"name": "Cardiff Council",
|
||||
"accountid": "c75f6f84-49da-eb11-aabd-00224800d1bd",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"755108"',
|
||||
"name": "Carmarthenshire County Council",
|
||||
"accountid": "c95f6f84-49da-eb11-aabd-00224800d1bd",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"755110"',
|
||||
"name": "Ceredigion County Council",
|
||||
"accountid": "cb5f6f84-49da-eb11-aabd-00224800d1bd",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"755112"',
|
||||
"name": "Conwy County Borough Council",
|
||||
"accountid": "cd5f6f84-49da-eb11-aabd-00224800d1bd",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"755114"',
|
||||
"name": "Denbighshire County Council",
|
||||
"accountid": "cf5f6f84-49da-eb11-aabd-00224800d1bd",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"755116"',
|
||||
"name": "Flintshire County Council",
|
||||
"accountid": "d15f6f84-49da-eb11-aabd-00224800d1bd",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"755118"',
|
||||
"name": "Gwynedd Council",
|
||||
"accountid": "d35f6f84-49da-eb11-aabd-00224800d1bd",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"755120"',
|
||||
"name": "Isle of Anglesey County Council",
|
||||
"accountid": "d55f6f84-49da-eb11-aabd-00224800d1bd",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"755122"',
|
||||
"name": "Merthyr Tydfil County Borough Council",
|
||||
"accountid": "d75f6f84-49da-eb11-aabd-00224800d1bd",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"755124"',
|
||||
"name": "Monmouthshire County Council",
|
||||
"accountid": "d95f6f84-49da-eb11-aabd-00224800d1bd",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"755126"',
|
||||
"name": "Neath Port Talbot County Borough Council",
|
||||
"accountid": "db5f6f84-49da-eb11-aabd-00224800d1bd",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"755128"',
|
||||
"name": "Newport City Council",
|
||||
"accountid": "dd5f6f84-49da-eb11-aabd-00224800d1bd",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"755130"',
|
||||
"name": "Pembrokeshire County Council",
|
||||
"accountid": "df5f6f84-49da-eb11-aabd-00224800d1bd",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"755132"',
|
||||
"name": "Powys County Council",
|
||||
"accountid": "e15f6f84-49da-eb11-aabd-00224800d1bd",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"755134"',
|
||||
"name": "Rhondda Cynon Taf County Borough Council",
|
||||
"accountid": "e35f6f84-49da-eb11-aabd-00224800d1bd",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"755136"',
|
||||
"name": "Swansea Council",
|
||||
"accountid": "e55f6f84-49da-eb11-aabd-00224800d1bd",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"755138"',
|
||||
"name": "Torfaen County Borough Council",
|
||||
"accountid": "e75f6f84-49da-eb11-aabd-00224800d1bd",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"755140"',
|
||||
"name": "Vale of Glamorgan Council",
|
||||
"accountid": "e95f6f84-49da-eb11-aabd-00224800d1bd",
|
||||
},
|
||||
{
|
||||
"@odata.etag": 'W/"755142"',
|
||||
"name": "Wrexham County Borough Council",
|
||||
"accountid": "eb5f6f84-49da-eb11-aabd-00224800d1bd",
|
||||
},
|
||||
],
|
||||
});
|
||||
};
|
||||
export default ApiResponse;
|
||||
+7
-17
@@ -13,6 +13,7 @@ import { wrapper } from "../store/store";
|
||||
import Cookies from "cookies";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { getIncidents } from "../actions";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
@@ -40,25 +41,14 @@ const Home = (props) => {
|
||||
};
|
||||
|
||||
// export const getServerSideProps = wrapper.getServerSideProps(
|
||||
// async ({ locale, store, req, res }) => {
|
||||
// const token = await getToken();
|
||||
// let accessToken = token.access_token;
|
||||
|
||||
// const apiRoot = process.browser ? window.API_ROOT : process.env.API_ROOT;
|
||||
|
||||
// const [pages, footerLinks, courseListContent] = await Promise.all([
|
||||
// await getPages(accessToken, locale),
|
||||
// await getFooterLinks(accessToken, locale),
|
||||
// await getCourseList(accessToken, locale),
|
||||
// ]);
|
||||
// //const courseID = await getCourseID
|
||||
// store.dispatch(setApiRoot(apiRoot));
|
||||
// store.dispatch(setPages(pages));
|
||||
// store.dispatch(setFooterLinks(footerLinks));
|
||||
// store.dispatch(setCourseListContent(courseListContent));
|
||||
// }
|
||||
// (store) =>
|
||||
// async ({ query, req, res }) => {
|
||||
// const incidents = await getIncidents;
|
||||
// console.log(incidents);
|
||||
// }
|
||||
// );
|
||||
|
||||
|
||||
// const mapStateToProps = (state) => {
|
||||
// //console.log(state);
|
||||
|
||||
|
||||
+48
-40
@@ -1,10 +1,10 @@
|
||||
import Link from "next/link";
|
||||
import _ from "lodash";
|
||||
import Head from "next/head";
|
||||
import Header from "../../components/header";
|
||||
import Banner from "../../components/banner";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import NewAppeal from "../../components/newappeal";
|
||||
import Footer from "../../components/footer";
|
||||
import Errorpage from "../../components/errorpage";
|
||||
import styles from "../../styles/Home.module.css";
|
||||
@@ -12,70 +12,76 @@ import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../../store/store";
|
||||
import Cookies from "cookies";
|
||||
import { useRouter } from "next/router";
|
||||
import { useState } from "react";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import jsonpath from "jsonpath";
|
||||
import { reduxForm, formValueSelector } from "redux-form";
|
||||
|
||||
import CreateCase from "../../components/newappeal/createCase";
|
||||
import xpath from "xpath";
|
||||
import {
|
||||
setAppealType,
|
||||
setAppealTypeTitle,
|
||||
setAppealTypeID,
|
||||
setAppealLPA,
|
||||
getAppealTypeObj,
|
||||
} from "../../store/appealType/action";
|
||||
import { getAppealsTypes, getLPA } from "../../actions";
|
||||
import { setLPA } from "../../store/lpa/action";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
const { footerLinks, pages, formData } = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
const { appealtypes } = router.query;
|
||||
|
||||
const { appealType, LPAData } = props;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Head>
|
||||
<title>
|
||||
{t("newappeal:page-title")} - {t("common:service-name")}
|
||||
{t("search:page-title")} - {t("common:service-name")}
|
||||
</title>
|
||||
</Head>
|
||||
<div id="page_wrapper">
|
||||
<CookieBanner />
|
||||
<Header courseName={t("common:service-name")} />
|
||||
<div className="govuk-width-container">
|
||||
<Banner />
|
||||
<Breadcrumbs slug={appealtypes} />
|
||||
<NewAppeal />
|
||||
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-full">
|
||||
<div className="govuk-width-container">
|
||||
<Banner />
|
||||
<Breadcrumbs slug={appealtypes} />
|
||||
|
||||
<h1>New Appeal</h1>
|
||||
<CreateCase
|
||||
LPAData={props.LPAData}
|
||||
appealType={props.setAppealType}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Footer footerLinks={footerLinks} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
// export const getServerSideProps = wrapper.getServerSideProps(
|
||||
// async ({ locale, store, req, res }) => {
|
||||
// const token = await getToken();
|
||||
// let accessToken = token.access_token;
|
||||
|
||||
// const apiRoot = process.browser ? window.API_ROOT : process.env.API_ROOT;
|
||||
|
||||
// const [pages, footerLinks, courseListContent] = await Promise.all([
|
||||
// await getPages(accessToken, locale),
|
||||
// await getFooterLinks(accessToken, locale),
|
||||
// await getCourseList(accessToken, locale),
|
||||
// ]);
|
||||
// //const courseID = await getCourseID
|
||||
// store.dispatch(setApiRoot(apiRoot));
|
||||
// store.dispatch(setPages(pages));
|
||||
// store.dispatch(setFooterLinks(footerLinks));
|
||||
// store.dispatch(setCourseListContent(courseListContent));
|
||||
// }
|
||||
// );
|
||||
|
||||
// const mapStateToProps = (state) => {
|
||||
// //console.log(state);
|
||||
|
||||
// return {
|
||||
// apiroot: state.apiroot,
|
||||
// courseListContent: state.courseListContent.courseListContent,
|
||||
// pages: state.pages.pages,
|
||||
// footerLinks: state.footerLinks.footerLinks,
|
||||
// regions: state.regions,
|
||||
// sectors: state.sectors,
|
||||
// form: state.form,
|
||||
// };
|
||||
// };
|
||||
export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) =>
|
||||
async ({ query, req, res }) => {
|
||||
const appealTypeData = await getAppealsTypes();
|
||||
const lpaData = await getLPA();
|
||||
console.log("appeal types", appealTypeData);
|
||||
console.log("lpa typeswwwww", lpaData);
|
||||
store.dispatch(setAppealType(appealTypeData));
|
||||
store.dispatch(setLPA(lpaData));
|
||||
}
|
||||
);
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
@@ -83,6 +89,8 @@ const mapStateToProps = (state) => {
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
LPAData: state.LPAData,
|
||||
form: state.form,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ export const appealTypeDataActionTypes = {
|
||||
SETAPPEALTYPETITLEDATA: "SETAPPEALTYPETITLEDATA",
|
||||
UPDATEAPPEALTYPEDATA: "UPDATEAPPEALTYPEDATA",
|
||||
SETCURRENTSECTION: "SETCURRENTSECTION",
|
||||
SETAPPEALLPA: "SETAPPEALLPA",
|
||||
};
|
||||
|
||||
export const getAppealTypeObj = () => (dispatch) => {
|
||||
@@ -41,3 +42,9 @@ export const setCurrentSection = (currentSection) => (dispatch) => {
|
||||
currentSection: currentSection,
|
||||
});
|
||||
};
|
||||
export const setAppealLPA = (appealLPA) => (dispatch) => {
|
||||
return dispatch({
|
||||
type: appealTypeDataActionTypes.SETAPPEALLPA,
|
||||
appealLPA: appealLPA,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -5,6 +5,7 @@ const appealTypeDataInitialState = {
|
||||
appealTypeTitle: {},
|
||||
appealTypeID: {},
|
||||
currentSection: 1,
|
||||
appealLPA: "",
|
||||
};
|
||||
|
||||
export default function reducer(state = appealTypeDataInitialState, action) {
|
||||
@@ -29,6 +30,12 @@ export default function reducer(state = appealTypeDataInitialState, action) {
|
||||
...state,
|
||||
currentSection: action.currentSection,
|
||||
};
|
||||
case appealTypeDataActionTypes.SETAPPEALLPA:
|
||||
return {
|
||||
...state,
|
||||
appealLPA: action.appealLPA,
|
||||
};
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import { actionTypes } from "redux-form";
|
||||
|
||||
export const LPADataActionTypes = {
|
||||
GETLPADATA: "GETLPADATA",
|
||||
SETLPADATA: "SETLPADATA",
|
||||
};
|
||||
|
||||
export const getLPAObj = () => (dispatch) => {
|
||||
return dispatch({
|
||||
type: LPADataActionTypes.GETLPADATA,
|
||||
});
|
||||
};
|
||||
|
||||
export const setLPA = (lpaData) => (dispatch) => {
|
||||
return dispatch({
|
||||
type: LPADataActionTypes.SETLPADATA,
|
||||
LPAData: lpaData,
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
import { LPADataActionTypes } from "./action";
|
||||
|
||||
const LPADataInitialState = {
|
||||
LPAData: {},
|
||||
};
|
||||
|
||||
export default function reducer(state = LPADataInitialState, action) {
|
||||
switch (action.type) {
|
||||
case LPADataActionTypes.SETLPADATA:
|
||||
return {
|
||||
...state,
|
||||
LPAData: action.LPAData,
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
+4
-5
@@ -1,28 +1,27 @@
|
||||
import { createStore, applyMiddleware, combineReducers } from "redux";
|
||||
import { createWrapper, HYDRATE } from "next-redux-wrapper";
|
||||
import thunkMiddleware from "redux-thunk";
|
||||
import progress from "./progress/reducer";
|
||||
import search from "./search/reducer";
|
||||
import searchResultsObj from "./searchOutput/reducer";
|
||||
import formData from "./formData/reducer";
|
||||
import appealType from "./appealType/reducer";
|
||||
import LPAData from "./lpa/reducer";
|
||||
import { reducer as formReducer } from "redux-form";
|
||||
import autoMergeLevel2 from "redux-persist/lib/stateReconciler/autoMergeLevel2";
|
||||
|
||||
//COMBINING ALL REDUCERS
|
||||
const combinedReducer = combineReducers({
|
||||
progress,
|
||||
search,
|
||||
searchResultsObj,
|
||||
formData,
|
||||
appealType,
|
||||
LPAData,
|
||||
form: formReducer,
|
||||
});
|
||||
|
||||
const reducer = (state = { progress: "{}" }, action) => {
|
||||
const reducer = (state = {}, action) => {
|
||||
switch (action.type) {
|
||||
case HYDRATE:
|
||||
//if (action.payload.progress === '{}') delete action.payload.progress;
|
||||
return { ...state, ...action.payload };
|
||||
case "SERVER_ACTION":
|
||||
return {
|
||||
@@ -78,12 +77,12 @@ const makeStore = ({ isServer }) => {
|
||||
const persistConfig = {
|
||||
key: "nextjs",
|
||||
whitelist: [
|
||||
"progress",
|
||||
"search",
|
||||
"searchResults",
|
||||
"formData",
|
||||
"appealType",
|
||||
"form",
|
||||
"LPAData",
|
||||
],
|
||||
storage,
|
||||
stateReconciler: autoMergeLevel2, // if needed, use a safer storage
|
||||
|
||||
Reference in New Issue
Block a user