diff --git a/actions/index.js b/actions/index.js index cba68508..fe665760 100644 --- a/actions/index.js +++ b/actions/index.js @@ -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 = () => { return axios .get(BASE_URL + "/api/endpoint/getlpa_api") diff --git a/components/homepage/login.js b/components/homepage/login.js index 72ffeac0..ed565c0c 100644 --- a/components/homepage/login.js +++ b/components/homepage/login.js @@ -165,7 +165,6 @@ let Login = (props) => { router.replace({ pathname: router.locale == "cy" ? "/fymhorth" : "/myportal", - shallow: true, })) : //setShowSpinnerState(false), setValidLoginID(false); diff --git a/components/myportal.js b/components/myportal.js index 79fe02cf..5912aaa7 100644 --- a/components/myportal.js +++ b/components/myportal.js @@ -89,8 +89,18 @@ const MyPortal = (props) => { alt={router.locale == "cy" ? "Defnyddiwr" : "User"} />{" "}
- {props.accountDetails.accountDetails.firstname}{" "} - {props.accountDetails.accountDetails.lastname} + + + { + props.accountDetails.accountDetails + .firstname + }{" "} + { + props.accountDetails.accountDetails + .lastname + } + +
{
- - - - + {props.awaitingSubmission.awaitingSubmission[ + "@odata.count" + ] > 0 && ( + + )} + {props.myCases.myCases["@odata.count"] > 0 && ( + + )} + {props.watchedCases.watchedCases["@odata.count"] > + 0 && ( + + )} + {props.myRepresentations.myRepresentations[ + "@odata.count" + ] > 0 && ( + + )} - + {/* */} {showFileUpload == "true" && }
diff --git a/components/myportal/awaitingsubmission.js b/components/myportal/awaitingsubmission.js index 88bff7e7..42c215b7 100644 --- a/components/myportal/awaitingsubmission.js +++ b/components/myportal/awaitingsubmission.js @@ -23,24 +23,30 @@ const AwaitingSubmission = (props) => { showTopThree={ props.awaitingSubmission.awaitingSubmission } + showDetails={ + props.awaitingSubmission.awaitingSubmissionDetails + } topThreeType={"awaitingSubmission"} /> -
- - { - setCurrentView({ - "viewName": "Awaiting Submission", - "viewKey": "awaitingSubmission", - }); - }} - > - {t("myportal:viewall-link")} - - -
+ {props.awaitingSubmission.awaitingSubmission["@odata.count"] > + 3 && ( +
+ + { + setCurrentView({ + "viewName": "Awaiting Submission", + "viewKey": "awaitingSubmission", + }); + }} + > + {t("myportal:viewall-link")} + + +
+ )} ); diff --git a/components/myportal/mycases.js b/components/myportal/mycases.js index 1b1ab822..73321722 100644 --- a/components/myportal/mycases.js +++ b/components/myportal/mycases.js @@ -24,9 +24,9 @@ const MyCases = (props) => { topThreeType={"myCases"} /> - {props.myCases.myCases["@odata.count"] != 0 && ( + {props.myCases.myCases["@odata.count"] > 3 && (
- + { diff --git a/components/myportal/myrepresentations.js b/components/myportal/myrepresentations.js index a4db29a8..139c7dd4 100644 --- a/components/myportal/myrepresentations.js +++ b/components/myportal/myrepresentations.js @@ -21,12 +21,15 @@ const MyRepresentations = (props) => {
- {props.myRepresentations.myRepresentations["@odata.count"] != - 0 && ( + {props.myRepresentations.myRepresentations["@odata.count"] > + 3 && (
{ }
)} - {topThreeType != "awaitingSubmission" ? ( -
- {t("myportal:case-address")}:{" "} - {_.isEmpty(showDetails) - ? t("myportal:case-address-not-entered") - : _.isEmpty(showDetails[index]) - ? t("myportal:case-address-not-entered") - : _.isEmpty(showDetails[index].value[0]) - ? t("myportal:case-address-not-entered") - : _.isEmpty( - showDetails[index].value[0] - .pinswg_siteaddressline1 - ) - ? t("myportal:case-address-not-entered") - : showDetails[index].value[0] - .pinswg_siteaddressline1} -
- ) : ( - "" - )} + {/* {topThreeType != "awaitingSubmission" ? ( */} +
+ {t("myportal:case-address")}:{" "} + {_.isEmpty(showDetails) + ? t("myportal:case-address-not-entered") + : _.isEmpty(showDetails[index]) + ? t("myportal:case-address-not-entered") + : _.isEmpty(showDetails[index].value[0]) + ? t("myportal:case-address-not-entered") + : _.isEmpty( + showDetails[index].value[0] + .pinswg_siteaddressline1 + ) + ? t("myportal:case-address-not-entered") + : showDetails[index].value[0] + .pinswg_siteaddressline1 + + (!_.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 + : "")} +
+ {router.locale == "cy" ? jsonpath.query( transLookup, diff --git a/components/myportal/watchedcases.js b/components/myportal/watchedcases.js index 617ba86f..1d871c80 100644 --- a/components/myportal/watchedcases.js +++ b/components/myportal/watchedcases.js @@ -21,11 +21,12 @@ const WatchedCases = (props) => {
- {props.watchedCases.watchedCases["@odata.count"] != 0 && ( + {props.watchedCases.watchedCases["@odata.count"] > 3 && (
- - Go back home - + + { + destroyCookie({}, "pinsUser"), + window.localStorage.clear(), + signOut({ + callbackUrl: "/", + }); + }} + > + {" "} + Go back home +
diff --git a/pages/api/endpoint/getappealtypesfornewappeal_api.js b/pages/api/endpoint/getappealtypesfornewappeal_api.js new file mode 100644 index 00000000..2b561553 --- /dev/null +++ b/pages/api/endpoint/getappealtypesfornewappeal_api.js @@ -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; diff --git a/pages/newappeal/index.js b/pages/newappeal/index.js index 6a98c57e..d28b6588 100644 --- a/pages/newappeal/index.js +++ b/pages/newappeal/index.js @@ -2,7 +2,7 @@ import useTranslation from "next-translate/useTranslation"; import Head from "next/head"; import { useRouter } from "next/router"; import { connect } from "react-redux"; -import { getAppealsTypes, getLPA } from "../../actions"; +import { getAppealsTypesForNewAppeal, getLPA } from "../../actions"; import Breadcrumbs from "../../components/breadcrumbs"; import CookieBanner from "../../components/cookieBanner"; import Footer from "../../components/footer"; @@ -130,7 +130,7 @@ export const getServerSideProps = wrapper.getServerSideProps( let loggedInUser = cookies.pinsUser; const [appealTypeData, lpaData, caseData] = await Promise.all([ - await getAppealsTypes(), + await getAppealsTypesForNewAppeal(), await getLPA(), ]);