updated view all to set missing current view state
This commit is contained in:
@@ -304,11 +304,11 @@ const RepCompleteSubmit = (props) => {
|
|||||||
|
|
||||||
<dd className="govuk-summary-list__value">
|
<dd className="govuk-summary-list__value">
|
||||||
{formObj.representationForm.values.hasOwnProperty(
|
{formObj.representationForm.values.hasOwnProperty(
|
||||||
"representationDocuments"
|
"filesList"
|
||||||
) &&
|
) &&
|
||||||
formObj.representationForm.values
|
formObj.representationForm.values
|
||||||
.representationDocuments.length > 0
|
.filesList.length > 0
|
||||||
? formObj.representationForm.values.representationDocuments.map(
|
? formObj.representationForm.values.filesList.map(
|
||||||
(blob, i) => (
|
(blob, i) => (
|
||||||
<div
|
<div
|
||||||
key={
|
key={
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ const AwaitingSubmissionFromBlob = (props) => {
|
|||||||
|
|
||||||
<TopThreeRow />
|
<TopThreeRow />
|
||||||
|
|
||||||
{props.awaitingSubmissionFromBlob["@odata.count"] > 3 && (
|
{props.awaitingSubmissionFromBlob["@odata.count"] > 1 && (
|
||||||
<div className="cardVieAll">
|
<div className="cardVieAll">
|
||||||
<Link
|
<Link
|
||||||
href={
|
href={
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ const ViewAllResults = (props) => {
|
|||||||
// ? searchDetailsObj[key].value[0]
|
// ? searchDetailsObj[key].value[0]
|
||||||
// : searchDetailsObj[key];
|
// : searchDetailsObj[key];
|
||||||
|
|
||||||
|
console.log(resultsArr[key]);
|
||||||
resultsRowArr.push(
|
resultsRowArr.push(
|
||||||
<div className="govuk-summary-list__row" key={key}>
|
<div className="govuk-summary-list__row" key={key}>
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 govuk-!-padding-left-2">
|
<dd className="govuk-summary-list__value govuk-!-font-size-16 govuk-!-padding-left-2">
|
||||||
@@ -185,14 +186,18 @@ const ViewAllResults = (props) => {
|
|||||||
"&casereference=" +
|
"&casereference=" +
|
||||||
resultsArr[key].title +
|
resultsArr[key].title +
|
||||||
"&inid=" +
|
"&inid=" +
|
||||||
resultsArr[key].incidentid
|
resultsArr[key].incidentid +
|
||||||
|
"&key=" +
|
||||||
|
currentView.viewKey
|
||||||
: router.locale == "cy"
|
: router.locale == "cy"
|
||||||
? myportal == true
|
? myportal == true
|
||||||
? "/fymhorth/achos"
|
? "/fymhorth/achos"
|
||||||
: "/achos"
|
: "/achos"
|
||||||
: myportal == true
|
: myportal == true
|
||||||
? "/myportal/case/" +
|
? "/myportal/case/" +
|
||||||
resultsArr[key].ticketnumber
|
resultsArr[key].ticketnumber +
|
||||||
|
"?key=" +
|
||||||
|
currentView.viewKey
|
||||||
: "/case/" +
|
: "/case/" +
|
||||||
resultsArr[key].ticketnumber
|
resultsArr[key].ticketnumber
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
getPartSavedAppeal,
|
getPartSavedAppeal,
|
||||||
getFilesFromBlob,
|
getFilesFromBlob,
|
||||||
getProgressFromBlob,
|
getProgressFromBlob,
|
||||||
|
getAwaitingSubmissionFromBlob,
|
||||||
getIP,
|
getIP,
|
||||||
} from "../../actions";
|
} from "../../actions";
|
||||||
import Breadcrumbs from "../../components/breadcrumbs";
|
import Breadcrumbs from "../../components/breadcrumbs";
|
||||||
@@ -37,6 +38,15 @@ import {
|
|||||||
setCaseReference,
|
setCaseReference,
|
||||||
setFilesForAppeal,
|
setFilesForAppeal,
|
||||||
} from "../../store/appealType/action";
|
} from "../../store/appealType/action";
|
||||||
|
import {
|
||||||
|
setCurrentReference,
|
||||||
|
setCurrentView,
|
||||||
|
} from "../../store/currentView/action";
|
||||||
|
import {
|
||||||
|
setAwaitingSubmission,
|
||||||
|
setAwaitingSubmissionFromBlob,
|
||||||
|
setAwaitingSubmissionDetails,
|
||||||
|
} from "../../store/awaitingSubmission/action";
|
||||||
import { setForm } from "../../store/formData/action";
|
import { setForm } from "../../store/formData/action";
|
||||||
import { wrapper } from "../../store/store";
|
import { wrapper } from "../../store/store";
|
||||||
import { getPartSavedDetails } from "../../components/utils";
|
import { getPartSavedDetails } from "../../components/utils";
|
||||||
@@ -296,6 +306,25 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
xmlStr = xmlStr.replace(/> <"/g, "><");
|
xmlStr = xmlStr.replace(/> <"/g, "><");
|
||||||
xmlStr = xmlStr.toString();
|
xmlStr = xmlStr.toString();
|
||||||
|
|
||||||
|
if (query.hasOwnProperty("key")) {
|
||||||
|
const awaitingSubmissionFromBlob =
|
||||||
|
await getAwaitingSubmissionFromBlob(thisSession.user.id);
|
||||||
|
|
||||||
|
store.dispatch(
|
||||||
|
setAwaitingSubmissionFromBlob(awaitingSubmissionFromBlob)
|
||||||
|
);
|
||||||
|
|
||||||
|
store.dispatch(
|
||||||
|
setAwaitingSubmissionDetails(awaitingSubmissionFromBlob)
|
||||||
|
);
|
||||||
|
store.dispatch(
|
||||||
|
setCurrentView({
|
||||||
|
"viewName": "Awaiting Submission",
|
||||||
|
"viewKey": "awaitingSubmissionDetails",
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
store.dispatch(setLoggedInUserId(loggedInUser));
|
store.dispatch(setLoggedInUserId(loggedInUser));
|
||||||
store.dispatch(setLoggedInUserEmail(loggedInUserEmail));
|
store.dispatch(setLoggedInUserEmail(loggedInUserEmail));
|
||||||
store.dispatch(setAppealLPA(query.lpa));
|
store.dispatch(setAppealLPA(query.lpa));
|
||||||
|
|||||||
@@ -7,12 +7,21 @@ import {
|
|||||||
getIP,
|
getIP,
|
||||||
getPortalLogin,
|
getPortalLogin,
|
||||||
getPersonalAccount,
|
getPersonalAccount,
|
||||||
|
getWatchedCases,
|
||||||
|
getPortalModuleDetails,
|
||||||
|
getMyCases,
|
||||||
|
getMyLPACases,
|
||||||
} from "../../../actions";
|
} from "../../../actions";
|
||||||
|
import { getFormCollectionByID } from "../../../components/utils";
|
||||||
|
|
||||||
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 { getSearchDetails } from "../../../components/utils";
|
import { getSearchDetails } from "../../../components/utils";
|
||||||
import { setCurrentReference } from "../../../store/currentView/action";
|
import {
|
||||||
|
setCurrentReference,
|
||||||
|
setCurrentView,
|
||||||
|
} from "../../../store/currentView/action";
|
||||||
import { setSearch } from "../../../store/search/action";
|
import { setSearch } from "../../../store/search/action";
|
||||||
import {
|
import {
|
||||||
setSearchDetails,
|
setSearchDetails,
|
||||||
@@ -27,6 +36,17 @@ import {
|
|||||||
setContainerID,
|
setContainerID,
|
||||||
setLoggedInUserId,
|
setLoggedInUserId,
|
||||||
} from "../../../store/accountDetails/action";
|
} from "../../../store/accountDetails/action";
|
||||||
|
import {
|
||||||
|
setMyRepresentations,
|
||||||
|
setMyRepresentationsDetails,
|
||||||
|
setMySubmittedReps,
|
||||||
|
setMySubmittedRepsDetails,
|
||||||
|
} from "../../../store/myRepresentations/action";
|
||||||
|
import {
|
||||||
|
setWatchedCases,
|
||||||
|
setWatchedCasesDetails,
|
||||||
|
} from "../../../store/watchedCases/action";
|
||||||
|
import { setMyCases, setMyCasesDetails } from "../../../store/myCases/action";
|
||||||
|
|
||||||
const CaseHome = (props) => {
|
const CaseHome = (props) => {
|
||||||
const { footerLinks, pages, setSearchResults, setSearchDetails } = props;
|
const { footerLinks, pages, setSearchResults, setSearchDetails } = props;
|
||||||
@@ -104,6 +124,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
console.log(cookies);
|
console.log(cookies);
|
||||||
console.log("the query :", query.ticketnumber);
|
console.log("the query :", query.ticketnumber);
|
||||||
|
|
||||||
|
console.log("viewkey:" + query.hasOwnProperty("key") ? "yes" : "no");
|
||||||
|
|
||||||
const showLoginCheck = process.env.SHOWLOGIN || false;
|
const showLoginCheck = process.env.SHOWLOGIN || false;
|
||||||
let thisSession = await getSession(ctx);
|
let thisSession = await getSession(ctx);
|
||||||
let loggedInUser = {};
|
let loggedInUser = {};
|
||||||
@@ -115,15 +137,21 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
loggedInUser = loggedInUser.value[0].contactid;
|
loggedInUser = loggedInUser.value[0].contactid;
|
||||||
|
|
||||||
const accountDetails = await getPersonalAccount(loggedInUser);
|
|
||||||
store.dispatch(setContainerID(thisSession.user.id));
|
|
||||||
store.dispatch(setAccountDetails(accountDetails));
|
|
||||||
store.dispatch(setLoggedInUserId(loggedInUser));
|
|
||||||
} else {
|
} else {
|
||||||
console.log("not has sesssion.......");
|
console.log("not has sesssion.......");
|
||||||
|
return {
|
||||||
|
redirect: {
|
||||||
|
destination: "/auth/signin",
|
||||||
|
permanent: false,
|
||||||
|
},
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const accountDetails = await getPersonalAccount(loggedInUser);
|
||||||
|
store.dispatch(setContainerID(thisSession.user.id));
|
||||||
|
store.dispatch(setAccountDetails(accountDetails));
|
||||||
|
store.dispatch(setLoggedInUserId(loggedInUser));
|
||||||
|
|
||||||
let developmentQuery =
|
let developmentQuery =
|
||||||
query.ticketnumber.indexOf("CAS-") == 0
|
query.ticketnumber.indexOf("CAS-") == 0
|
||||||
? query.ticketnumber
|
? query.ticketnumber
|
||||||
@@ -167,6 +195,110 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
if (query.hasOwnProperty("key")) {
|
||||||
|
let whichViewKey = query.key;
|
||||||
|
|
||||||
|
switch (whichViewKey) {
|
||||||
|
case "awaitingSubmissionDetails":
|
||||||
|
store.dispatch(
|
||||||
|
setCurrentView({
|
||||||
|
"viewName": "Awaiting Submission",
|
||||||
|
"viewKey": "awaitingSubmissionDetails",
|
||||||
|
})
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case "watchedCases":
|
||||||
|
const watchedCases = await getWatchedCases(
|
||||||
|
loggedInUser
|
||||||
|
);
|
||||||
|
|
||||||
|
let showWatchedCases = (submittedArr) => {
|
||||||
|
const required = submittedArr.value.filter(
|
||||||
|
(el) => {
|
||||||
|
return (
|
||||||
|
el.pinswg_representationsubmitted ==
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
let newObj = {};
|
||||||
|
return Object.assign(newObj, {
|
||||||
|
"@odata.count": required.length,
|
||||||
|
"value": required,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
let filteredWatchedCases =
|
||||||
|
showWatchedCases(watchedCases);
|
||||||
|
|
||||||
|
const watchedCasesDetails = await getDetails(
|
||||||
|
filteredWatchedCases,
|
||||||
|
"myWatchedCases"
|
||||||
|
);
|
||||||
|
|
||||||
|
store.dispatch(
|
||||||
|
setWatchedCases(filteredWatchedCases)
|
||||||
|
);
|
||||||
|
store.dispatch(
|
||||||
|
setWatchedCasesDetails(watchedCasesDetails)
|
||||||
|
);
|
||||||
|
|
||||||
|
store.dispatch(
|
||||||
|
setCurrentView({
|
||||||
|
"viewName": "Watched Cases",
|
||||||
|
"viewKey": "watchedCases",
|
||||||
|
})
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case "myCases":
|
||||||
|
const myCases =
|
||||||
|
accountDetails.pinswg_typeofinvolvement ==
|
||||||
|
846040012
|
||||||
|
? await getMyLPACases(lpaid)
|
||||||
|
: await getMyCases(loggedInUser);
|
||||||
|
|
||||||
|
const myCasesDetails = await getDetails(
|
||||||
|
myCases,
|
||||||
|
"myCases"
|
||||||
|
);
|
||||||
|
store.dispatch(setMyCases(myCases));
|
||||||
|
store.dispatch(setMyCasesDetails(myCasesDetails));
|
||||||
|
store.dispatch(
|
||||||
|
setCurrentView({
|
||||||
|
"viewName": "My Cases",
|
||||||
|
"viewKey": "myCases",
|
||||||
|
})
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case "myRepresentations":
|
||||||
|
const myRepresentations = await getRepsFromBlob(
|
||||||
|
thisSession.user.id
|
||||||
|
);
|
||||||
|
|
||||||
|
const myRepresentationsDetails = await getDetails(
|
||||||
|
myRepresentations,
|
||||||
|
"myRepresentations"
|
||||||
|
);
|
||||||
|
|
||||||
|
store.dispatch(
|
||||||
|
setMyRepresentations(myRepresentations)
|
||||||
|
);
|
||||||
|
store.dispatch(
|
||||||
|
setMyRepresentationsDetails(
|
||||||
|
myRepresentationsDetails
|
||||||
|
)
|
||||||
|
);
|
||||||
|
store.dispatch(
|
||||||
|
setCurrentView({
|
||||||
|
"viewName": "My Representations",
|
||||||
|
"viewKey": "myRepresentations",
|
||||||
|
})
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
// code block
|
||||||
|
}
|
||||||
|
}
|
||||||
store.dispatch(setSearchResults(searchResultsObj));
|
store.dispatch(setSearchResults(searchResultsObj));
|
||||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
@@ -207,6 +339,109 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const getDetails = (resultsObj, detailsType) => {
|
||||||
|
let detailsArr = [];
|
||||||
|
// console.log(
|
||||||
|
// "//////////////////////////////////\n",
|
||||||
|
// resultsObj,
|
||||||
|
// //"\n",
|
||||||
|
// detailsType,
|
||||||
|
// "\n//////////////////////////////////\n"
|
||||||
|
// );
|
||||||
|
|
||||||
|
resultsObj =
|
||||||
|
detailsType == "mySubmittedReps" ? resultsObj : resultsObj.value;
|
||||||
|
|
||||||
|
// console.log(
|
||||||
|
// "////////////////////////////////// resultsobj\n",
|
||||||
|
// detailsType,
|
||||||
|
// "\n",
|
||||||
|
// resultsObj.length + "\n//////////////////////////////////\n"
|
||||||
|
// );
|
||||||
|
|
||||||
|
if (detailsType == "myRepresentations") {
|
||||||
|
const repsObj = resultsObj.map((searchDetail, index) => {
|
||||||
|
//console.log(".......... ", searchDetail);
|
||||||
|
detailsArr.push(
|
||||||
|
getCase(searchDetail["incidentID"]).then((data) => {
|
||||||
|
let caseID = "";
|
||||||
|
|
||||||
|
switch (detailsType) {
|
||||||
|
case "myCases":
|
||||||
|
caseID = data.pinswg_title;
|
||||||
|
break;
|
||||||
|
case "myWatchedCases":
|
||||||
|
case "mySubmittedReps":
|
||||||
|
caseID =
|
||||||
|
data[
|
||||||
|
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case "awaitingSubmission":
|
||||||
|
caseID = data.ticketnumber;
|
||||||
|
break;
|
||||||
|
case "myRepresentations":
|
||||||
|
caseID = data.ticketnumber;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
caseID = data.pinswg_title;
|
||||||
|
}
|
||||||
|
return getPortalModuleDetails(
|
||||||
|
getFormCollectionByID(data.pinswg_appealcasetype)
|
||||||
|
.LogicalCollectionName,
|
||||||
|
caseID
|
||||||
|
);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const detailsObj = resultsObj.map((searchDetail, index) => {
|
||||||
|
let caseID = "";
|
||||||
|
|
||||||
|
switch (detailsType) {
|
||||||
|
case "myCases":
|
||||||
|
caseID = searchDetail.pinswg_title;
|
||||||
|
break;
|
||||||
|
case "myWatchedCases":
|
||||||
|
case "mySubmittedReps":
|
||||||
|
caseID =
|
||||||
|
searchDetail[
|
||||||
|
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case "awaitingSubmission":
|
||||||
|
caseID = searchDetail.ticketnumber;
|
||||||
|
break;
|
||||||
|
case "myRepresentations":
|
||||||
|
caseID = searchDetail.casereference;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
caseID = searchDetail.pinswg_title;
|
||||||
|
}
|
||||||
|
|
||||||
|
//console.log(detailsType, " case id : ", caseID);
|
||||||
|
|
||||||
|
searchDetail.pinswg_appealcasetype != null &&
|
||||||
|
detailsArr.push(
|
||||||
|
getPortalModuleDetails(
|
||||||
|
getFormCollectionByID(searchDetail.pinswg_appealcasetype)
|
||||||
|
.LogicalCollectionName,
|
||||||
|
caseID
|
||||||
|
// detailsType != "myWatchedCases"
|
||||||
|
// ? searchDetail.ticketnumber
|
||||||
|
// : searchDetail[
|
||||||
|
// "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||||
|
// ]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
let detArr = Promise.all(detailsArr);
|
||||||
|
console.log(detArr);
|
||||||
|
return detArr;
|
||||||
|
};
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
const mapStateToProps = (state) => {
|
||||||
return {
|
return {
|
||||||
accountDetails: state.accountDetails,
|
accountDetails: state.accountDetails,
|
||||||
|
|||||||
Reference in New Issue
Block a user