fomrs split out
This commit is contained in:
+21
-3
@@ -27,6 +27,13 @@ export default function Footer(props) {
|
||||
: setShowShareState(true);
|
||||
};
|
||||
|
||||
console.log(router.asPath);
|
||||
const shareBodyStr = t("common:gov-wales-link") + router.asPath;
|
||||
const shareSubjectStr =
|
||||
t("common:social-shared-from") +
|
||||
" " +
|
||||
t("common:gov-wales-label").toLowerCase();
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="sharebar" id="sharebar">
|
||||
@@ -60,7 +67,10 @@ export default function Footer(props) {
|
||||
>
|
||||
<li>
|
||||
<a
|
||||
href="https://twitter.com/intent/tweet?url=https%3A//gov.wales/"
|
||||
href={
|
||||
"https://twitter.com/intent/tweet?url=" +
|
||||
shareBodyStr
|
||||
}
|
||||
className="twitter"
|
||||
>
|
||||
<span className="vo_hidden">
|
||||
@@ -73,7 +83,10 @@ export default function Footer(props) {
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="https://www.facebook.com/sharer/sharer.php?u=https%3A//gov.wales/"
|
||||
href={
|
||||
"https://www.facebook.com/sharer/sharer.php?u=" +
|
||||
shareBodyStr
|
||||
}
|
||||
className="facebook"
|
||||
>
|
||||
<span className="vo_hidden">
|
||||
@@ -84,7 +97,12 @@ export default function Footer(props) {
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="mailto:?body=https%3A//gov.wales/&subject=Shared%20from%20gov.wales"
|
||||
href={
|
||||
"mailto:?body=" +
|
||||
shareBodyStr +
|
||||
"&subject=" +
|
||||
shareSubjectStr
|
||||
} //</li>https%3A//gov.wales/&subject=Shared%20from%20gov.wales"
|
||||
className="email"
|
||||
>
|
||||
<span className="vo_hidden">
|
||||
|
||||
+17
-3
@@ -88,7 +88,9 @@ const Header = (props) => {
|
||||
</div>
|
||||
|
||||
<div className="govuk-header__content govuk-!-width-one-half govuk-!-margin-top-3">
|
||||
<Link href="/logout">
|
||||
<Link
|
||||
href={router.locale == "cy" ? "/allgofnodi" : "/logout"}
|
||||
>
|
||||
<a
|
||||
onClick={() => {
|
||||
window.localStorage.clear();
|
||||
@@ -140,7 +142,13 @@ const Header = (props) => {
|
||||
""
|
||||
) : (
|
||||
<li>
|
||||
<Link href="/logout">
|
||||
<Link
|
||||
href={
|
||||
router.locale == "cy"
|
||||
? "/allgofnodi"
|
||||
: "/logout"
|
||||
}
|
||||
>
|
||||
<a
|
||||
onClick={() => {
|
||||
window.localStorage.clear();
|
||||
@@ -213,7 +221,13 @@ const Header = (props) => {
|
||||
{noSignoutLink.includes(router.pathname) == true ? (
|
||||
""
|
||||
) : (
|
||||
<Link href="/logout">
|
||||
<Link
|
||||
href={
|
||||
router.locale == "cy"
|
||||
? "/allgofnodi"
|
||||
: "/logout"
|
||||
}
|
||||
>
|
||||
<a
|
||||
onClick={() => {
|
||||
window.localStorage.clear();
|
||||
|
||||
@@ -15,8 +15,8 @@ export default function CaseComment() {
|
||||
</h3>
|
||||
<p className="govuk-body-s">
|
||||
{t("home:casescomment-card-paragraph-one")}{" "}
|
||||
<a href="mailto:Casework.PEDW@gov.wales">
|
||||
Casework.PEDW@gov.wales
|
||||
<a href={"mailto:" + t("home:login-contact-email")}>
|
||||
{t("home:login-contact-email")}
|
||||
</a>
|
||||
</p>
|
||||
<p className="govuk-body-s">
|
||||
|
||||
@@ -125,7 +125,13 @@ let CaseSearch = (props) => {
|
||||
{t("home:casesearch-card-button")}
|
||||
</button>
|
||||
</div>
|
||||
<Link href="/advancedsearch">
|
||||
<Link
|
||||
href={
|
||||
router.locale == "cy"
|
||||
? "/chwiliouwch"
|
||||
: "/advancedsearch"
|
||||
}
|
||||
>
|
||||
<a>{t("home:casesearch-card-advanced-link")}</a>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
@@ -60,7 +60,13 @@ export default function Login() {
|
||||
>
|
||||
{t("home:login-card-button")}
|
||||
</button> */}
|
||||
<Link href="/myportal">
|
||||
<Link
|
||||
href={
|
||||
router.locale == "cy"
|
||||
? "/fymhorth"
|
||||
: "/myportal"
|
||||
}
|
||||
>
|
||||
<a className="govuk-button">
|
||||
{t("home:login-card-button")}
|
||||
</a>
|
||||
|
||||
@@ -17,8 +17,8 @@ export default function LoginSoon() {
|
||||
<div className="govuk-form-group govuk-!-margin-top-4">
|
||||
<p className="govuk-body-s">
|
||||
{t("home:login-comingsoon-temp-1")}{" "}
|
||||
<a href="mailto:Casework.PEDW@gov.wales">
|
||||
Casework.PEDW@gov.wales
|
||||
<a href={"mailto:" + t("home:login-contact-email")}>
|
||||
{t("home:login-contact-email")}
|
||||
</a>
|
||||
</p>
|
||||
<p className="govuk-body-s">
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ export default function Home({ children, pages }) {
|
||||
<CaseSearch />
|
||||
<CaseComment />
|
||||
<Dns />
|
||||
{/* <Login /> */}
|
||||
<Login />
|
||||
<Inspectorate />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,95 +2,177 @@ import Link from "next/link";
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { connect } from "react-redux";
|
||||
import { Field, reduxForm } from "redux-form";
|
||||
import LoadingOverlay from "react-loading-overlay";
|
||||
|
||||
export default function SearchCases() {
|
||||
const required = (errorMsg) => (value) =>
|
||||
value || typeof value === "number" ? undefined : errorMsg;
|
||||
|
||||
export const minLength = (errorMsg) => (value) =>
|
||||
value && value.length < 4
|
||||
? errorMsg //`Must be ${min} characters or more`
|
||||
: undefined;
|
||||
|
||||
const RenderTextfield = ({
|
||||
id,
|
||||
className,
|
||||
rows,
|
||||
datafieldname,
|
||||
name,
|
||||
label,
|
||||
input,
|
||||
hint1,
|
||||
hint2,
|
||||
meta: { touched, error },
|
||||
...custom
|
||||
}) => {
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
className={
|
||||
touched && error
|
||||
? "govuk-form-group govuk-form-group--error"
|
||||
: "govuk-form-group "
|
||||
}
|
||||
>
|
||||
<div id="basicSearch-hint" className="govuk-hint ">
|
||||
<span className="govuk-body-m">{hint1}</span>
|
||||
|
||||
<br />
|
||||
<span className="govuk-body-s">
|
||||
{hint2} CAS-00009-W8N6W4
|
||||
</span>
|
||||
</div>
|
||||
<label className="govuk-label " htmlFor={id} id={id + "_label"}>
|
||||
{label}
|
||||
</label>
|
||||
{touched && error && (
|
||||
<span id={id + "-error"} className="govuk-error-message">
|
||||
<span className="govuk-visually-hidden">Error:</span>{" "}
|
||||
{error}
|
||||
</span>
|
||||
)}
|
||||
<input {...input} className={className} name={name} id={id} />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
let CaseSearch = (props) => {
|
||||
let { t } = useTranslation();
|
||||
const { handleSubmit, pristine, reset, submitting } = props;
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
const [query, setQuery] = useState("");
|
||||
const [validationError, setValidationError] = useState("");
|
||||
const handleParam = (setValue) => (e) => setValue(e.target.value);
|
||||
|
||||
const basicSearch = (event) => {
|
||||
event.preventDefault();
|
||||
const [showSpinnerState, setShowSpinnerState] = useState(false);
|
||||
|
||||
if (query == "" || query == null) {
|
||||
setValidationError(true);
|
||||
} else {
|
||||
setValidationError(false);
|
||||
console.log(query);
|
||||
// /searchresults
|
||||
let spinnerState = () => {
|
||||
showSpinnerState == true
|
||||
? setShowSpinnerState(false)
|
||||
: setShowSpinnerState(true);
|
||||
};
|
||||
|
||||
router.push({
|
||||
pathname: "/myportal/searchresults",
|
||||
query: { q: query },
|
||||
});
|
||||
}
|
||||
const onHandleSubmit = (values) => {
|
||||
spinnerState();
|
||||
router.replace({
|
||||
pathname:
|
||||
router.locale == "cy"
|
||||
? "/fymhorth/canlyniadauchwilio"
|
||||
: "/myportal/searchresults",
|
||||
query: { q: values.basicSearch },
|
||||
shallow: true,
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="card card-3" id="casescomment-card">
|
||||
<form onSubmit={basicSearch}>
|
||||
<div className="card-body">
|
||||
<h3 className="heading-small card-heading">
|
||||
{t("myportal:searchcases-card-title")}
|
||||
</h3>
|
||||
<div
|
||||
className={
|
||||
validationError
|
||||
? "govuk-form-group govuk-form-group--error"
|
||||
: "govuk-form-group "
|
||||
}
|
||||
>
|
||||
<div id="event-name-hint" className="govuk-hint ">
|
||||
{t("myportal:searchcases-card-search-hint")}:
|
||||
<br />
|
||||
<span className="govuk-body-s">
|
||||
{" "}
|
||||
<span className="govuk-!-font-weight-bold">
|
||||
{t(
|
||||
"myportal:searchcases-card-search-example-label"
|
||||
)}
|
||||
:
|
||||
</span>{" "}
|
||||
CAS-00009-W8N6W4
|
||||
</span>
|
||||
</div>
|
||||
{validationError && (
|
||||
<span
|
||||
id="basicSearch-error"
|
||||
className="govuk-error-message"
|
||||
>
|
||||
<span className="govuk-visually-hidden">
|
||||
Error:
|
||||
</span>{" "}
|
||||
Case reference is required
|
||||
</span>
|
||||
)}
|
||||
<input
|
||||
<>
|
||||
<div className="card card-3" id="casesearch-card">
|
||||
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
||||
<div className="card-body">
|
||||
<h3 className="heading-small card-heading">
|
||||
{t("myportal:searchcases-card-title")}
|
||||
</h3>
|
||||
|
||||
<Field
|
||||
validate={[
|
||||
required(
|
||||
t(
|
||||
"myportal:searchcases-validation-required"
|
||||
)
|
||||
),
|
||||
minLength(
|
||||
t(
|
||||
"myportal:searchcases-validation-minlength"
|
||||
)
|
||||
),
|
||||
]}
|
||||
className="govuk-input"
|
||||
id="event-name"
|
||||
name="event-name"
|
||||
component={RenderTextfield}
|
||||
id="basicSearch"
|
||||
name="basicSearch"
|
||||
type="text"
|
||||
aria-describedby="event-name-hint"
|
||||
onChange={handleParam(setQuery)}
|
||||
aria-describedby="basicSearch-hint"
|
||||
hint1={t("myportal:searchcases-card-search-hint")}
|
||||
hint2={t(
|
||||
"myportal:searchcases-card-search-example-label"
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="govuk-form-group">
|
||||
<button
|
||||
type="submit"
|
||||
name="search"
|
||||
className="govuk-button"
|
||||
|
||||
<div className="govuk-form-group">
|
||||
<button type="submit" className="govuk-button">
|
||||
{t("myportal:searchcases-card-button")}
|
||||
</button>
|
||||
</div>
|
||||
<Link
|
||||
href={
|
||||
router.locale == "cy"
|
||||
? "/fymhorth/chwiliouwch"
|
||||
: "/myportal/advancedsearch"
|
||||
}
|
||||
>
|
||||
{t("myportal:searchcases-card-button")}
|
||||
</button>
|
||||
<a>
|
||||
{t("myportal:searchcases-card-advanced-link")}
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
<Link href="/advancedsearch">
|
||||
<a>{t("myportal:searchcases-card-advanced-link")}</a>
|
||||
</Link>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</form>
|
||||
<LoadingOverlay
|
||||
active={showSpinnerState}
|
||||
spinner
|
||||
text={t("common:spinner-searching")}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
currentView: state.currentView,
|
||||
search: state.search,
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
//form: state.form,
|
||||
myCases: state.myCases,
|
||||
watchedCases: state.watchedCases,
|
||||
myRepresentations: state.myRepresentations,
|
||||
awaitingSubmission: state.awaitingSubmission,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(
|
||||
reduxForm({
|
||||
form: "basicSearchForm",
|
||||
destroyOnUnmount: false,
|
||||
})(CaseSearch)
|
||||
);
|
||||
|
||||
@@ -79,12 +79,16 @@ const TopThree = (props) => {
|
||||
<div className="cardModuleItem" key={index}>
|
||||
<div className="cardModuleDetails">
|
||||
<div className="cardModuleReference">
|
||||
<b>Case reference:</b>{" "}
|
||||
<b>{t("myportal:case-reference")}:</b>{" "}
|
||||
<Link
|
||||
href={
|
||||
topThreeType == "awaitingSubmission"
|
||||
? "/representation"
|
||||
: "/case"
|
||||
? router.locale == "cy"
|
||||
? "/fymhorth/cynrychiolaeth"
|
||||
: "/myportal/representation"
|
||||
: router.locale == "cy"
|
||||
? "/fymhorth/achos"
|
||||
: "/myportal//case"
|
||||
}
|
||||
>
|
||||
<a
|
||||
@@ -103,18 +107,18 @@ const TopThree = (props) => {
|
||||
</div>
|
||||
{topThreeType != "awaitingSubmission" ? (
|
||||
<div className="carModuleAddress">
|
||||
<b>Addressa:</b>{" "}
|
||||
<b>{t("myportal:case-address")}:</b>{" "}
|
||||
{_.isEmpty(showDetails)
|
||||
? "not entered"
|
||||
? t("myportal:case-address-not-entered")
|
||||
: _.isEmpty(showDetails[index])
|
||||
? "not entered"
|
||||
? t("myportal:case-address-not-entered")
|
||||
: _.isEmpty(showDetails[index].value[0])
|
||||
? "not entered"
|
||||
? t("myportal:case-address-not-entered")
|
||||
: _.isEmpty(
|
||||
showDetails[index].value[0]
|
||||
.pinswg_siteaddressline1
|
||||
)
|
||||
? "not entered"
|
||||
? t("myportal:case-address-not-entered")
|
||||
: showDetails[index].value[0]
|
||||
.pinswg_siteaddressline1}
|
||||
</div>
|
||||
|
||||
@@ -21,7 +21,7 @@ const ViewAllResults = (props) => {
|
||||
resultsRowArr.push(
|
||||
<div className="govuk-summary-list__row" key={key}>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-14 govuk-!-padding-left-2">
|
||||
<Link href="/case">
|
||||
<Link href={router.locale == "cy" ? "/achos" : "/case"}>
|
||||
<a
|
||||
onClick={() => {
|
||||
setCurrentReference({
|
||||
|
||||
@@ -13,7 +13,7 @@ export default function ViewAllResults(props) {
|
||||
const resultRow = Object.keys(resultsArr).map((key, index) => {
|
||||
<div className="govuk-summary-list__row">
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-14 govuk-!-padding-left-2">
|
||||
<Link href="/case">
|
||||
<Link href={router.locale == "cy" ? "/achos" : "/case"}>
|
||||
<a>
|
||||
<span className="results-visually-hidden">
|
||||
Case Reference:
|
||||
@@ -83,7 +83,13 @@ export default function ViewAllResults(props) {
|
||||
return (
|
||||
<div className="govuk-summary-list__row" key={key}>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-14 govuk-!-padding-left-2">
|
||||
<Link href="/case">
|
||||
<Link
|
||||
href={
|
||||
router.locale == "cy"
|
||||
? "/achos"
|
||||
: "/case"
|
||||
}
|
||||
>
|
||||
<a>
|
||||
<span className="results-visually-hidden">
|
||||
Case Reference:
|
||||
|
||||
Reference in New Issue
Block a user