From 3c38da140034bc453441a08cdc70e2468dcc4660 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Tue, 9 Nov 2021 15:33:23 +0000 Subject: [PATCH] added in representations --- .env.local | 20 ++++---- actions/index.js | 43 +++++++++------- components/case.js | 3 ++ components/case/representation/index.js | 51 ++++++++++--------- .../representation/representationAgent.js | 2 +- .../representation/representationAppellant.js | 7 +-- .../representation/representationDetails.js | 23 ++------- .../representationInterestedPartyPerson.js | 4 +- .../representation/representationLandowner.js | 4 +- components/case/representationList.js | 41 +++++++++++++++ components/case/summary.js | 6 +-- components/myportal/topthree.js | 25 +++++++-- i18n.js | 2 +- pages/{ => myportal}/representation.js | 20 ++++---- 14 files changed, 152 insertions(+), 99 deletions(-) create mode 100644 components/case/representationList.js rename pages/{ => myportal}/representation.js (90%) diff --git a/.env.local b/.env.local index 6f725e8c..4e27b1d5 100644 --- a/.env.local +++ b/.env.local @@ -1,9 +1,9 @@ // dev -//RELAY_ROOT = https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/ -//RELAYURI = "dev-pedw-ns.servicebus.windows.net" -//RELAYPATH = "dev-pedw-hc" -//SASKEY = "Ml0Y/S/nfRcmIrHFRkO4jNm2J3iH52TSxPiak7+E1+Y=" -//SASKEYNAME = "devpedwnspolicy" +RELAY_ROOT = https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/ +RELAYURI = "dev-pedw-ns.servicebus.windows.net" +RELAYPATH = "dev-pedw-hc" +SASKEY = "Ml0Y/S/nfRcmIrHFRkO4jNm2J3iH52TSxPiak7+E1+Y=" +SASKEYNAME = "devpedwnspolicy" PORT= "3000" @@ -15,11 +15,11 @@ I18N_DOMAIN = "cymru.local" //I18N_DOMAIN ="gwaithcynllunio.gwasanaeth.llyw.cymru" //test -RELAY_ROOT = https://test-pedw-ns.servicebus.windows.net/test-pedw-hc/ -RELAYURI = "test-pedw-ns.servicebus.windows.net" -RELAYPATH = "test-pedw-hc" -SASKEY = "kTLrs9UHwuW9Msc9uNfjf+89qLYT6ly80lK0zdTYJW4=" -SASKEYNAME = "testpedwhcpolicy" +//RELAY_ROOT = https://test-pedw-ns.servicebus.windows.net/test-pedw-hc/ +//RELAYURI = "test-pedw-ns.servicebus.windows.net" +//RELAYPATH = "test-pedw-hc" +//SASKEY = "kTLrs9UHwuW9Msc9uNfjf+89qLYT6ly80lK0zdTYJW4=" +//SASKEYNAME = "testpedwhcpolicy" //preprod diff --git a/actions/index.js b/actions/index.js index 5bf870de..4b5be744 100644 --- a/actions/index.js +++ b/actions/index.js @@ -818,23 +818,32 @@ export const getMyCases = (token, loggedInUserId) => { }; export const getMyRepresentations = (token, loggedInUserId) => { - return ( - axios - // .get(BASE_URL + "/api/lookups/myRepresentations", { - // httpsAgent: new https.Agent({ rejectUnauthorized: false }), - // }) - .get( - WEBAPI_URL + - "incidents?$select=ticketnumber,casetypecode,createdon,_customerid_value,description,incidentid,pinswg_appealcasetype,_pinswg_assignedinspectrids_value,statecode,statuscode,title&$filter=_customerid_value eq " + - loggedInUserId + - " and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true&$top=3", - azureHeaders(token) - ) - .then((res) => res.data) - .catch((error) => { - console.log("thi serror", error); - }) - ); + return axios + .get( + WEBAPI_URL + + "pinswg_representationses?$filter= _pinswg_contact_value eq " + + loggedInUserId + + "&$count=true&$orderby=createdon desc", + azureHeaders(token) + ) + .then((res) => res.data) + .catch((error) => { + console.log("this serror", error); + }); +}; + +export const getMyRepresentationsProxy = (token, loggedInUserId) => { + return axios + .get( + "/api/proxy/pinswg_representationses?$filter= _pinswg_contact_value eq " + + loggedInUserId + + "&$count=true&$orderby=createdon desc", + azureHeaders(token) + ) + .then((res) => res.data) + .catch((error) => { + console.log("this serror", error); + }); }; export const getWatchedCases = (token, loggedInUserId) => { diff --git a/components/case.js b/components/case.js index b2bfcdbe..92d2f5e1 100644 --- a/components/case.js +++ b/components/case.js @@ -4,6 +4,7 @@ import { useContext } from "react"; import useTranslation from "next-translate/useTranslation"; import Summary from "./case/summary"; import Documents from "./case/documents"; +import RepresentationList from "./case/representationList"; const CaseSummary = (props) => { let { t } = useTranslation(); @@ -42,6 +43,8 @@ const CaseSummary = (props) => { documentDetailsObj={props.documentDetailsObj} documentHistoryObj={props.documentHistoryObj} /> + + diff --git a/components/case/representation/index.js b/components/case/representation/index.js index 0e16f76f..9f883b2d 100644 --- a/components/case/representation/index.js +++ b/components/case/representation/index.js @@ -49,6 +49,7 @@ let MakeRepresentation = (props) => { watchedCases, awaitingSubmission, searchResultsObj, + representationSubmit, currentType, currentView, setRepresentationCapacity, @@ -160,7 +161,7 @@ let MakeRepresentation = (props) => { /> ); break; - case "interestedpartyperson": + case "interestedparty/person": // setRepresentationCapacity("interestedpartyperson"); return ( { return (
- {repForm["representationForm.submitSucceeded"] == true ? ( - - ) : ( -
- {whichControl()} -
- )} - - {console.log("is submitted", currentView.representationSubmit)} +
+ {representationSubmit == true ? ( + + ) : ( + <> +

+ Make a representation on:{" "} + {currentView.caseReference.currentReference} +

+ {whichControl()} + + )} +
); }; @@ -271,8 +276,8 @@ const mapStateToProps = (state) => { const mapDispatchToProps = (dispatch) => { return { setRepresentationCapacity: (representationCapacity) => { - dispatch(setRepresentationCapacity(representationCapacity)); dispatch(reset("representationForm")); + dispatch(setRepresentationCapacity(representationCapacity)); }, setRepresentationSubmit: (representationSubmit) => { dispatch(setRepresentationSubmit(representationSubmit)); diff --git a/components/case/representation/representationAgent.js b/components/case/representation/representationAgent.js index 741448ef..692ed496 100644 --- a/components/case/representation/representationAgent.js +++ b/components/case/representation/representationAgent.js @@ -219,7 +219,7 @@ const RepAgent = (props) => { { - setRepresentationCapacity("false"); + setRepresentationCapacity(); }} className="govuk-link" > diff --git a/components/case/representation/representationAppellant.js b/components/case/representation/representationAppellant.js index 6e2305f7..927c1edc 100644 --- a/components/case/representation/representationAppellant.js +++ b/components/case/representation/representationAppellant.js @@ -38,10 +38,6 @@ const RepAppellant = (props) => {
-

- Representation - appellantApplicant -

-
- {currentView.representationCapacity}
diff --git a/components/myportal/topthree.js b/components/myportal/topthree.js index c9a02c69..31a73064 100644 --- a/components/myportal/topthree.js +++ b/components/myportal/topthree.js @@ -114,16 +114,27 @@ const TopThree = (props) => { setCurrentReference({ "currentReference": topThreeType != "watchedCases" - ? showTopThreeArr[key] - .ticketnumber + ? topThreeType != + "myRepresentations" + ? showTopThreeArr[key] + .ticketnumber + : showTopThreeArr[key][ + "_pinswg_case_value@OData.Community.Display.V1.FormattedValue" + ] : showTopThreeArr[key][ "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" ], "currentType": topThreeType, + "incidentid": topThreeType != "watchedCases" - ? showTopThreeArr[key] - .incidentid + ? topThreeType != + "myRepresentations" + ? showTopThreeArr[key] + ._pinswg_case_value + : showTopThreeArr[key][ + " _pinswg_watchedcase_value" + ] : showTopThreeArr[key][ " _pinswg_watchedcase_value" ], @@ -135,7 +146,11 @@ const TopThree = (props) => { }} > {topThreeType != "watchedCases" - ? showTopThreeArr[key].ticketnumber + ? topThreeType != "myRepresentations" + ? showTopThreeArr[key].ticketnumber + : showTopThreeArr[key][ + "_pinswg_case_value@OData.Community.Display.V1.FormattedValue" + ] : showTopThreeArr[key][ "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" ]} diff --git a/i18n.js b/i18n.js index 26082685..1fa7971a 100644 --- a/i18n.js +++ b/i18n.js @@ -21,7 +21,7 @@ module.exports = { "/searchresults": ["search"], "/viewall": ["search"], "/case": ["case"], - "/representation": ["case"], + "/myportal/representation": ["case"], "/newappeal": ["newappeal"], "/newappeal/*": ["newappeal"], "/newappeal/selectappeal": ["newappeal"], diff --git a/pages/representation.js b/pages/myportal/representation.js similarity index 90% rename from pages/representation.js rename to pages/myportal/representation.js index cc2ee023..fa8e3984 100644 --- a/pages/representation.js +++ b/pages/myportal/representation.js @@ -1,19 +1,19 @@ import _ from "lodash"; import Head from "next/head"; -import Header from "../components/header"; -import Banner from "../components/banner"; -import CookieBanner from "../components/cookieBanner"; -import Breadcrumbs from "../components/breadcrumbs"; -import CaseSummary from "../components/case"; -import Footer from "../components/footer"; -import Errorpage from "../components/errorpage"; -import styles from "../styles/Home.module.css"; +import Header from "../../components/header"; +import Banner from "../../components/banner"; +import CookieBanner from "../../components/cookieBanner"; +import Breadcrumbs from "../../components/breadcrumbs"; +import CaseSummary from "../../components/case"; +import Footer from "../../components/footer"; +import Errorpage from "../../components/errorpage"; +import styles from "../../styles/Home.module.css"; import { useSelector, shallowEqual, connect } from "react-redux"; -import { wrapper } from "../store/store"; +import { wrapper } from "../../store/store"; import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; -import Case from "../components/representation"; +import Case from "../../components/representation"; const Home = (props) => { const { footerLinks, pages } = props;