added in documents for case and onlu published
This commit is contained in:
@@ -20,11 +20,15 @@ import { setSearch, getSearchObj } from "../store/search/action";
|
||||
import {
|
||||
setSearchResults,
|
||||
setSearchDetails,
|
||||
setDocumentDetails,
|
||||
setDocumentHistory,
|
||||
getSearchResultsObj,
|
||||
} from "../store/searchOutput/action";
|
||||
import {
|
||||
getAdvancedSearch,
|
||||
getBasicSearchDetails,
|
||||
getSearchDocumentDetails,
|
||||
getSearchDocumentHistory,
|
||||
getSASToken,
|
||||
} from "../actions";
|
||||
|
||||
@@ -74,10 +78,21 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
token,
|
||||
searchResultsObj
|
||||
);
|
||||
// console.log(searchDetailsObj);
|
||||
const searchDocumentResultsObj = await getDocumentDetails(
|
||||
token,
|
||||
searchResultsObj
|
||||
);
|
||||
|
||||
const searchDocumentHistoryObj = await getDocumentHistory(
|
||||
token,
|
||||
searchDocumentResultsObj
|
||||
);
|
||||
//console.log(searchDocumentHistoryObj);
|
||||
|
||||
store.dispatch(setSearchResults(searchResultsObj));
|
||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
//store.dispatch(setSearch(query.q));
|
||||
store.dispatch(setDocumentDetails(searchDocumentResultsObj));
|
||||
store.dispatch(setDocumentHistory(searchDocumentHistoryObj));
|
||||
}
|
||||
);
|
||||
|
||||
@@ -121,6 +136,51 @@ const getSearchDetails = (token, searchResultsObj) => {
|
||||
return Promise.all(detailsArr);
|
||||
};
|
||||
|
||||
const getDocumentDetails = (token, searchResultsObj) => {
|
||||
//console.log(searchResultsObj);
|
||||
|
||||
let detailsArr = [];
|
||||
//console.log("search results", searchResultsObj);
|
||||
searchResultsObj = searchResultsObj.value;
|
||||
const detailsObj = searchResultsObj.map((searchDetail, index) => {
|
||||
if (searchDetail.pinswg_appealcasetype == null) {
|
||||
console.log(searchDetail.incidentid);
|
||||
} else {
|
||||
detailsArr.push(
|
||||
getSearchDocumentDetails(token, searchDetail.incidentid)
|
||||
);
|
||||
}
|
||||
});
|
||||
//console.log(detailsArr);
|
||||
return Promise.all(detailsArr);
|
||||
};
|
||||
|
||||
const getDocumentHistory = (token, searchDocumentDetailsObj) => {
|
||||
//console.log(searchResultsObj);
|
||||
|
||||
let historyArr = [];
|
||||
//console.log("search results", searchDocumentDetailsObj);
|
||||
searchDocumentDetailsObj = searchDocumentDetailsObj[0].value;
|
||||
|
||||
//console.log(searchDocumentDetailsObj);
|
||||
const detailsObj = searchDocumentDetailsObj.map((historyDetail, index) => {
|
||||
//console.log(historyDetail);
|
||||
if (historyDetail.pinswg_publishtoweb != true) {
|
||||
console.log(historyDetail.pinswg_documentid);
|
||||
} else {
|
||||
// console.log(
|
||||
// "history detail documentid:",
|
||||
// historyDetail.pinswg_documentid
|
||||
// );
|
||||
historyArr.push(
|
||||
getSearchDocumentHistory(token, historyDetail.pinswg_documentid)
|
||||
);
|
||||
}
|
||||
});
|
||||
console.log(historyArr);
|
||||
return Promise.all(historyArr);
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
currentView: state.currentView,
|
||||
|
||||
@@ -48,6 +48,12 @@ const Home = (props) => {
|
||||
searchDetailsObj={
|
||||
props.searchResultsObj.searchDetailsObj
|
||||
}
|
||||
documentDetailsObj={
|
||||
props.searchResultsObj.documentDetailsObj
|
||||
}
|
||||
documentHistoryObj={
|
||||
props.searchResultsObj.documentHistoryObj
|
||||
}
|
||||
myRepresentations={
|
||||
props.myRepresentations.myRepresentations
|
||||
}
|
||||
@@ -61,6 +67,7 @@ const Home = (props) => {
|
||||
currentType={
|
||||
props.currentView.caseReference.currentType
|
||||
}
|
||||
incidentid={props.currentView.caseReference.incidentid}
|
||||
/>
|
||||
</div>
|
||||
<Footer footerLinks={footerLinks} />
|
||||
|
||||
+69
-3
@@ -20,9 +20,17 @@ import { setSearch, getSearchObj } from "../store/search/action";
|
||||
import {
|
||||
setSearchResults,
|
||||
setSearchDetails,
|
||||
setDocumentDetails,
|
||||
setDocumentHistory,
|
||||
getSearchResultsObj,
|
||||
} from "../store/searchOutput/action";
|
||||
import { getBasicSearch, getBasicSearchDetails, getSASToken } from "../actions";
|
||||
import {
|
||||
getBasicSearch,
|
||||
getBasicSearchDetails,
|
||||
getSearchDocumentDetails,
|
||||
getSearchDocumentHistory,
|
||||
getSASToken,
|
||||
} from "../actions";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
@@ -71,9 +79,22 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
token,
|
||||
searchResultsObj
|
||||
);
|
||||
//console.log(searchDetailsObj);
|
||||
|
||||
const searchDocumentResultsObj = await getDocumentDetails(
|
||||
token,
|
||||
searchResultsObj
|
||||
);
|
||||
|
||||
const searchDocumentHistoryObj = await getDocumentHistory(
|
||||
token,
|
||||
searchDocumentResultsObj
|
||||
);
|
||||
console.log(searchDocumentHistoryObj);
|
||||
|
||||
store.dispatch(setSearchResults(searchResultsObj));
|
||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
store.dispatch(setDocumentDetails(searchDocumentResultsObj));
|
||||
store.dispatch(setDocumentHistory(searchDocumentHistoryObj));
|
||||
store.dispatch(setSearch(query.q));
|
||||
}
|
||||
);
|
||||
@@ -91,7 +112,7 @@ const getSearchDetails = (token, searchResultsObj) => {
|
||||
//console.log(searchResultsObj);
|
||||
|
||||
let detailsArr = [];
|
||||
console.log("search results", searchResultsObj);
|
||||
//console.log("search results", searchResultsObj);
|
||||
searchResultsObj = searchResultsObj.value;
|
||||
const detailsObj = searchResultsObj.map((searchDetail, index) => {
|
||||
if (searchDetail.pinswg_appealcasetype == null) {
|
||||
@@ -118,6 +139,51 @@ const getSearchDetails = (token, searchResultsObj) => {
|
||||
return Promise.all(detailsArr);
|
||||
};
|
||||
|
||||
const getDocumentDetails = (token, searchResultsObj) => {
|
||||
//console.log(searchResultsObj);
|
||||
|
||||
let detailsArr = [];
|
||||
//console.log("search results", searchResultsObj);
|
||||
searchResultsObj = searchResultsObj.value;
|
||||
const detailsObj = searchResultsObj.map((searchDetail, index) => {
|
||||
if (searchDetail.pinswg_appealcasetype == null) {
|
||||
console.log(searchDetail.incidentid);
|
||||
} else {
|
||||
detailsArr.push(
|
||||
getSearchDocumentDetails(token, searchDetail.incidentid)
|
||||
);
|
||||
}
|
||||
});
|
||||
//console.log(detailsArr);
|
||||
return Promise.all(detailsArr);
|
||||
};
|
||||
|
||||
const getDocumentHistory = (token, searchDocumentDetailsObj) => {
|
||||
//console.log(searchResultsObj);
|
||||
|
||||
let historyArr = [];
|
||||
//console.log("search results", searchDocumentDetailsObj);
|
||||
searchDocumentDetailsObj = searchDocumentDetailsObj[0].value;
|
||||
|
||||
//console.log(searchDocumentDetailsObj);
|
||||
const detailsObj = searchDocumentDetailsObj.map((historyDetail, index) => {
|
||||
//console.log(historyDetail);
|
||||
if (historyDetail.pinswg_publishtoweb != true) {
|
||||
console.log(historyDetail.pinswg_documentid);
|
||||
} else {
|
||||
// console.log(
|
||||
// "history detail documentid:",
|
||||
// historyDetail.pinswg_documentid
|
||||
// );
|
||||
historyArr.push(
|
||||
getSearchDocumentHistory(token, historyDetail.pinswg_documentid)
|
||||
);
|
||||
}
|
||||
});
|
||||
console.log(historyArr);
|
||||
return Promise.all(historyArr);
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
currentView: state.currentView,
|
||||
|
||||
Reference in New Issue
Block a user