added fixes to reduce error when calling module details and filtering of docs
This commit is contained in:
+3
-3
@@ -42,10 +42,10 @@ class MyDocument extends Document {
|
||||
csp += `form-action 'self' ` + process.env.NEXTAUTH_URL + ` ;`;
|
||||
csp += `object-src 'self' data:;`;
|
||||
csp += `default-src 'self' https://www.google-analytics.com;`;
|
||||
csp += `connect-src 'self' http://127.0.0.1 https://ukwest-0.in.applicationinsights.azure.com https://js.monitor.azure.com https://region1.google-analytics.com;`;
|
||||
csp += `script-src 'self' 'unsafe-eval' 'unsafe-inline' https://ukwest-0.in.applicationinsights.azure.com https://region1.google-analytics.com https://www.google-analytics.com/ https://tagmanager.google.com/ https://www.googletagmanager.com/;`;
|
||||
csp += `connect-src 'self' http://127.0.0.1 https://maps.googleapis.com https://ukwest-0.in.applicationinsights.azure.com https://js.monitor.azure.com https://region1.google-analytics.com;`;
|
||||
csp += `script-src 'self' 'unsafe-eval' 'unsafe-inline' https://maps.googleapis.com https://ukwest-0.in.applicationinsights.azure.com https://region1.google-analytics.com https://www.google-analytics.com/ https://tagmanager.google.com/ https://www.googletagmanager.com/;`;
|
||||
csp += `style-src 'self' 'unsafe-inline' https://pro.fontawesome.com/ https://www.google-analytics.com https://tagmanager.google.com/ https://www.googletagmanager.com/ https://fonts.googleapis.com/;`;
|
||||
csp += `img-src 'self' 'unsafe-inline' https://www.gov.wales https://gov.wales https://fonts.gstatic.com https://www.googletagmanager.com https://www.google-analytics.com https://ssl.gstatic.com/ blob: data:;`;
|
||||
csp += `img-src 'self' 'unsafe-inline' https://maps.gstatic.com https://maps.googleapis.com https://www.gov.wales https://gov.wales https://fonts.gstatic.com https://www.googletagmanager.com https://www.google-analytics.com https://ssl.gstatic.com/ blob: data:;`;
|
||||
csp += `font-src 'self' 'unsafe-inline' https://pro.fontawesome.com/ https://fonts.gstatic.com/ data:;`;
|
||||
|
||||
return (
|
||||
|
||||
@@ -25,9 +25,17 @@ export default async function ApiProxy(req, res) {
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"incidents?$select=_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,statuscode,ticketnumber,title &$filter=pinswg_appealcasetype eq 846040011 and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||
"incidents?$select=pinswg_appealcasetype,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,statuscode,ticketnumber,title &$filter=pinswg_appealcasetype eq 846040011 and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||
|
||||
//console.log(queryUrl);
|
||||
console.log(queryUrl);
|
||||
|
||||
function renameJsonKey(jsonObj, oldKey, newKey) {
|
||||
if (jsonObj.hasOwnProperty(oldKey)) {
|
||||
jsonObj[newKey] = jsonObj[oldKey]; // Add new key with the same value
|
||||
delete jsonObj[oldKey]; // Delete old key
|
||||
}
|
||||
return jsonObj;
|
||||
}
|
||||
|
||||
return axios
|
||||
.get(
|
||||
@@ -36,6 +44,7 @@ export default async function ApiProxy(req, res) {
|
||||
)
|
||||
.then(({ data }) => {
|
||||
var dataStr;
|
||||
|
||||
_.has(data, "@odata.nextLink") == true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
|
||||
@@ -38,27 +38,33 @@ const hashAPIPath = (queryPath) => {
|
||||
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||
};
|
||||
|
||||
const groupArray = (arr = []) => {
|
||||
// create map
|
||||
let map = new Map();
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
const s = JSON.stringify(arr[i]);
|
||||
if (!map.has(s)) {
|
||||
map.set(s, {
|
||||
pinswg_isharedocumentlocations:
|
||||
arr[i].pinswg_isharedocumentlocations,
|
||||
pinswg_isharedocumentlocationsLabel:
|
||||
arr[i][
|
||||
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
|
||||
],
|
||||
// count: 1,
|
||||
});
|
||||
} else {
|
||||
//map.get(s).count++;
|
||||
}
|
||||
}
|
||||
const res = Array.from(map.values());
|
||||
return res;
|
||||
const groupArray = (arr) => {
|
||||
const map = new Map();
|
||||
|
||||
// Count occurrences of each object
|
||||
arr.forEach((obj) => {
|
||||
const key = JSON.stringify(obj);
|
||||
map.set(key, (map.get(key) || 0) + 1);
|
||||
});
|
||||
|
||||
// Create a new array to store unique objects with count
|
||||
const result = [];
|
||||
map.forEach((count, key) => {
|
||||
const obj = JSON.parse(key);
|
||||
|
||||
const transformedObj = {
|
||||
pinswg_isharedocumentlocations: obj.pinswg_isharedocumentlocations, // Change 'id' to 'userId'
|
||||
pinswg_isharedocumentlocationsLabel:
|
||||
obj[
|
||||
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
|
||||
], // Change 'name' to 'userName'
|
||||
count: count, // Add 'count' as 'occurrences'
|
||||
};
|
||||
|
||||
result.push(transformedObj);
|
||||
});
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
|
||||
@@ -92,6 +92,37 @@ export default async function ApiProxy(req, res) {
|
||||
var showNumberOfRecords = req.query.showNumberOfRecords;
|
||||
var documentType = req.query.documentType || "all";
|
||||
|
||||
// (documentType != "all"
|
||||
// ? documentType.indexOf(",")<0?" and pinswg_isharedocumentlocations eq " + documentType :
|
||||
// : "") +
|
||||
|
||||
var docTypeQueryString = "";
|
||||
|
||||
if (documentType != "all") {
|
||||
if (documentType.indexOf(",") >= 0) {
|
||||
const documentTypeArr = documentType.split(",");
|
||||
|
||||
docTypeQueryString = " and (";
|
||||
documentTypeArr.forEach(function (item, index) {
|
||||
console.log(item, index);
|
||||
|
||||
if (item != "all") {
|
||||
docTypeQueryString +=
|
||||
" pinswg_isharedocumentlocations eq " + item;
|
||||
|
||||
docTypeQueryString +=
|
||||
index < documentTypeArr.length - 1 ? " or " : "";
|
||||
}
|
||||
});
|
||||
docTypeQueryString += " )";
|
||||
} else {
|
||||
docTypeQueryString +=
|
||||
" and pinswg_isharedocumentlocations eq " + documentType;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(docTypeQueryString);
|
||||
|
||||
//console.log("has this passed docuemntType:", documentType);
|
||||
//(documentType !="all" && " pinswg_pinswg_isharedocumentlocations eq " + )
|
||||
|
||||
@@ -99,9 +130,7 @@ export default async function ApiProxy(req, res) {
|
||||
"pinswg_documents?$filter=pinswg_publishtoweb eq true and _pinswg_documentids_value eq " +
|
||||
incidentID +
|
||||
" and pinswg_latestpublishedversion ne null and pinswg_latestpublisheddate ne null" +
|
||||
(documentType != "all"
|
||||
? " and pinswg_isharedocumentlocations eq " + documentType
|
||||
: "") +
|
||||
docTypeQueryString +
|
||||
"&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference,pinswg_name,pinswg_latestpublishedversion,pinswg_latestpublisheddate&$orderby=" +
|
||||
orderby +
|
||||
" " +
|
||||
@@ -111,7 +140,7 @@ export default async function ApiProxy(req, res) {
|
||||
? "&$skiptoken=" + ('<cookie pagenumber="' + pageNumber + '" />')
|
||||
: "");
|
||||
|
||||
//console.log("docu paged: ", queryUrl);
|
||||
console.log("docu paged: ", queryUrl);
|
||||
|
||||
return axios
|
||||
.get(
|
||||
|
||||
@@ -97,6 +97,8 @@ const CaseHome = (props) => {
|
||||
}
|
||||
showLoginCheck={true}
|
||||
messagesObj={props.messagesObj}
|
||||
showFilteredDocs={props.showFilteredDocs}
|
||||
showMaps={props.showMaps}
|
||||
/>
|
||||
</div>
|
||||
<Footer
|
||||
@@ -218,6 +220,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
messagesObj: await getCaseMessage(
|
||||
searchResultsObj.value[0].incidentid
|
||||
),
|
||||
showFilteredDocs: process.env.SHOWFILTERDOCS || false,
|
||||
showMaps: process.env.SHOWMAPS,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,7 +3,13 @@ import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import { getBasicDNSURLSearch, getIP } from "../../actions";
|
||||
import {
|
||||
getBasicDNSURLSearch,
|
||||
getCaseMessage,
|
||||
getIP,
|
||||
getPersonalAccount,
|
||||
getPortalLogin,
|
||||
} from "../../actions";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import Case from "../../components/case";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
@@ -13,10 +19,20 @@ import { getSearchDetails } from "../../components/utils";
|
||||
import { setAccountDetails } from "../../store/accountDetails/action";
|
||||
import { setCurrentReference } from "../../store/currentView/action";
|
||||
import { setSearch } from "../../store/search/action";
|
||||
import {
|
||||
setSearchDetails,
|
||||
setSearchResults,
|
||||
} from "../../store/searchOutput/action";
|
||||
import { wrapper } from "../../store/store";
|
||||
|
||||
import ServiceBanner from "../../components/servicebanner";
|
||||
const CaseHome = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
const {
|
||||
footerLinks,
|
||||
pages,
|
||||
setSearchResults,
|
||||
setSearchDetails,
|
||||
searchResultsObj,
|
||||
} = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
@@ -37,7 +53,7 @@ const CaseHome = (props) => {
|
||||
<Header serviceName="Developments of National Significance" />
|
||||
<div className="govuk-width-container">
|
||||
<Breadcrumbs slug={developmentName} props={props} />
|
||||
|
||||
<ServiceBanner />
|
||||
<Case
|
||||
props={props}
|
||||
myCases={props.myCases.myCases}
|
||||
@@ -45,6 +61,9 @@ const CaseHome = (props) => {
|
||||
directSearchResultsObj={
|
||||
props.searchResultsObj.searchResultsObj
|
||||
}
|
||||
searchResultsObj={
|
||||
props.searchResultsObj.searchResultsObj
|
||||
}
|
||||
searchDetailsObj={
|
||||
props.searchResultsObj.searchDetailsObj
|
||||
}
|
||||
@@ -76,6 +95,9 @@ const CaseHome = (props) => {
|
||||
props.searchResultsObj.representationsObj
|
||||
}
|
||||
showLoginCheck={true}
|
||||
messagesObj={props.messagesObj}
|
||||
showFilteredDocs={props.showFilteredDocs}
|
||||
showMaps={props.showMaps}
|
||||
/>
|
||||
</div>
|
||||
<Footer
|
||||
@@ -167,6 +189,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
},
|
||||
};
|
||||
} else {
|
||||
// store.dispatch(setSearchResults(searchResultsObj));
|
||||
// store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
store.dispatch(
|
||||
setCurrentReference({
|
||||
"ticketnumber": searchResultsObj.value[0].ticketnumber,
|
||||
@@ -175,11 +199,27 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
"incidentid": searchResultsObj.value[0].incidentid,
|
||||
"appealType":
|
||||
searchResultsObj.value[0].pinswg_appealcasetype,
|
||||
"showLoginCheck": true,
|
||||
"specialistProcess":
|
||||
searchDetailsObj[0].value[0]
|
||||
.pinswg_speacialistcaseprocess != null ||
|
||||
searchDetailsObj[0].value[0]
|
||||
.pinswg_specialistcaseprocess != null
|
||||
? searchDetailsObj[0].value[0]
|
||||
.pinswg_speacialistcaseprocess ||
|
||||
searchDetailsObj[0].value[0]
|
||||
.pinswg_specialistcaseprocess
|
||||
: "",
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
//console.log(searchResultsObj);
|
||||
let messagesObj = await getCaseMessage(
|
||||
searchResultsObj.value[0].incidentid
|
||||
);
|
||||
|
||||
console.log(messagesObj);
|
||||
|
||||
return {
|
||||
props: {
|
||||
searchResultsObj: {
|
||||
@@ -187,6 +227,10 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
searchDetailsObj: searchDetailsObj,
|
||||
},
|
||||
currentType: "directResultsObj",
|
||||
docsOffline: process.env.DOCAPI_OFFLINE || false,
|
||||
messagesObj: messagesObj,
|
||||
showFilteredDocs: process.env.SHOWFILTERDOCS || false,
|
||||
showMaps: process.env.SHOWMAPS,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -197,7 +241,7 @@ const mapStateToProps = (state) => {
|
||||
accountDetails: state.accountDetails,
|
||||
currentView: state.currentView,
|
||||
search: state.search,
|
||||
//searchResultsObj: state.searchResultsObj,
|
||||
// searchResultsObj: state.searchResultsObj,
|
||||
documentDetailsObj: state.searchResultsObj.documentDetailsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
@@ -214,6 +258,12 @@ const mapDispatchToProps = (dispatch) => {
|
||||
setCurrentReference: (currentReference) => {
|
||||
dispatch(setCurrentReference(refno));
|
||||
},
|
||||
setSearchResults: (searchResultsObj) => {
|
||||
dispatch(setSearchResults(searchResultsObj));
|
||||
},
|
||||
setSearchDetails: (searchDetailsObj) => {
|
||||
dispatch(setSearchDetails(searchDetailsObj));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,270 @@
|
||||
import { getSession } from "next-auth/react";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import {
|
||||
getBasicDNSURLSearch,
|
||||
getCaseMessage,
|
||||
getIP,
|
||||
getPersonalAccount,
|
||||
getPortalLogin,
|
||||
} from "../../../actions";
|
||||
import Breadcrumbs from "../../../components/breadcrumbs";
|
||||
import Case from "../../../components/case";
|
||||
import CookieBanner from "../../../components/cookieBanner";
|
||||
import Footer from "../../../components/footer";
|
||||
import Header from "../../../components/header";
|
||||
import { getSearchDetails } from "../../../components/utils";
|
||||
import { setAccountDetails } from "../../../store/accountDetails/action";
|
||||
import { setCurrentReference } from "../../../store/currentView/action";
|
||||
import { setSearch } from "../../../store/search/action";
|
||||
import {
|
||||
setSearchDetails,
|
||||
setSearchResults,
|
||||
} from "../../../store/searchOutput/action";
|
||||
import { wrapper } from "../../../store/store";
|
||||
import ServiceBanner from "../../../components/servicebanner";
|
||||
const CaseHome = (props) => {
|
||||
const {
|
||||
footerLinks,
|
||||
pages,
|
||||
setSearchResults,
|
||||
setSearchDetails,
|
||||
searchResultsObj,
|
||||
} = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
const { developmentName } = router.query;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Head>
|
||||
<title>
|
||||
Reference:{" "}
|
||||
{props.currentView.caseReference.currentReference}{" "}
|
||||
Developments of National Significance
|
||||
</title>
|
||||
</Head>
|
||||
<div id="page_wrapper">
|
||||
<CookieBanner />
|
||||
<Header serviceName="Developments of National Significance" />
|
||||
<div className="govuk-width-container">
|
||||
<Breadcrumbs slug={developmentName} props={props} />
|
||||
<ServiceBanner />
|
||||
<Case
|
||||
props={props}
|
||||
myCases={props.myCases.myCases}
|
||||
myCasesDetails={props.myCases.myCasesDetails}
|
||||
directSearchResultsObj={
|
||||
props.searchResultsObj.searchResultsObj
|
||||
}
|
||||
searchResultsObj={
|
||||
props.searchResultsObj.searchResultsObj
|
||||
}
|
||||
searchDetailsObj={
|
||||
props.searchResultsObj.searchDetailsObj
|
||||
}
|
||||
documentDetailsObj={props.documentDetailsObj}
|
||||
myRepresentations={
|
||||
props.myRepresentations.myRepresentations
|
||||
}
|
||||
watchedCases={props.watchedCases.watchedCases}
|
||||
watchedCasesDetails={
|
||||
props.watchedCases.watchedCasesDetails
|
||||
}
|
||||
awaitingSubmission={
|
||||
props.awaitingSubmission.awaitingSubmission
|
||||
}
|
||||
caseReference={
|
||||
props.searchResultsObj.searchResultsObj.value[0]
|
||||
.ticketnumber
|
||||
}
|
||||
currentType={props.currentType}
|
||||
appealTypeID={
|
||||
props.searchResultsObj.searchResultsObj.value[0]
|
||||
.pinswg_appealcasetype
|
||||
}
|
||||
incidentid={
|
||||
props.searchResultsObj.searchResultsObj.value[0]
|
||||
.incidentid
|
||||
}
|
||||
representationsObj={
|
||||
props.searchResultsObj.representationsObj
|
||||
}
|
||||
showLoginCheck={true}
|
||||
messagesObj={props.messagesObj}
|
||||
showFilteredDocs={props.showFilteredDocs}
|
||||
showMaps={props.showMaps}
|
||||
/>
|
||||
</div>
|
||||
<Footer
|
||||
footerLinks={footerLinks}
|
||||
props={props}
|
||||
ticketnumber={
|
||||
props.searchResultsObj.searchResultsObj.value[0]
|
||||
.ticketnumber
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) => async (ctx) => {
|
||||
const { query, req, res } = ctx;
|
||||
getIP(req);
|
||||
const { cookies } = req;
|
||||
|
||||
console.log(cookies);
|
||||
console.log("the query", query.developmentName);
|
||||
|
||||
let thisSession = await getSession(ctx);
|
||||
let loggedInUser = {};
|
||||
|
||||
if (thisSession) {
|
||||
console.log(" has sesssion.......");
|
||||
[loggedInUser] = await Promise.all([
|
||||
await getPortalLogin(thisSession.user.email),
|
||||
]);
|
||||
|
||||
loggedInUser = loggedInUser.value[0].contactid;
|
||||
|
||||
const accountDetails = await getPersonalAccount(loggedInUser);
|
||||
store.dispatch(setAccountDetails(accountDetails));
|
||||
} else {
|
||||
console.log("not has sesssion.......");
|
||||
}
|
||||
|
||||
let developmentQuery =
|
||||
query.developmentName.indexOf("CAS-") == 0
|
||||
? query.developmentName
|
||||
: query.developmentName.split("-").join(" ");
|
||||
console.log(developmentQuery);
|
||||
|
||||
const searchResultsObj = await getBasicDNSURLSearch(developmentQuery);
|
||||
const searchDetailsObj = await getSearchDetails(searchResultsObj);
|
||||
|
||||
console.log(
|
||||
"\n======================================\n",
|
||||
searchResultsObj,
|
||||
"\n======================================\n"
|
||||
);
|
||||
console.log(
|
||||
"\n======================================\n",
|
||||
searchDetailsObj[0],
|
||||
"\n======================================\n"
|
||||
);
|
||||
|
||||
store.dispatch(setSearch(developmentQuery));
|
||||
|
||||
//console.log({
|
||||
// "currentReference": searchResultsObj.value[0].title,
|
||||
// "currentType": "searchResultsObj",
|
||||
// "incidentid": searchResultsObj.value[0].incidentid,
|
||||
// "appealType": searchResultsObj.value[0].pinswg_appealcasetype,
|
||||
// });
|
||||
console.log(
|
||||
searchResultsObj["@odata.count"] > 1 ||
|
||||
searchResultsObj["@odata.count"] < 1
|
||||
);
|
||||
|
||||
if (searchResultsObj["@odata.count"] < 1) {
|
||||
return {
|
||||
redirect: {
|
||||
destination: "/404",
|
||||
permanent: false,
|
||||
},
|
||||
};
|
||||
} else {
|
||||
if (searchResultsObj["@odata.count"] > 1) {
|
||||
return {
|
||||
redirect: {
|
||||
//destination: "/dns-not-found",
|
||||
destination: "/404",
|
||||
permanent: false,
|
||||
},
|
||||
};
|
||||
} else {
|
||||
// store.dispatch(setSearchResults(searchResultsObj));
|
||||
// store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
store.dispatch(
|
||||
setCurrentReference({
|
||||
"ticketnumber": searchResultsObj.value[0].ticketnumber,
|
||||
"currentReference": searchResultsObj.value[0].title,
|
||||
"currentType": "searchResultsObj",
|
||||
"incidentid": searchResultsObj.value[0].incidentid,
|
||||
"appealType":
|
||||
searchResultsObj.value[0].pinswg_appealcasetype,
|
||||
"showLoginCheck": true,
|
||||
"specialistProcess":
|
||||
searchDetailsObj[0].value[0]
|
||||
.pinswg_speacialistcaseprocess != null ||
|
||||
searchDetailsObj[0].value[0]
|
||||
.pinswg_specialistcaseprocess != null
|
||||
? searchDetailsObj[0].value[0]
|
||||
.pinswg_speacialistcaseprocess ||
|
||||
searchDetailsObj[0].value[0]
|
||||
.pinswg_specialistcaseprocess
|
||||
: "",
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
let messagesObj = await getCaseMessage(
|
||||
searchResultsObj.value[0].incidentid
|
||||
);
|
||||
|
||||
console.log(messagesObj);
|
||||
|
||||
return {
|
||||
props: {
|
||||
searchResultsObj: {
|
||||
searchResultsObj: searchResultsObj,
|
||||
searchDetailsObj: searchDetailsObj,
|
||||
},
|
||||
currentType: "directResultsObj",
|
||||
docsOffline: process.env.DOCAPI_OFFLINE || false,
|
||||
messagesObj: messagesObj,
|
||||
showFilteredDocs: process.env.SHOWFILTERDOCS || false,
|
||||
showMaps: process.env.SHOWMAPS,
|
||||
},
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
accountDetails: state.accountDetails,
|
||||
currentView: state.currentView,
|
||||
search: state.search,
|
||||
// searchResultsObj: state.searchResultsObj,
|
||||
documentDetailsObj: state.searchResultsObj.documentDetailsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
form: state.form,
|
||||
myCases: state.myCases,
|
||||
watchedCases: state.watchedCases,
|
||||
myRepresentations: state.myRepresentations,
|
||||
awaitingSubmission: state.awaitingSubmission,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
setCurrentReference: (currentReference) => {
|
||||
dispatch(setCurrentReference(refno));
|
||||
},
|
||||
setSearchResults: (searchResultsObj) => {
|
||||
dispatch(setSearchResults(searchResultsObj));
|
||||
},
|
||||
setSearchDetails: (searchDetailsObj) => {
|
||||
dispatch(setSearchDetails(searchDetailsObj));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(CaseHome);
|
||||
+37
-37
@@ -399,46 +399,46 @@ const getDetails = (resultsObj, detailsType) => {
|
||||
});
|
||||
}
|
||||
|
||||
const detailsObj = resultsObj.map((searchDetail, index) => {
|
||||
let caseID = "";
|
||||
// const detailsObj = resultsObj.map(async (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;
|
||||
}
|
||||
// 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);
|
||||
// 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"
|
||||
// ]
|
||||
)
|
||||
);
|
||||
});
|
||||
// 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);
|
||||
|
||||
Reference in New Issue
Block a user