14115 SIPs events on summary page

This commit is contained in:
2025-02-19 15:00:25 +00:00
parent e1444887cb
commit ae5c0b4e39
10 changed files with 310 additions and 1 deletions
+12
View File
@@ -301,6 +301,18 @@ export const getBasicDNSURLSearch = (searchString) => {
}); });
}; };
export const getSIPSEvents = (caseid) => {
return axios
.get(BASE_URL + "/api/endpoint/getsipsevents_api?caseid=" + caseid)
.then((res) => {
return res.data;
})
.catch((error) => {
consoleLogger(error);
return error.response;
});
};
export const getAddressSearchPaged = ( export const getAddressSearchPaged = (
searchString, searchString,
pageNumber, pageNumber,
+1
View File
@@ -40,6 +40,7 @@ const Case = (props) => {
docsOffline={props.props.docsOffline} docsOffline={props.props.docsOffline}
documentDetailsObj={props.documentDetailsObj} documentDetailsObj={props.documentDetailsObj}
showFilteredDocs={props.showFilteredDocs} showFilteredDocs={props.showFilteredDocs}
eventsObj={props.eventsObj}
/> />
{showRepresentations == true && ( {showRepresentations == true && (
<RepresentationList <RepresentationList
+185
View File
@@ -0,0 +1,185 @@
import { setEventDetails } from "../../store/searchOutput/action";
import { setCurrentPage } from "../../store/currentView/action";
import { connect } from "react-redux";
import useTranslation from "next-translate/useTranslation";
import { formatDates } from "../utils";
const EventsDetails = (props) => {
let { t } = useTranslation();
const EventView = (eventsArr) => {
eventsArr = eventsArr.value;
return eventsArr.map((item, key) => {
<div>{item.pinswg_name}</div>;
});
};
const eventsArr = props.eventsObj?.value || [];
// event publishiing flag set to true displa
function hasOwnPropertyAndNotNull(obj, property) {
return obj.hasOwnProperty(property) && obj[property] !== null;
}
console.log(eventsArr.length > 0);
return (
eventsArr.length > 0 && (
<div className="govuk-grid-row">
<div className="card">
<div className="card-body">
<h2 className="govuk-heading-m ">Events</h2>
{eventsArr.map(
(item, key) =>
item.pinswg_eventpublishingflag ==
846040001 && (
<>
{" "}
<div className="eventContainer">
<div className="eventColumn">
<div>
<b>Name</b>:{" "}
{item.pinswg_name}
</div>
{hasOwnPropertyAndNotNull(
item,
"pinswg_eventname"
) && (
<div>
<b>Event name</b>:{" "}
{item.pinswg_eventname}
</div>
)}
</div>
<div className="eventColumn">
{hasOwnPropertyAndNotNull(
item,
"pinswg_eventaddressline1"
) && (
<div>
{
item.pinswg_eventaddressline1
}
</div>
)}
{hasOwnPropertyAndNotNull(
item,
"pinswg_eventaddressline2"
) && (
<div>
{
item.pinswg_eventaddressline2
}
</div>
)}
{hasOwnPropertyAndNotNull(
item,
"pinswg_eventaddresstown"
) && (
<div>
{
item.pinswg_eventaddresstown
}
</div>
)}
{hasOwnPropertyAndNotNull(
item,
"pinswg_eventaddresscounty"
) && (
<div>
{
item.pinswg_eventaddresscounty
}
</div>
)}
{hasOwnPropertyAndNotNull(
item,
"pinswg_eventaddresscounty"
) && (
<div>
{
item.pinswg_eventaddresspostcode
}
</div>
)}
</div>
{/* type of event
start date date of event - end date of event
if virtual event no address showNoOfRecords
show event address */}
<div className="eventColumn">
{hasOwnPropertyAndNotNull(
item,
"pinswg_dateeventrequested"
) && (
<div>
<b>Start Date</b>:{" "}
{formatDates(
item.pinswg_dateeventrequested
)}
</div>
)}
{hasOwnPropertyAndNotNull(
item,
"pinswg_enddateoftheevent"
) && (
<div>
<b>End Date</b>:{" "}
{item.pinswg_enddateoftheevent !=
null &&
formatDates(
item.pinswg_enddateoftheevent
)}
</div>
)}
</div>
<div className="eventColumn">
{hasOwnPropertyAndNotNull(
item,
[
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue",
]
) && (
<div>
<b>Type of event</b>:{" "}
{
item[
"pinswg_typeofevent@OData.Community.Display.V1.FormattedValue"
]
}
</div>
)}
</div>
</div>
</>
)
)}{" "}
</div>
</div>
</div>
)
);
};
const mapStateToProps = (state) => {
return {
...state,
};
};
const mapDispatchToProps = (dispatch) => {
return {
setEventDetails: (eventsObj) => {
dispatch(setEventDetails(eventsObj));
},
setCurrentPage: (currentPage) => {
dispatch(setCurrentPage(currentPage));
},
};
};
export default connect(mapStateToProps, mapDispatchToProps)(EventsDetails);
+3
View File
@@ -7,6 +7,7 @@ import { useEffect, useState } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import transLookup from "../../data/lookuptranslations.json"; import transLookup from "../../data/lookuptranslations.json";
import Documents from "./documents"; import Documents from "./documents";
import EventsDetails from "./events";
import { import {
createWatchedCases, createWatchedCases,
@@ -768,6 +769,8 @@ const CaseSummary = (props) => {
)} )}
{showSummary(casesObj, detailsObj)} {showSummary(casesObj, detailsObj)}
<EventsDetails eventsObj={props.eventsObj} />
<Documents <Documents
incidentid={props.incidentid} incidentid={props.incidentid}
caseReference={props.caseReference} caseReference={props.caseReference}
+44
View File
@@ -0,0 +1,44 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { azureHeaders, consoleLogger, getToken } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
process.env.RELAY_ROOT ||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
const hashAPIPath = (queryPath) => {
var hashlink = CryptoJS.HmacSHA256(
queryPath,
CryptoJS.enc.Hex.parse(WORDKEY)
);
hashlink = hashlink.toString(CryptoJS.enc.Hex);
//return "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var caseid = req.query.caseid;
var token = await getToken();
var queryUrl =
"pinswg_sipsevents?$filter=_pinswg_sipseventsid_value eq " +
caseid +
"&$count=true";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch((error) => {
consoleLogger(error);
res.status(400).json(error);
});
}
+14 -1
View File
@@ -9,6 +9,7 @@ import {
getIP, getIP,
getPersonalAccount, getPersonalAccount,
getPortalLogin, getPortalLogin,
getSIPSEvents,
} from "../../actions"; } from "../../actions";
import Breadcrumbs from "../../components/breadcrumbs"; import Breadcrumbs from "../../components/breadcrumbs";
import Case from "../../components/case"; import Case from "../../components/case";
@@ -20,6 +21,7 @@ import { setAccountDetails } from "../../store/accountDetails/action";
import { setCurrentReference } from "../../store/currentView/action"; import { setCurrentReference } from "../../store/currentView/action";
import { setSearch } from "../../store/search/action"; import { setSearch } from "../../store/search/action";
import { import {
setEventDetails,
setSearchDetails, setSearchDetails,
setSearchResults, setSearchResults,
} from "../../store/searchOutput/action"; } from "../../store/searchOutput/action";
@@ -99,6 +101,7 @@ const CaseHome = (props) => {
messagesObj={props.messagesObj} messagesObj={props.messagesObj}
showFilteredDocs={props.showFilteredDocs} showFilteredDocs={props.showFilteredDocs}
showMaps={props.showMaps} showMaps={props.showMaps}
eventsObj={props.searchResultsObj.eventsObj}
/> />
</div> </div>
<Footer <Footer
@@ -148,6 +151,15 @@ export const getServerSideProps = wrapper.getServerSideProps(
const searchResultsObj = await getBasicSearch(developmentQuery); const searchResultsObj = await getBasicSearch(developmentQuery);
const searchDetailsObj = await getSearchDetails(searchResultsObj); const searchDetailsObj = await getSearchDetails(searchResultsObj);
var eventsObj = {};
if (searchResultsObj.value[0].pinswg_appealcasetype == 846040002) {
eventsObj = await getSIPSEvents(
searchDetailsObj[0].value[0].pinswg_sipsid
);
store.dispatch(setEventDetails(eventsObj));
}
//console.log( //console.log(
// "\n======================================\n", // "\n======================================\n",
// searchResultsObj, // searchResultsObj,
@@ -214,6 +226,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
searchResultsObj: { searchResultsObj: {
searchResultsObj: searchResultsObj, searchResultsObj: searchResultsObj,
searchDetailsObj: searchDetailsObj, searchDetailsObj: searchDetailsObj,
eventsObj: eventsObj,
}, },
currentType: "directResultsObj", currentType: "directResultsObj",
docsOffline: process.env.DOCAPI_OFFLINE || false, docsOffline: process.env.DOCAPI_OFFLINE || false,
@@ -232,7 +245,7 @@ const mapStateToProps = (state) => {
accountDetails: state.accountDetails, accountDetails: state.accountDetails,
currentView: state.currentView, currentView: state.currentView,
search: state.search, search: state.search,
searchResultsObj: state.searchResultsObj, //searchResultsObj: state.searchResultsObj,
documentDetailsObj: state.searchResultsObj.documentDetailsObj, documentDetailsObj: state.searchResultsObj.documentDetailsObj,
formData: state.formData, formData: state.formData,
appealType: state.appealType, appealType: state.appealType,
+13
View File
@@ -9,6 +9,7 @@ import {
getIP, getIP,
getPersonalAccount, getPersonalAccount,
getPortalLogin, getPortalLogin,
getSIPSEvents,
} from "../../actions"; } from "../../actions";
import Breadcrumbs from "../../components/breadcrumbs"; import Breadcrumbs from "../../components/breadcrumbs";
import Case from "../../components/case"; import Case from "../../components/case";
@@ -20,6 +21,7 @@ import { setAccountDetails } from "../../store/accountDetails/action";
import { setCurrentReference } from "../../store/currentView/action"; import { setCurrentReference } from "../../store/currentView/action";
import { setSearch } from "../../store/search/action"; import { setSearch } from "../../store/search/action";
import { import {
setEventDetails,
setSearchDetails, setSearchDetails,
setSearchResults, setSearchResults,
} from "../../store/searchOutput/action"; } from "../../store/searchOutput/action";
@@ -98,6 +100,7 @@ const CaseHome = (props) => {
messagesObj={props.messagesObj} messagesObj={props.messagesObj}
showFilteredDocs={props.showFilteredDocs} showFilteredDocs={props.showFilteredDocs}
showMaps={props.showMaps} showMaps={props.showMaps}
eventsObj={props.searchResultsObj.eventsObj}
/> />
</div> </div>
<Footer <Footer
@@ -148,6 +151,15 @@ export const getServerSideProps = wrapper.getServerSideProps(
const searchResultsObj = await getBasicDNSURLSearch(developmentQuery); const searchResultsObj = await getBasicDNSURLSearch(developmentQuery);
const searchDetailsObj = await getSearchDetails(searchResultsObj); const searchDetailsObj = await getSearchDetails(searchResultsObj);
var eventsObj = {};
if (searchResultsObj.value[0].pinswg_appealcasetype == 846040002)
eventsObj = await getSIPSEvents(
searchDetailsObj[0].value[0].pinswg_sipsid
);
store.dispatch(setEventDetails(eventsObj));
// console.log("eventsObj:", eventsObj);
// console.log( // console.log(
// "\n======================================\n", // "\n======================================\n",
// searchResultsObj, // searchResultsObj,
@@ -225,6 +237,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
searchResultsObj: { searchResultsObj: {
searchResultsObj: searchResultsObj, searchResultsObj: searchResultsObj,
searchDetailsObj: searchDetailsObj, searchDetailsObj: searchDetailsObj,
eventsObj: eventsObj,
}, },
currentType: "directResultsObj", currentType: "directResultsObj",
docsOffline: process.env.DOCAPI_OFFLINE || false, docsOffline: process.env.DOCAPI_OFFLINE || false,
+8
View File
@@ -7,6 +7,7 @@ export const searchResultsActionTypes = {
SETDOCUMENTHISTORY: "SETDOCUMENTHISTORY", SETDOCUMENTHISTORY: "SETDOCUMENTHISTORY",
SETREPRESENTATIONS: "SETREPRESENTATIONS", SETREPRESENTATIONS: "SETREPRESENTATIONS",
SETDNSCOORDS: "SETDNSCOORDS", SETDNSCOORDS: "SETDNSCOORDS",
SETEVENTDETAILS: "SETEVENTDETAILS",
}; };
export const getSearchResultshObj = () => (dispatch) => { export const getSearchResultshObj = () => (dispatch) => {
@@ -55,3 +56,10 @@ export const setDNSCoords = (dnsCoords) => (dispatch) => {
dnsCoordsObj: dnsCoords, dnsCoordsObj: dnsCoords,
}); });
}; };
export const setEventDetails = (eventsDetails) => (dispatch) => {
return dispatch({
type: searchResultsActionTypes.SETEVENTDETAILS,
eventDetailsObj: eventsDetails,
});
};
+6
View File
@@ -6,6 +6,7 @@ const searchResultsInitialState = {
documentDetailsObj: {}, documentDetailsObj: {},
representationsObj: {}, representationsObj: {},
dnsCoordsObj: {}, dnsCoordsObj: {},
eventDetailsObj: {},
}; };
export default function reducer(state = searchResultsInitialState, action) { export default function reducer(state = searchResultsInitialState, action) {
@@ -36,6 +37,11 @@ export default function reducer(state = searchResultsInitialState, action) {
...state, ...state,
dnsCoordsObj: action.dnsCoordsObj, dnsCoordsObj: action.dnsCoordsObj,
}; };
case searchResultsActionTypes.SETEVENTDETAILS:
return {
...state,
eventDetailsObj: action.eventDetailsObj,
};
default: default:
return state; return state;
} }
+24
View File
@@ -2933,3 +2933,27 @@ ul.subFieldList {
.ql-snow .ql-tooltip { .ql-snow .ql-tooltip {
z-index: 1000; z-index: 1000;
} }
.eventContainer {
display: flex;
margin-bottom: 20px;
border-bottom: 1px solid $lightgrey_semi;
padding-bottom: 10px;
@media screen and (max-width: 768px) {
display: block;
padding-bottom: 10px;
}
.eventColumn {
line-height: 1.5;
width: 25%;
@media screen and (max-width: 768px) {
width: 100%;
}
}
}