updated drop downs
This commit is contained in:
+24
-7
@@ -5,6 +5,7 @@ import useTranslation from "next-translate/useTranslation";
|
||||
import Banner from "../components/banner";
|
||||
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { setLogout } from "../store/accountDetails/action";
|
||||
import _ from "lodash";
|
||||
const Header = (props) => {
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
@@ -45,6 +46,8 @@ const Header = (props) => {
|
||||
} else {
|
||||
domainSwitch = process.env.I18N_DOMAIN;
|
||||
}
|
||||
|
||||
console.log(_.isEmpty(router.query));
|
||||
return (
|
||||
<header
|
||||
className="govuk-header "
|
||||
@@ -220,13 +223,27 @@ const Header = (props) => {
|
||||
<Link
|
||||
href={
|
||||
locale == "en"
|
||||
? router.query.q != null
|
||||
? router.pathname +
|
||||
"?q=" +
|
||||
router.query.q
|
||||
: router.pathname
|
||||
: router.query.q != null
|
||||
? router.asPath + "?q=" + router.query.q
|
||||
? _.isEmpty(router.query)
|
||||
? router.pathname
|
||||
: router.pathname +
|
||||
"?" +
|
||||
Object.keys(router.query)
|
||||
.map(
|
||||
(key) =>
|
||||
key +
|
||||
"=" +
|
||||
router.query[key]
|
||||
)
|
||||
.join("&")
|
||||
: _.isEmpty(router.query) != false
|
||||
? router.asPath +
|
||||
"?" +
|
||||
Object.keys(router.query)
|
||||
.map(
|
||||
(key) =>
|
||||
key + "=" + router.query[key]
|
||||
)
|
||||
.join("&")
|
||||
: router.asPath
|
||||
}
|
||||
locale={locale == "en" ? "cy" : "en"}
|
||||
|
||||
@@ -113,6 +113,7 @@ let Login = (props) => {
|
||||
const { locale } = router;
|
||||
|
||||
const [showSpinnerState, setShowSpinnerState] = useState(false);
|
||||
const [validLoginID, setValidLoginID] = useState(null);
|
||||
|
||||
let spinnerState = () => {
|
||||
showSpinnerState == true
|
||||
@@ -124,14 +125,17 @@ let Login = (props) => {
|
||||
spinnerState();
|
||||
|
||||
getLogin(values.loginUserID, values.loginUserPassword).then((data) => {
|
||||
setLoggedInUserId(data.value[0].contactid);
|
||||
|
||||
spinnerState();
|
||||
router.replace({
|
||||
pathname: router.locale == "cy" ? "/fymhorth" : "/myportal",
|
||||
query: { q: data.value[0].contactid },
|
||||
shallow: true,
|
||||
});
|
||||
data.value.length != 0
|
||||
? (setValidLoginID(true),
|
||||
setLoggedInUserId(data.value[0].contactid),
|
||||
spinnerState(),
|
||||
router.replace({
|
||||
pathname:
|
||||
router.locale == "cy" ? "/fymhorth" : "/myportal",
|
||||
query: { q: data.value[0].contactid },
|
||||
shallow: true,
|
||||
}))
|
||||
: (setShowSpinnerState(false), setValidLoginID(false));
|
||||
});
|
||||
};
|
||||
|
||||
@@ -142,7 +146,11 @@ let Login = (props) => {
|
||||
<h3 className="heading-small card-heading">
|
||||
{t("home:login-card-title")}
|
||||
</h3>
|
||||
|
||||
{validLoginID == false && (
|
||||
<div className="govuk-error-message govuk-form-group--error">
|
||||
Incorrect username or password
|
||||
</div>
|
||||
)}
|
||||
<Field
|
||||
// validate={[
|
||||
// required(
|
||||
|
||||
+2
-2
@@ -28,8 +28,8 @@ export default function Home({ children, pages }) {
|
||||
<CaseSearch />
|
||||
<CaseComment />
|
||||
<Dns />
|
||||
{/* <Login />
|
||||
<Inspectorate /> */}
|
||||
{/*<Login />
|
||||
<Inspectorate /> */}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -24,21 +24,22 @@ const MyCases = (props) => {
|
||||
topThreeType={"myCases"}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="cardVieAll">
|
||||
<Link href="/myportal/viewall" shallow>
|
||||
<a
|
||||
onClick={() => {
|
||||
setCurrentView({
|
||||
"viewName": "My Cases",
|
||||
"viewKey": "myCases",
|
||||
});
|
||||
}}
|
||||
>
|
||||
{t("myportal:viewall-link")}
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
{props.myCases.myCases["@odata.count"] != 0 && (
|
||||
<div className="cardVieAll">
|
||||
<Link href="/myportal/viewall" shallow>
|
||||
<a
|
||||
onClick={() => {
|
||||
setCurrentView({
|
||||
"viewName": "My Cases",
|
||||
"viewKey": "myCases",
|
||||
});
|
||||
}}
|
||||
>
|
||||
{t("myportal:viewall-link")}
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -25,20 +25,23 @@ const MyRepresentations = (props) => {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="cardVieAll">
|
||||
<Link href="/myportal/viewall">
|
||||
<a
|
||||
onClick={() => {
|
||||
setCurrentView({
|
||||
"viewName": "My Representations",
|
||||
"viewKey": "myRepresentations",
|
||||
});
|
||||
}}
|
||||
>
|
||||
{t("myportal:viewall-link")}
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
{props.myRepresentations.myRepresentations["@odata.count"] !=
|
||||
0 && (
|
||||
<div className="cardVieAll">
|
||||
<Link href="/myportal/viewall" shallow>
|
||||
<a
|
||||
onClick={() => {
|
||||
setCurrentView({
|
||||
"viewName": "My Representations",
|
||||
"viewKey": "myRepresentations",
|
||||
});
|
||||
}}
|
||||
>
|
||||
{t("myportal:viewall-link")}
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -140,7 +140,30 @@ const TopThree = (props) => {
|
||||
);
|
||||
});
|
||||
|
||||
return <>{topthreeRow}</>;
|
||||
let noRecordsLabel = "";
|
||||
switch (topThreeType) {
|
||||
case "watchedCases":
|
||||
noRecordsLabel = "You are not watching any cases";
|
||||
break;
|
||||
case "myRepresentations":
|
||||
noRecordsLabel = "You have no representations";
|
||||
break;
|
||||
case "myCases":
|
||||
noRecordsLabel = "You have no cases";
|
||||
break;
|
||||
case "awaitingSubmission":
|
||||
noRecordsLabel = "You have no awaiting submissions";
|
||||
break;
|
||||
}
|
||||
return (
|
||||
<>
|
||||
{topthreeRow.length == 0 ? (
|
||||
<div>{noRecordsLabel}</div>
|
||||
) : (
|
||||
topthreeRow
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
|
||||
@@ -25,20 +25,22 @@ const WatchedCases = (props) => {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="cardVieAll">
|
||||
<Link href="/myportal/viewall">
|
||||
<a
|
||||
onClick={() => {
|
||||
setCurrentView({
|
||||
"viewName": "Watched Cases",
|
||||
"viewKey": "watchedCases",
|
||||
});
|
||||
}}
|
||||
>
|
||||
{t("myportal:viewall-link")}
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
{props.watchedCases.watchedCases["@odata.count"] != 0 && (
|
||||
<div className="cardVieAll">
|
||||
<Link href="/myportal/viewall" shallow>
|
||||
<a
|
||||
onClick={() => {
|
||||
setCurrentView({
|
||||
"viewName": "Watched Cases",
|
||||
"viewKey": "watchedCases",
|
||||
});
|
||||
}}
|
||||
>
|
||||
{t("myportal:viewall-link")}
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -249,9 +249,15 @@ let AdvancedSearch = (props) => {
|
||||
("apt=" + values.appealTypes.split(",")[0])
|
||||
: "";
|
||||
|
||||
router.replace("/advancedsearchresults" + searchString, null, {
|
||||
shallow: true,
|
||||
});
|
||||
router.replace(
|
||||
(router.locale == "cy"
|
||||
? "/canlyniadauchwiliouwch"
|
||||
: "/advancedsearchresults") + searchString,
|
||||
null,
|
||||
{
|
||||
shallow: true,
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -39,16 +39,10 @@ export const getSearchDetails = (token, searchResultsObj) => {
|
||||
if (searchDetail.pinswg_appealcasetype == null) {
|
||||
console.log(searchDetail.title);
|
||||
} else {
|
||||
let formMeta = getFormCollection(
|
||||
"pinswg_" +
|
||||
searchDetail[
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
|
||||
.toLowerCase()
|
||||
.slice(0, 39)
|
||||
let formMeta = getFormCollectionByID(
|
||||
searchDetail.pinswg_appealcasetype
|
||||
);
|
||||
|
||||
//console.log(formMeta);
|
||||
detailsArr.push(
|
||||
getBasicSearchDetails(
|
||||
token,
|
||||
@@ -79,14 +73,8 @@ export const getSearchDetailsPaged = (searchResultsObj) => {
|
||||
if (searchDetail.pinswg_appealcasetype == null) {
|
||||
console.log(searchDetail.title);
|
||||
} else {
|
||||
let formMeta = getFormCollection(
|
||||
"pinswg_" +
|
||||
searchDetail[
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
|
||||
.toLowerCase()
|
||||
.slice(0, 39)
|
||||
let formMeta = getFormCollectionByID(
|
||||
searchDetail.pinswg_appealcasetype
|
||||
);
|
||||
|
||||
detailsArr.push(
|
||||
|
||||
Reference in New Issue
Block a user