);
-}
+};
+
+export default MyPortal;
diff --git a/components/myportal/awaitingsubmission.js b/components/myportal/awaitingsubmission.js
index 83eb3244..6116d652 100644
--- a/components/myportal/awaitingsubmission.js
+++ b/components/myportal/awaitingsubmission.js
@@ -2,12 +2,16 @@ import Link from "next/link";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import TopThree from "./topthree";
+import { connect } from "react-redux";
+import { setCurrentView } from "../../store/currentView/action";
-export default function AwaitingSubmission() {
+const AwaitingSubmission = (props) => {
let { t } = useTranslation();
const router = useRouter();
const { locale } = router;
+ const { setCurrentView } = props;
+
return (
);
-}
+};
+
+const mapDispatchToProps = (dispatch) => {
+ return {
+ setCurrentView: (currentView) => {
+ dispatch(setCurrentView(currentView));
+ },
+ };
+};
+
+export default connect(null, mapDispatchToProps)(AwaitingSubmission);
diff --git a/components/myportal/mycases.js b/components/myportal/mycases.js
index 73774de8..3bb6f969 100644
--- a/components/myportal/mycases.js
+++ b/components/myportal/mycases.js
@@ -2,11 +2,15 @@ import Link from "next/link";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import TopThree from "./topthree";
-export default function MyCases() {
+import { connect } from "react-redux";
+import { setCurrentView } from "../../store/currentView/action";
+
+const MyCases = (props) => {
let { t } = useTranslation();
const router = useRouter();
const { locale } = router;
+ const { setCurrentView } = props;
return (
);
-}
+};
+
+const mapDispatchToProps = (dispatch) => {
+ return {
+ setCurrentView: (currentView) => {
+ dispatch(setCurrentView(currentView));
+ },
+ };
+};
+
+export default connect(null, mapDispatchToProps)(MyCases);
diff --git a/components/myportal/myrepresentations.js b/components/myportal/myrepresentations.js
index 4b39a92e..213cc402 100644
--- a/components/myportal/myrepresentations.js
+++ b/components/myportal/myrepresentations.js
@@ -2,11 +2,16 @@ import Link from "next/link";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import TopThree from "./topthree";
-export default function MyRepresentations() {
+import { connect } from "react-redux";
+import { setCurrentView } from "../../store/currentView/action";
+
+const MyRepresentations = (props) => {
let { t } = useTranslation();
const router = useRouter();
const { locale } = router;
+ const { setCurrentView } = props;
+
return (
);
-}
+};
+
+const mapDispatchToProps = (dispatch) => {
+ return {
+ setCurrentView: (currentView) => {
+ dispatch(setCurrentView(currentView));
+ },
+ };
+};
+
+export default connect(null, mapDispatchToProps)(MyRepresentations);
diff --git a/components/myportal/topthree.js b/components/myportal/topthree.js
index 109d2748..a5dc42b2 100644
--- a/components/myportal/topthree.js
+++ b/components/myportal/topthree.js
@@ -2,55 +2,34 @@ import Link from "next/link";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
-export default function TopThree() {
+const TopThree = (props) => {
let { t } = useTranslation();
+ const { showTopThree } = props;
const router = useRouter();
const { locale } = router;
- return (
- <>
-
+
+ let topthreeRow = [];
+
+ for (var i = 0; i < 3; i++)
+ topthreeRow.push(
+
- Address: Beggars Lane
+ Address: {props.showTopThree.value[i].address}
—
-
-
-
-
- Address: Beggars Lane
-
-
-
—
-
-
-
-
-
- Address: Beggars Lane
-
-
-
—
-
- >
- );
-}
+ );
+
+ return <>{topthreeRow}>;
+};
+
+export default TopThree;
diff --git a/components/myportal/viewall.js b/components/myportal/viewall.js
new file mode 100644
index 00000000..a7245150
--- /dev/null
+++ b/components/myportal/viewall.js
@@ -0,0 +1,113 @@
+import Link from "next/link";
+import { useRouter } from "next/router";
+import useTranslation from "next-translate/useTranslation";
+
+export default function ViewAllResults(props) {
+ const { searchString, searchResultsObj, currentView } = props;
+ let { t } = useTranslation();
+
+ const router = useRouter();
+ const { locale } = router;
+
+ var resultsArr = props[currentView.viewKey][currentView.viewKey].value || [
+ {},
+ ];
+ let resultsRowArr = [];
+ Object.keys(resultsArr).map((key, index) => {
+ resultsRowArr.push(
+
+
+
+
+
+ Case Reference:
+
+ {resultsArr[index].reference}
+
+
+
+
+
+ Site Address:{" "}
+
+ {resultsArr[index].address1}
+
{resultsArr[index].town}
+
+ {resultsArr[index].postcode}
+
+
+
+ Appellant/Applicant:
+
+ {resultsArr[index].appellantApplicant}
+
+
+ Authority:
+ {resultsArr[index].lpaname}
+
+
+ Case Type:
+ {
+ resultsArr[index][
+ "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
+ ]
+ }
+
+
+ Status:
+ {
+ resultsArr[index][
+ "statuscode@OData.Community.Display.V1.FormattedValue"
+ ]
+ }
+
+
+ );
+ });
+
+ return (
+ <>
+
+
+
+ {currentView.viewName}
+
+
+
+
+
-
+ {t("search:searchresults-case-reference-label")}
+
+ -
+ {t("search:searchresults-site-address-label")}
+
+ -
+ {t("search:searchresults-applicant-label")}
+
+ -
+ {t("search:searchresults-authority-label")}
+
+ -
+ {t("search:searchresults-case-type-label")}
+
+ -
+ {t("search:searchresults-status-label")}
+
+
+
+ {resultsRowArr}
+
+
+
+
+ >
+ );
+}
diff --git a/components/myportal/watchedcases.js b/components/myportal/watchedcases.js
index 7ca84b66..84978e3f 100644
--- a/components/myportal/watchedcases.js
+++ b/components/myportal/watchedcases.js
@@ -2,11 +2,16 @@ import Link from "next/link";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import TopThree from "./topthree";
-export default function WatchedCases() {
+import { connect } from "react-redux";
+import { setCurrentView } from "../../store/currentView/action";
+
+const WatchedCases = (props) => {
let { t } = useTranslation();
const router = useRouter();
const { locale } = router;
+ const { setCurrentView } = props;
+
return (
);
-}
+};
+
+const mapDispatchToProps = (dispatch) => {
+ return {
+ setCurrentView: (currentView) => {
+ console.log(currentView);
+ dispatch(setCurrentView(currentView));
+ },
+ };
+};
+
+export default connect(null, mapDispatchToProps)(WatchedCases);
diff --git a/components/newappeal/createCase.js b/components/newappeal/createCase.js
index db727b74..f80c367e 100644
--- a/components/newappeal/createCase.js
+++ b/components/newappeal/createCase.js
@@ -82,7 +82,7 @@ let CreateCase = (props) => {
@@ -89,6 +90,7 @@ const mapStateToProps = (state) => {
search: state.search,
searchResultsObj: state.searchResultsObj,
form: state.form,
+ currentView: state.currentView,
};
};
diff --git a/store/appealType/action.js b/store/appealType/action.js
index 9906d262..29cf4007 100644
--- a/store/appealType/action.js
+++ b/store/appealType/action.js
@@ -1,5 +1,3 @@
-import { actionTypes } from "redux-form";
-
export const appealTypeDataActionTypes = {
GETAPPEALTYPEDATA: "GETAPPEALTYPEDATA",
SETAPPEALTYPEDATA: "SETAPPEALTYPEDATA",
diff --git a/store/awaitingSubmission/action.js b/store/awaitingSubmission/action.js
new file mode 100644
index 00000000..1af673dd
--- /dev/null
+++ b/store/awaitingSubmission/action.js
@@ -0,0 +1,18 @@
+export const awaitingSubmissionActionTypes = {
+ GETAWAITINGSUBMISSION: "GETAWAITINGSUBMISSION",
+ SETAWAITINGSUBMISSION: "SETAWAITINGSUBMISSION",
+ UPDATEAWAITINGSUBMISSION: "UPDATEAWAITINGSUBMISSION",
+};
+
+export const getAwaitingSubmissionObj = () => (dispatch) => {
+ return dispatch({
+ type: awaitingSubmissionActionTypes.GETAWAITINGSUBMISSION,
+ });
+};
+
+export const setAwaitingSubmission = (awaitingSubmission) => (dispatch) => {
+ return dispatch({
+ type: awaitingSubmissionActionTypes.SETAWAITINGSUBMISSION,
+ awaitingSubmission: awaitingSubmission,
+ });
+};
diff --git a/store/awaitingSubmission/reducer.js b/store/awaitingSubmission/reducer.js
new file mode 100644
index 00000000..7d66f2f6
--- /dev/null
+++ b/store/awaitingSubmission/reducer.js
@@ -0,0 +1,19 @@
+import { awaitingSubmissionActionTypes } from "./action";
+
+const awaitingSubmissionInitialState = {
+ awaitingSubmission: {},
+};
+
+export default function reducer(
+ state = awaitingSubmissionInitialState,
+ action
+) {
+ switch (action.type) {
+ case awaitingSubmissionActionTypes.SETAWAITINGSUBMISSION:
+ return {
+ awaitingSubmission: action.awaitingSubmission,
+ };
+ default:
+ return state;
+ }
+}
diff --git a/store/currentView/action.js b/store/currentView/action.js
new file mode 100644
index 00000000..26b20a0e
--- /dev/null
+++ b/store/currentView/action.js
@@ -0,0 +1,17 @@
+export const currentViewActionTypes = {
+ GETCURRENTVIEW: "GETCURRENTVIEW",
+ SETCURRENTVIEW: "SETCURRENTVIEW",
+};
+
+export const getCurrentViewObj = () => (dispatch) => {
+ return dispatch({
+ type: currentViewActionTypes.GETCURRENTVIEW,
+ });
+};
+
+export const setCurrentView = (currentView) => (dispatch) => {
+ return dispatch({
+ type: currentViewActionTypes.SETCURRENTVIEW,
+ currentView: currentView,
+ });
+};
diff --git a/store/currentView/reducer.js b/store/currentView/reducer.js
new file mode 100644
index 00000000..4d9fc02f
--- /dev/null
+++ b/store/currentView/reducer.js
@@ -0,0 +1,17 @@
+import { currentViewActionTypes } from "./action";
+
+const currentViewInitialState = {
+ currentView: {},
+};
+
+export default function reducer(state = currentViewInitialState, action) {
+ switch (action.type) {
+ case currentViewActionTypes.SETCURRENTVIEW:
+ return {
+ ...state,
+ currentView: action.currentView,
+ };
+ default:
+ return state;
+ }
+}
diff --git a/store/myCases/action.js b/store/myCases/action.js
new file mode 100644
index 00000000..5856e7ba
--- /dev/null
+++ b/store/myCases/action.js
@@ -0,0 +1,18 @@
+export const myCasesActionTypes = {
+ GETMYCASES: "GETMYCASES",
+ SETMYCASES: "SETMYCASES",
+ UPDATEMYCASES: "UPDATEMYCASES",
+};
+
+export const getMyCasesObj = () => (dispatch) => {
+ return dispatch({
+ type: myCasesActionTypes.GETMYCASES,
+ });
+};
+
+export const setMyCases = (myCases) => (dispatch) => {
+ return dispatch({
+ type: myCasesActionTypes.SETMYCASES,
+ myCases: myCases,
+ });
+};
diff --git a/store/myCases/reducer.js b/store/myCases/reducer.js
new file mode 100644
index 00000000..0623940d
--- /dev/null
+++ b/store/myCases/reducer.js
@@ -0,0 +1,16 @@
+import { myCasesActionTypes } from "./action";
+
+const myCasesInitialState = {
+ myCases: {},
+};
+
+export default function reducer(state = myCasesInitialState, action) {
+ switch (action.type) {
+ case myCasesActionTypes.SETMYCASES:
+ return {
+ myCases: action.myCases,
+ };
+ default:
+ return state;
+ }
+}
diff --git a/store/myRepresentations/action.js b/store/myRepresentations/action.js
new file mode 100644
index 00000000..c483fa58
--- /dev/null
+++ b/store/myRepresentations/action.js
@@ -0,0 +1,18 @@
+export const myRepresentationsActionTypes = {
+ GETMYREPRESENTATIONS: "GETMYREPRESENTATIONS",
+ SETMYREPRESENTATIONS: "SETMYREPRESENTATIONS",
+ UPDATEMYREPRESENTATIONS: "UPDATEMYREPRESENTATIONS",
+};
+
+export const getMyRepresentationsObj = () => (dispatch) => {
+ return dispatch({
+ type: myRepresentationsActionTypes.GETMYREPRESENTATIONS,
+ });
+};
+
+export const setMyRepresentations = (myRepresentations) => (dispatch) => {
+ return dispatch({
+ type: myRepresentationsActionTypes.SETMYREPRESENTATIONS,
+ myRepresentations: myRepresentations,
+ });
+};
diff --git a/store/myRepresentations/reducer.js b/store/myRepresentations/reducer.js
new file mode 100644
index 00000000..5c7bc8be
--- /dev/null
+++ b/store/myRepresentations/reducer.js
@@ -0,0 +1,16 @@
+import { myRepresentationsActionTypes } from "./action";
+
+const myRepresentationsInitialState = {
+ myRepresentations: {},
+};
+
+export default function reducer(state = myRepresentationsInitialState, action) {
+ switch (action.type) {
+ case myRepresentationsActionTypes.SETMYREPRESENTATIONS:
+ return {
+ myRepresentations: action.myRepresentations,
+ };
+ default:
+ return state;
+ }
+}
diff --git a/store/store.js b/store/store.js
index 89fcc1b5..634c5334 100644
--- a/store/store.js
+++ b/store/store.js
@@ -1,24 +1,35 @@
import { createStore, applyMiddleware, combineReducers } from "redux";
import { createWrapper, HYDRATE } from "next-redux-wrapper";
import thunkMiddleware from "redux-thunk";
+import { reducer as formReducer } from "redux-form";
+import autoMergeLevel2 from "redux-persist/lib/stateReconciler/autoMergeLevel2";
+import autoMergeLevel1 from "redux-persist/lib/stateReconciler/autoMergeLevel1";
+import storage from "redux-persist/lib/storage";
+import currentView from "./currentView/reducer";
import search from "./search/reducer";
import searchResultsObj from "./searchOutput/reducer";
import formData from "./formData/reducer";
import appealType from "./appealType/reducer";
import LPAData from "./lpa/reducer";
import accountDetails from "./accountDetails/reducer";
-import { reducer as formReducer } from "redux-form";
-import autoMergeLevel2 from "redux-persist/lib/stateReconciler/autoMergeLevel2";
-import storage from "redux-persist/lib/storage";
+import awaitingSubmission from "./awaitingSubmission/reducer";
+import myCases from "./myCases/reducer";
+import myRepresentations from "./myRepresentations/reducer";
+import watchedCases from "./watchedCases/reducer";
//COMBINING ALL REDUCERS
const appReducer = combineReducers({
+ currentView,
search,
searchResultsObj,
formData,
appealType,
LPAData,
accountDetails,
+ awaitingSubmission,
+ myCases,
+ myRepresentations,
+ watchedCases,
form: formReducer,
});
@@ -90,12 +101,17 @@ const makeStore = ({ isServer }) => {
const persistConfig = {
key: "acp",
whitelist: [
+ "currentView",
"search",
"searchResults",
"formData",
"appealType",
"LPAData",
"accountDetails",
+ "awaitingSubmission",
+ "myCases",
+ "myRepresentations",
+ "watchedCases",
"form",
],
storage: storage,
diff --git a/store/watchedCases/action.js b/store/watchedCases/action.js
new file mode 100644
index 00000000..062a9e32
--- /dev/null
+++ b/store/watchedCases/action.js
@@ -0,0 +1,18 @@
+export const watchedCasesActionTypes = {
+ GETWATCHEDCASES: "GETWATCHEDCASES",
+ SETWATCHEDCASES: "SETWATCHEDCASES",
+ UPDATEWATCHEDCASES: "UPDATEWATCHEDCASES",
+};
+
+export const getWatchedCasesObj = () => (dispatch) => {
+ return dispatch({
+ type: watchedCasesActionTypes.GETWATCHEDCASES,
+ });
+};
+
+export const setWatchedCases = (watchedCases) => (dispatch) => {
+ return dispatch({
+ type: watchedCasesActionTypes.SETWATCHEDCASES,
+ watchedCases: watchedCases,
+ });
+};
diff --git a/store/watchedCases/reducer.js b/store/watchedCases/reducer.js
new file mode 100644
index 00000000..40d2637f
--- /dev/null
+++ b/store/watchedCases/reducer.js
@@ -0,0 +1,16 @@
+import { watchedCasesActionTypes } from "./action";
+
+const watchedCasesInitialState = {
+ watchedCases: {},
+};
+
+export default function reducer(state = watchedCasesInitialState, action) {
+ switch (action.type) {
+ case watchedCasesActionTypes.SETWATCHEDCASES:
+ return {
+ watchedCases: action.watchedCases,
+ };
+ default:
+ return state;
+ }
+}