Merged PR 854: My portal amends

Related work items: #7636, #7637, #7638
This commit is contained in:
Robert Bond
2022-05-19 11:10:31 +00:00
11 changed files with 201 additions and 57 deletions
+16
View File
@@ -491,6 +491,22 @@ export const getAppealsTypes = () => {
}); });
}; };
export const getAppealsTypesForNewAppeal = () => {
return axios
.get(BASE_URL + "/api/endpoint/getappealtypesfornewappeal_api")
.then((res) => res.data)
.catch((error) => {
console.log(error);
let ErrResponse = {
value: [],
errorCode: error.response.status,
errorMsg: error.response.statusText,
};
return ErrResponse;
});
};
export const getLPA = () => { export const getLPA = () => {
return axios return axios
.get(BASE_URL + "/api/endpoint/getlpa_api") .get(BASE_URL + "/api/endpoint/getlpa_api")
-1
View File
@@ -165,7 +165,6 @@ let Login = (props) => {
router.replace({ router.replace({
pathname: pathname:
router.locale == "cy" ? "/fymhorth" : "/myportal", router.locale == "cy" ? "/fymhorth" : "/myportal",
shallow: true,
})) }))
: //setShowSpinnerState(false), : //setShowSpinnerState(false),
setValidLoginID(false); setValidLoginID(false);
+38 -11
View File
@@ -89,8 +89,18 @@ const MyPortal = (props) => {
alt={router.locale == "cy" ? "Defnyddiwr" : "User"} alt={router.locale == "cy" ? "Defnyddiwr" : "User"}
/>{" "} />{" "}
<div className="serviceBanner_userDetails_name"> <div className="serviceBanner_userDetails_name">
{props.accountDetails.accountDetails.firstname}{" "} <Link href="/account/personaldetails">
{props.accountDetails.accountDetails.lastname} <a className="govuk-button-secondary">
{
props.accountDetails.accountDetails
.firstname
}{" "}
{
props.accountDetails.accountDetails
.lastname
}
</a>
</Link>
</div> </div>
<div> <div>
<Link <Link
@@ -117,16 +127,33 @@ const MyPortal = (props) => {
<div className="flex-container grid-row govuk-body "> <div className="flex-container grid-row govuk-body ">
<MakeNewAppeal /> <MakeNewAppeal />
<SearchCases /> <SearchCases />
<AwaitingSubmission {props.awaitingSubmission.awaitingSubmission[
awaitingSubmission={props.awaitingSubmission} "@odata.count"
/> ] > 0 && (
<MyCases myCases={props.myCases} /> <AwaitingSubmission
<WatchedCases watchedCases={props.watchedCases} /> awaitingSubmission={
<MyRepresentations props.awaitingSubmission
myRepresentations={props.myRepresentations} }
/> />
)}
{props.myCases.myCases["@odata.count"] > 0 && (
<MyCases myCases={props.myCases} />
)}
{props.watchedCases.watchedCases["@odata.count"] >
0 && (
<WatchedCases
watchedCases={props.watchedCases}
/>
)}
{props.myRepresentations.myRepresentations[
"@odata.count"
] > 0 && (
<MyRepresentations
myRepresentations={props.myRepresentations}
/>
)}
<Dns /> <Dns />
<YourAccount /> {/* <YourAccount /> */}
{showFileUpload == "true" && <UploadFile />} {showFileUpload == "true" && <UploadFile />}
</div> </div>
</div> </div>
+21 -15
View File
@@ -23,24 +23,30 @@ const AwaitingSubmission = (props) => {
showTopThree={ showTopThree={
props.awaitingSubmission.awaitingSubmission props.awaitingSubmission.awaitingSubmission
} }
showDetails={
props.awaitingSubmission.awaitingSubmissionDetails
}
topThreeType={"awaitingSubmission"} topThreeType={"awaitingSubmission"}
/> />
</div> </div>
<div className="cardVieAll"> {props.awaitingSubmission.awaitingSubmission["@odata.count"] >
<Link href="/myportal/viewall"> 3 && (
<a <div className="cardVieAll">
className="govuk-link--no-underline" <Link href="/myportal/viewall">
onClick={() => { <a
setCurrentView({ className="govuk-link--no-underline"
"viewName": "Awaiting Submission", onClick={() => {
"viewKey": "awaitingSubmission", setCurrentView({
}); "viewName": "Awaiting Submission",
}} "viewKey": "awaitingSubmission",
> });
{t("myportal:viewall-link")} }}
</a> >
</Link> {t("myportal:viewall-link")}
</div> </a>
</Link>
</div>
)}
</div> </div>
</div> </div>
); );
+2 -2
View File
@@ -24,9 +24,9 @@ const MyCases = (props) => {
topThreeType={"myCases"} topThreeType={"myCases"}
/> />
</div> </div>
{props.myCases.myCases["@odata.count"] != 0 && ( {props.myCases.myCases["@odata.count"] > 3 && (
<div className="cardVieAll"> <div className="cardVieAll">
<Link href="/myportal/viewall" shallow> <Link href="/myportal/viewall">
<a <a
className="govuk-link--no-underline" className="govuk-link--no-underline"
onClick={() => { onClick={() => {
+5 -2
View File
@@ -21,12 +21,15 @@ const MyRepresentations = (props) => {
<div className="cardModuleContainer"> <div className="cardModuleContainer">
<TopThree <TopThree
showTopThree={props.myRepresentations.myRepresentations} showTopThree={props.myRepresentations.myRepresentations}
showDetails={
props.myRepresentations.myRepresentationsDetails
}
topThreeType={"myRepresentations"} topThreeType={"myRepresentations"}
/> />
</div> </div>
{props.myRepresentations.myRepresentations["@odata.count"] != {props.myRepresentations.myRepresentations["@odata.count"] >
0 && ( 3 && (
<div className="cardVieAll"> <div className="cardVieAll">
<Link href="/myportal/viewall" shallow> <Link href="/myportal/viewall" shallow>
<a <a
+34 -20
View File
@@ -228,26 +228,40 @@ const TopThree = (props) => {
} }
</div> </div>
)} )}
{topThreeType != "awaitingSubmission" ? ( {/* {topThreeType != "awaitingSubmission" ? ( */}
<div className="carModuleAddress"> <div className="carModuleAddress">
<b>{t("myportal:case-address")}:</b>{" "} <b>{t("myportal:case-address")}:</b>{" "}
{_.isEmpty(showDetails) {_.isEmpty(showDetails)
? t("myportal:case-address-not-entered") ? t("myportal:case-address-not-entered")
: _.isEmpty(showDetails[index]) : _.isEmpty(showDetails[index])
? t("myportal:case-address-not-entered") ? t("myportal:case-address-not-entered")
: _.isEmpty(showDetails[index].value[0]) : _.isEmpty(showDetails[index].value[0])
? t("myportal:case-address-not-entered") ? t("myportal:case-address-not-entered")
: _.isEmpty( : _.isEmpty(
showDetails[index].value[0] showDetails[index].value[0]
.pinswg_siteaddressline1 .pinswg_siteaddressline1
) )
? t("myportal:case-address-not-entered") ? t("myportal:case-address-not-entered")
: showDetails[index].value[0] : showDetails[index].value[0]
.pinswg_siteaddressline1} .pinswg_siteaddressline1 +
</div> (!_.isEmpty(
) : ( showDetails[index].value[0]
"" .pinswg_siteaddressline2
)} )
? ", " +
showDetails[index].value[0]
.pinswg_siteaddressline2
: "") +
(!_.isEmpty(
showDetails[index].value[0]
.pinswg_siteaddresstown
)
? ", " +
showDetails[index].value[0]
.pinswg_siteaddresstown
: "")}
</div>
{router.locale == "cy" {router.locale == "cy"
? jsonpath.query( ? jsonpath.query(
transLookup, transLookup,
+2 -1
View File
@@ -21,11 +21,12 @@ const WatchedCases = (props) => {
<div className="cardModuleContainer"> <div className="cardModuleContainer">
<TopThree <TopThree
showTopThree={props.watchedCases.watchedCases} showTopThree={props.watchedCases.watchedCases}
showDetails={props.watchedCases.watchedCasesDetails}
topThreeType={"watchedCases"} topThreeType={"watchedCases"}
/> />
</div> </div>
{props.watchedCases.watchedCases["@odata.count"] != 0 && ( {props.watchedCases.watchedCases["@odata.count"] > 3 && (
<div className="cardVieAll"> <div className="cardVieAll">
<Link href="/myportal/viewall" shallow> <Link href="/myportal/viewall" shallow>
<a <a
+15 -3
View File
@@ -4,6 +4,8 @@ import Link from "next/link";
import CookieBanner from "../components/cookieBanner"; import CookieBanner from "../components/cookieBanner";
import Footer from "../components/footer"; import Footer from "../components/footer";
import Header from "../components/header"; import Header from "../components/header";
import { parseCookies, setCookie, destroyCookie } from "nookies";
import { useSession, signIn, signOut } from "next-auth/react";
function Error({ statusCode }, props) { function Error({ statusCode }, props) {
let { t, lang } = useTranslation(); let { t, lang } = useTranslation();
@@ -29,9 +31,19 @@ function Error({ statusCode }, props) {
? `An error ${statusCode} occurred on server` ? `An error ${statusCode} occurred on server`
: t("common:error-page-message")} : t("common:error-page-message")}
</p> </p>
<Link href="/">
<a>Go back home</a> <a
</Link> onClick={() => {
destroyCookie({}, "pinsUser"),
window.localStorage.clear(),
signOut({
callbackUrl: "/",
});
}}
>
{" "}
Go back home
</a>
</div> </div>
</div> </div>
</main> </main>
@@ -0,0 +1,66 @@
const ApiResponse = (req, res) => {
res.statusCode = 200;
res.json({
"value": [
{
"value": "Planning Appeal - S78",
"stringmapid": "cb4aa9f2-e275-eb11-aabd-00224800be9c",
"organizationid": "01191a4d-105f-eb11-aaba-00224800be9c",
"attributevalue@OData.Community.Display.V1.FormattedValue":
"846,040,000",
"attributevalue": 846040000,
},
{
"value": "Listed Building and Conservation Area Consent",
"stringmapid": "d3b500b5-1228-ec11-aaca-00224800be9c",
"organizationid": "01191a4d-105f-eb11-aaba-00224800be9c",
"attributevalue@OData.Community.Display.V1.FormattedValue":
"846,040,025",
"attributevalue": 846040025,
},
{
"value": "Householder and Minor Commercial Appeals - HAS/CAS",
"stringmapid": "585d46a7-9138-ec11-aacb-00224800be9c",
"organizationid": "01191a4d-105f-eb11-aaba-00224800be9c",
"attributevalue@OData.Community.Display.V1.FormattedValue":
"846,040,004",
"attributevalue": 846040004,
},
{
"value": "Adverts",
"stringmapid": "c356f05c-7f90-eb11-aac2-00224800be9c",
"organizationid": "01191a4d-105f-eb11-aaba-00224800be9c",
"attributevalue@OData.Community.Display.V1.FormattedValue":
"846,040,018",
"attributevalue": 846040018,
},
{
"value": "Non-Validation",
"stringmapid": "c956f05c-7f90-eb11-aac2-00224800be9c",
"organizationid": "01191a4d-105f-eb11-aaba-00224800be9c",
"attributevalue@OData.Community.Display.V1.FormattedValue":
"846,040,024",
"attributevalue": 846040024,
},
{
"value": "Enforcement Notice Appeal - S174",
"stringmapid": "b656f05c-7f90-eb11-aac2-00224800be9c",
"organizationid": "01191a4d-105f-eb11-aaba-00224800be9c",
"attributevalue@OData.Community.Display.V1.FormattedValue":
"846,040,005",
"attributevalue": 846040005,
},
{
"value":
"High Hedges, Tree Preservation orders, Hedgerows, Tree Replacement Notice.",
"stringmapid": "c256f05c-7f90-eb11-aac2-00224800be9c",
"organizationid": "01191a4d-105f-eb11-aaba-00224800be9c",
"attributevalue@OData.Community.Display.V1.FormattedValue":
"846,040,017",
"attributevalue": 846040017,
},
],
});
};
export default ApiResponse;
+2 -2
View File
@@ -2,7 +2,7 @@ import useTranslation from "next-translate/useTranslation";
import Head from "next/head"; import Head from "next/head";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { getAppealsTypes, getLPA } from "../../actions"; import { getAppealsTypesForNewAppeal, getLPA } from "../../actions";
import Breadcrumbs from "../../components/breadcrumbs"; import Breadcrumbs from "../../components/breadcrumbs";
import CookieBanner from "../../components/cookieBanner"; import CookieBanner from "../../components/cookieBanner";
import Footer from "../../components/footer"; import Footer from "../../components/footer";
@@ -130,7 +130,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
let loggedInUser = cookies.pinsUser; let loggedInUser = cookies.pinsUser;
const [appealTypeData, lpaData, caseData] = await Promise.all([ const [appealTypeData, lpaData, caseData] = await Promise.all([
await getAppealsTypes(), await getAppealsTypesForNewAppeal(),
await getLPA(), await getLPA(),
]); ]);