diff --git a/actions/index.js b/actions/index.js index 335b7064..ab392034 100644 --- a/actions/index.js +++ b/actions/index.js @@ -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 = ( searchString, pageNumber, diff --git a/components/case.js b/components/case.js index 19631bbe..ae88b888 100644 --- a/components/case.js +++ b/components/case.js @@ -40,6 +40,7 @@ const Case = (props) => { docsOffline={props.props.docsOffline} documentDetailsObj={props.documentDetailsObj} showFilteredDocs={props.showFilteredDocs} + eventsObj={props.eventsObj} /> {showRepresentations == true && ( { + let { t } = useTranslation(); + + const EventView = (eventsArr) => { + eventsArr = eventsArr.value; + + return eventsArr.map((item, key) => { +
{item.pinswg_name}
; + }); + }; + + 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 && ( +
+
+
+

Events

+ {eventsArr.map( + (item, key) => + item.pinswg_eventpublishingflag == + 846040001 && ( + <> + {" "} +
+
+
+ Name:{" "} + {item.pinswg_name} +
+ {hasOwnPropertyAndNotNull( + item, + "pinswg_eventname" + ) && ( +
+ Event name:{" "} + {item.pinswg_eventname} +
+ )} +
+
+ {hasOwnPropertyAndNotNull( + item, + "pinswg_eventaddressline1" + ) && ( +
+ { + item.pinswg_eventaddressline1 + } +
+ )} + + {hasOwnPropertyAndNotNull( + item, + "pinswg_eventaddressline2" + ) && ( +
+ { + item.pinswg_eventaddressline2 + } +
+ )} + {hasOwnPropertyAndNotNull( + item, + "pinswg_eventaddresstown" + ) && ( +
+ { + item.pinswg_eventaddresstown + } +
+ )} + {hasOwnPropertyAndNotNull( + item, + "pinswg_eventaddresscounty" + ) && ( +
+ { + item.pinswg_eventaddresscounty + } +
+ )} + {hasOwnPropertyAndNotNull( + item, + "pinswg_eventaddresscounty" + ) && ( +
+ { + item.pinswg_eventaddresspostcode + } +
+ )} +
+ {/* type of event + start date date of event - end date of event + + if virtual event no address showNoOfRecords + show event address */} +
+ {hasOwnPropertyAndNotNull( + item, + "pinswg_dateeventrequested" + ) && ( +
+ Start Date:{" "} + {formatDates( + item.pinswg_dateeventrequested + )} +
+ )} + {hasOwnPropertyAndNotNull( + item, + "pinswg_enddateoftheevent" + ) && ( +
+ End Date:{" "} + {item.pinswg_enddateoftheevent != + null && + formatDates( + item.pinswg_enddateoftheevent + )} +
+ )} +
+
+ {hasOwnPropertyAndNotNull( + item, + [ + "pinswg_typeofevent@OData.Community.Display.V1.FormattedValue", + ] + ) && ( +
+ Type of event:{" "} + { + item[ + "pinswg_typeofevent@OData.Community.Display.V1.FormattedValue" + ] + } +
+ )} +
+
+ + ) + )}{" "} +
+
+
+ ) + ); +}; + +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); diff --git a/components/case/representation/index.js b/components/case/representation/index.js index c694ea84..801b4c9a 100644 --- a/components/case/representation/index.js +++ b/components/case/representation/index.js @@ -1192,7 +1192,6 @@ let MakeRepresentation = (props) => {
- www {whichControl()}
diff --git a/components/case/summary.js b/components/case/summary.js index 11d7f136..8be497c0 100644 --- a/components/case/summary.js +++ b/components/case/summary.js @@ -7,6 +7,7 @@ import { useEffect, useState } from "react"; import { connect } from "react-redux"; import transLookup from "../../data/lookuptranslations.json"; import Documents from "./documents"; +import EventsDetails from "./events"; import { createWatchedCases, @@ -768,6 +769,8 @@ const CaseSummary = (props) => { )} {showSummary(casesObj, detailsObj)} + + { + 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); + }); +} diff --git a/pages/case/[ticketnumber].js b/pages/case/[ticketnumber].js index d344cb76..4ae0dc9d 100644 --- a/pages/case/[ticketnumber].js +++ b/pages/case/[ticketnumber].js @@ -9,6 +9,7 @@ import { getIP, getPersonalAccount, getPortalLogin, + getSIPSEvents, } from "../../actions"; import Breadcrumbs from "../../components/breadcrumbs"; import Case from "../../components/case"; @@ -20,6 +21,7 @@ import { setAccountDetails } from "../../store/accountDetails/action"; import { setCurrentReference } from "../../store/currentView/action"; import { setSearch } from "../../store/search/action"; import { + setEventDetails, setSearchDetails, setSearchResults, } from "../../store/searchOutput/action"; @@ -99,6 +101,7 @@ const CaseHome = (props) => { messagesObj={props.messagesObj} showFilteredDocs={props.showFilteredDocs} showMaps={props.showMaps} + eventsObj={props.searchResultsObj.eventsObj} />