Merged PR 571: updated drop downs

updated drop downs

Related work items: #6498
This commit is contained in:
Robert Bond
2021-10-29 15:30:31 +00:00
16 changed files with 204 additions and 101 deletions
+10 -10
View File
@@ -1,9 +1,9 @@
// dev // dev
RELAY_ROOT = https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/ //RELAY_ROOT = https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/
RELAYURI = "dev-pedw-ns.servicebus.windows.net" //RELAYURI = "dev-pedw-ns.servicebus.windows.net"
RELAYPATH = "dev-pedw-hc" //RELAYPATH = "dev-pedw-hc"
SASKEY = "Ml0Y/S/nfRcmIrHFRkO4jNm2J3iH52TSxPiak7+E1+Y=" //SASKEY = "Ml0Y/S/nfRcmIrHFRkO4jNm2J3iH52TSxPiak7+E1+Y="
SASKEYNAME = "devpedwnspolicy" //SASKEYNAME = "devpedwnspolicy"
PORT= "3000" PORT= "3000"
@@ -15,11 +15,11 @@ I18N_DOMAIN = "cymru.local"
//I18N_DOMAIN ="gwaithcynllunio.gwasanaeth.llyw.cymru" //I18N_DOMAIN ="gwaithcynllunio.gwasanaeth.llyw.cymru"
//test //test
//RELAY_ROOT = https://test-pedw-ns.servicebus.windows.net/test-pedw-hc/ RELAY_ROOT = https://test-pedw-ns.servicebus.windows.net/test-pedw-hc/
//RELAYURI = "test-pedw-ns.servicebus.windows.net" RELAYURI = "test-pedw-ns.servicebus.windows.net"
//RELAYPATH = "test-pedw-hc" RELAYPATH = "test-pedw-hc"
//SASKEY = "kTLrs9UHwuW9Msc9uNfjf+89qLYT6ly80lK0zdTYJW4=" SASKEY = "kTLrs9UHwuW9Msc9uNfjf+89qLYT6ly80lK0zdTYJW4="
//SASKEYNAME = "testpedwhcpolicy" SASKEYNAME = "testpedwhcpolicy"
//preprod //preprod
+24 -7
View File
@@ -5,6 +5,7 @@ import useTranslation from "next-translate/useTranslation";
import Banner from "../components/banner"; import Banner from "../components/banner";
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux"; import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
import { setLogout } from "../store/accountDetails/action"; import { setLogout } from "../store/accountDetails/action";
import _ from "lodash";
const Header = (props) => { const Header = (props) => {
let { t, lang } = useTranslation(); let { t, lang } = useTranslation();
@@ -45,6 +46,8 @@ const Header = (props) => {
} else { } else {
domainSwitch = process.env.I18N_DOMAIN; domainSwitch = process.env.I18N_DOMAIN;
} }
console.log(_.isEmpty(router.query));
return ( return (
<header <header
className="govuk-header " className="govuk-header "
@@ -220,13 +223,27 @@ const Header = (props) => {
<Link <Link
href={ href={
locale == "en" locale == "en"
? router.query.q != null ? _.isEmpty(router.query)
? router.pathname + ? router.pathname
"?q=" + : router.pathname +
router.query.q "?" +
: router.pathname Object.keys(router.query)
: router.query.q != null .map(
? router.asPath + "?q=" + router.query.q (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 : router.asPath
} }
locale={locale == "en" ? "cy" : "en"} locale={locale == "en" ? "cy" : "en"}
+17 -9
View File
@@ -113,6 +113,7 @@ let Login = (props) => {
const { locale } = router; const { locale } = router;
const [showSpinnerState, setShowSpinnerState] = useState(false); const [showSpinnerState, setShowSpinnerState] = useState(false);
const [validLoginID, setValidLoginID] = useState(null);
let spinnerState = () => { let spinnerState = () => {
showSpinnerState == true showSpinnerState == true
@@ -124,14 +125,17 @@ let Login = (props) => {
spinnerState(); spinnerState();
getLogin(values.loginUserID, values.loginUserPassword).then((data) => { getLogin(values.loginUserID, values.loginUserPassword).then((data) => {
setLoggedInUserId(data.value[0].contactid); data.value.length != 0
? (setValidLoginID(true),
spinnerState(); setLoggedInUserId(data.value[0].contactid),
router.replace({ spinnerState(),
pathname: router.locale == "cy" ? "/fymhorth" : "/myportal", router.replace({
query: { q: data.value[0].contactid }, pathname:
shallow: true, 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"> <h3 className="heading-small card-heading">
{t("home:login-card-title")} {t("home:login-card-title")}
</h3> </h3>
{validLoginID == false && (
<div className="govuk-error-message govuk-form-group--error">
Incorrect username or password
</div>
)}
<Field <Field
// validate={[ // validate={[
// required( // required(
+2 -2
View File
@@ -28,8 +28,8 @@ export default function Home({ children, pages }) {
<CaseSearch /> <CaseSearch />
<CaseComment /> <CaseComment />
<Dns /> <Dns />
{/* <Login /> {/*<Login />
<Inspectorate /> */} <Inspectorate /> */}
</div> </div>
</div> </div>
</div> </div>
+16 -15
View File
@@ -24,21 +24,22 @@ const MyCases = (props) => {
topThreeType={"myCases"} topThreeType={"myCases"}
/> />
</div> </div>
{props.myCases.myCases["@odata.count"] != 0 && (
<div className="cardVieAll"> <div className="cardVieAll">
<Link href="/myportal/viewall" shallow> <Link href="/myportal/viewall" shallow>
<a <a
onClick={() => { onClick={() => {
setCurrentView({ setCurrentView({
"viewName": "My Cases", "viewName": "My Cases",
"viewKey": "myCases", "viewKey": "myCases",
}); });
}} }}
> >
{t("myportal:viewall-link")} {t("myportal:viewall-link")}
</a> </a>
</Link> </Link>
</div> </div>
)}
</div> </div>
</div> </div>
); );
+17 -14
View File
@@ -25,20 +25,23 @@ const MyRepresentations = (props) => {
/> />
</div> </div>
<div className="cardVieAll"> {props.myRepresentations.myRepresentations["@odata.count"] !=
<Link href="/myportal/viewall"> 0 && (
<a <div className="cardVieAll">
onClick={() => { <Link href="/myportal/viewall" shallow>
setCurrentView({ <a
"viewName": "My Representations", onClick={() => {
"viewKey": "myRepresentations", setCurrentView({
}); "viewName": "My Representations",
}} "viewKey": "myRepresentations",
> });
{t("myportal:viewall-link")} }}
</a> >
</Link> {t("myportal:viewall-link")}
</div> </a>
</Link>
</div>
)}
</div> </div>
</div> </div>
); );
+24 -1
View File
@@ -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) => { const mapDispatchToProps = (dispatch) => {
+16 -14
View File
@@ -25,20 +25,22 @@ const WatchedCases = (props) => {
/> />
</div> </div>
<div className="cardVieAll"> {props.watchedCases.watchedCases["@odata.count"] != 0 && (
<Link href="/myportal/viewall"> <div className="cardVieAll">
<a <Link href="/myportal/viewall" shallow>
onClick={() => { <a
setCurrentView({ onClick={() => {
"viewName": "Watched Cases", setCurrentView({
"viewKey": "watchedCases", "viewName": "Watched Cases",
}); "viewKey": "watchedCases",
}} });
> }}
{t("myportal:viewall-link")} >
</a> {t("myportal:viewall-link")}
</Link> </a>
</div> </Link>
</div>
)}
</div> </div>
</div> </div>
); );
+9 -3
View File
@@ -249,9 +249,15 @@ let AdvancedSearch = (props) => {
("apt=" + values.appealTypes.split(",")[0]) ("apt=" + values.appealTypes.split(",")[0])
: ""; : "";
router.replace("/advancedsearchresults" + searchString, null, { router.replace(
shallow: true, (router.locale == "cy"
}); ? "/canlyniadauchwiliouwch"
: "/advancedsearchresults") + searchString,
null,
{
shallow: true,
}
);
}; };
return ( return (
+5 -17
View File
@@ -39,16 +39,10 @@ export const getSearchDetails = (token, searchResultsObj) => {
if (searchDetail.pinswg_appealcasetype == null) { if (searchDetail.pinswg_appealcasetype == null) {
console.log(searchDetail.title); console.log(searchDetail.title);
} else { } else {
let formMeta = getFormCollection( let formMeta = getFormCollectionByID(
"pinswg_" + searchDetail.pinswg_appealcasetype
searchDetail[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
]
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
.toLowerCase()
.slice(0, 39)
); );
//console.log(formMeta);
detailsArr.push( detailsArr.push(
getBasicSearchDetails( getBasicSearchDetails(
token, token,
@@ -79,14 +73,8 @@ export const getSearchDetailsPaged = (searchResultsObj) => {
if (searchDetail.pinswg_appealcasetype == null) { if (searchDetail.pinswg_appealcasetype == null) {
console.log(searchDetail.title); console.log(searchDetail.title);
} else { } else {
let formMeta = getFormCollection( let formMeta = getFormCollectionByID(
"pinswg_" + searchDetail.pinswg_appealcasetype
searchDetail[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
]
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
.toLowerCase()
.slice(0, 39)
); );
detailsArr.push( detailsArr.push(
+1 -1
View File
@@ -259,7 +259,7 @@
{ {
"LogicalCollectionName": "pinswg_hedgeshedgerowstreepreservationreplacems", "LogicalCollectionName": "pinswg_hedgeshedgerowstreepreservationreplacems",
"LogicalName": "pinswg_hedgeshedgerowstreepreservationreplacem", "LogicalName": "pinswg_hedgeshedgerowstreepreservationreplacem",
"PrimaryIdAttribute": "pinswg_hedgeshedgerowstreepreservatioids", "PrimaryIdAttribute": "pinswg_hedgeshedgerowstreepreservatioid",
"UrlName": "hedgeshedgerowstreepreservationreplacem", "UrlName": "hedgeshedgerowstreepreservationreplacem",
"MetadataId": "60f38fed-5382-eb11-aac0-00224800be9c", "MetadataId": "60f38fed-5382-eb11-aac0-00224800be9c",
"appealTypeID": "846040017" "appealTypeID": "846040017"
+40
View File
@@ -24,6 +24,12 @@
"stringmapid": "cf4aa9f2-e275-eb11-aabd-00224800be9c", "stringmapid": "cf4aa9f2-e275-eb11-aabd-00224800be9c",
"attributevalue": 846040004 "attributevalue": 846040004
}, },
{
"value": "Householder and Minor Commercial Appeals - HAS/CAS",
"value_cy": "Apeliadau Deiliaid Tai a Mân Apeliadau Masnachol",
"stringmapid": "cf4aa9f2-e275-eb11-aabd-00224800be9c",
"attributevalue": 846040004
},
{ {
"value": "Enforcement Notice Appeal - S174", "value": "Enforcement Notice Appeal - S174",
"value_cy": "Apêl Hysbysiad Gorfodi - A174", "value_cy": "Apêl Hysbysiad Gorfodi - A174",
@@ -54,6 +60,12 @@
"stringmapid": "ba56f05c-7f90-eb11-aac2-00224800be9c", "stringmapid": "ba56f05c-7f90-eb11-aac2-00224800be9c",
"attributevalue": 846040009 "attributevalue": 846040009
}, },
{
"value": "Called In Applications - S77",
"value_cy": "Cais a Alwyd i Mewn - A77",
"stringmapid": "bb56f05c-7f90-eb11-aac2-00224800be9c",
"attributevalue": 846040010
},
{ {
"value": "Call-Ins - S77", "value": "Call-Ins - S77",
"value_cy": "Galwadau i Mewn - A77", "value_cy": "Galwadau i Mewn - A77",
@@ -66,6 +78,12 @@
"stringmapid": "bc56f05c-7f90-eb11-aac2-00224800be9c", "stringmapid": "bc56f05c-7f90-eb11-aac2-00224800be9c",
"attributevalue": 846040011 "attributevalue": 846040011
}, },
{
"value": "Developments of National Significance",
"value_cy": "Datblygiad o Arwyddocâd Cenedlaethol",
"stringmapid": "bc56f05c-7f90-eb11-aac2-00224800be9c",
"attributevalue": 846040011
},
{ {
"value": "Electricity Act", "value": "Electricity Act",
"value_cy": "Deddf Trydan", "value_cy": "Deddf Trydan",
@@ -90,6 +108,12 @@
"stringmapid": "c056f05c-7f90-eb11-aac2-00224800be9c", "stringmapid": "c056f05c-7f90-eb11-aac2-00224800be9c",
"attributevalue": 846040015 "attributevalue": 846040015
}, },
{
"value": "Rights of Way",
"value_cy": "Hawliau Tramwy",
"stringmapid": "c056f05c-7f90-eb11-aac2-00224800be9c",
"attributevalue": 846040015
},
{ {
"value": "Common Land", "value": "Common Land",
"value_cy": "Tir Comin", "value_cy": "Tir Comin",
@@ -149,6 +173,12 @@
"value_cy": "Caniatâd Adeilad Rhestredig ac Ardal Gadwraeth - A20", "value_cy": "Caniatâd Adeilad Rhestredig ac Ardal Gadwraeth - A20",
"stringmapid": "977522df-8aef-eb11-aac7-00224800be9c", "stringmapid": "977522df-8aef-eb11-aac7-00224800be9c",
"attributevalue": 846040025 "attributevalue": 846040025
},
{
"value": "Listed Building and Conservation Area Consent",
"value_cy": "Caniatâd Adeilad Rhestredig ac Ardal Gadwraeth - A20",
"stringmapid": "977522df-8aef-eb11-aac7-00224800be9c",
"attributevalue": 846040025
} }
], ],
"statusCodes": [ "statusCodes": [
@@ -301,6 +331,11 @@
"value_cy": "Cyngor Bwrdeistref Sirol Rhondda Cynon Taf", "value_cy": "Cyngor Bwrdeistref Sirol Rhondda Cynon Taf",
"pinswg_lpa": 0 "pinswg_lpa": 0
}, },
{
"value": "Rhondda Cynon Taf County Borough Council",
"value_cy": "Cyngor Bwrdeistref Sirol Rhondda Cynon Taf",
"pinswg_lpa": 0
},
{ {
"value": "Rhondda Cynon Taf CBC", "value": "Rhondda Cynon Taf CBC",
"value_cy": "Cyngor Bwrdeistref Sirol Rhondda Cynon Taf", "value_cy": "Cyngor Bwrdeistref Sirol Rhondda Cynon Taf",
@@ -326,6 +361,11 @@
"value_cy": "Cyngor Bro Morgannwg", "value_cy": "Cyngor Bro Morgannwg",
"pinswg_lpa": 0 "pinswg_lpa": 0
}, },
{
"value": "Vale of Glamorgan Borough Council",
"value_cy": "Cyngor Bro Morgannwg",
"pinswg_lpa": 0
},
{ {
"value": "Wrexham County Borough Council", "value": "Wrexham County Borough Council",
"value_cy": "Cyngor Bwrdeistref Sirol Wrecsam", "value_cy": "Cyngor Bwrdeistref Sirol Wrecsam",
+8
View File
@@ -49,6 +49,14 @@ module.exports = {
source: "/fymhorth/chwiliouwch", source: "/fymhorth/chwiliouwch",
destination: "/myportal/advancedsearch", destination: "/myportal/advancedsearch",
}, },
{
source: "/canlyniadauchwiliouwch",
destination: "/advancedsearchresults",
},
{
source: "/fymhorth/canlyniadauchwiliouwch",
destination: "/myportal/advancedsearchresults",
},
{ {
source: "/fymhorth", source: "/fymhorth",
destination: "/myportal", destination: "/myportal",
+4
View File
@@ -19,6 +19,7 @@ import { reduxForm, formValueSelector } from "redux-form";
import PersonalDetails from "../../components/account/personaldetails"; import PersonalDetails from "../../components/account/personaldetails";
import { setAccountDetails } from "../../store/accountDetails/action"; import { setAccountDetails } from "../../store/accountDetails/action";
import { getPersonalAccount } from "../../actions"; import { getPersonalAccount } from "../../actions";
import { setCookie } from "nookies";
const Home = (props) => { const Home = (props) => {
const { footerLinks, formData } = props; const { footerLinks, formData } = props;
@@ -32,6 +33,9 @@ const Home = (props) => {
useState(false); useState(false);
const [accountUpdatedComplete, setAccountUpdatedComplete] = useState(false); const [accountUpdatedComplete, setAccountUpdatedComplete] = useState(false);
setCookie(null, "pinsUser", props.accountDetails.loggedinUserId),
{ path: "/" };
return ( return (
<div> <div>
<Head> <Head>
+11 -7
View File
@@ -151,9 +151,9 @@ export const getServerSideProps = wrapper.getServerSideProps(
const { cookies } = req; const { cookies } = req;
console.log(cookies);
const token = await getSASToken(); const token = await getSASToken();
console.log("does it have ", cookies.pinsUser);
let loggedInUser = let loggedInUser =
typeof query.q == undefined ? cookies.pinsUser : query.q; typeof query.q == undefined ? cookies.pinsUser : query.q;
@@ -173,23 +173,28 @@ export const getServerSideProps = wrapper.getServerSideProps(
await getAwaitingSubmission(token), await getAwaitingSubmission(token),
]); ]);
console.log("perosnal: ", accountDetails);
//const cookiesMaker = nookies.get(ctx) //const cookiesMaker = nookies.get(ctx)
let now = new Date(); let now = new Date();
let expDate = new Date(now); let expDate = new Date(now);
expDate.setDate(now.getDate() + 1); expDate.setDate(now.getDate() + 1);
nookies.set(ctx, "pinsUser", query.q, { console.log(
"Check: ",
cookies,
cookies.pinsUser,
loggedInUser,
nookies.get("pinsUser")
);
nookies.set(ctx, "pinsUser", loggedInUser, {
expires: expDate, expires: expDate,
httpOnly: false, httpOnly: false,
path: "/",
}); });
console.log(" from cookie ", cookies); console.log(" from cookie ", cookies);
console.log(myCases);
const [ const [
myCasesDetails, myCasesDetails,
myRepresentationsDetails, myRepresentationsDetails,
@@ -202,7 +207,6 @@ export const getServerSideProps = wrapper.getServerSideProps(
// await getDetails(awaitingSubmission), // await getDetails(awaitingSubmission),
]); ]);
console.log(myCasesDetails);
store.dispatch(setAccountDetails(accountDetails)); store.dispatch(setAccountDetails(accountDetails));
store.dispatch(setLoggedInUserId(loggedInUser)); store.dispatch(setLoggedInUserId(loggedInUser));
store.dispatch(setMyCases(myCases)); store.dispatch(setMyCases(myCases));
-1
View File
@@ -276,7 +276,6 @@ textarea,
.govuk-select { .govuk-select {
appearance: none; appearance: none;
width: 100%;
margin-bottom: 20px; margin-bottom: 20px;
background-image: url(/assets/images/select-down-arrow.svg); background-image: url(/assets/images/select-down-arrow.svg);
background-size: 19px 12px; background-size: 19px 12px;