added in info banner for case summary
This commit is contained in:
@@ -227,6 +227,18 @@ export const getBasicSearch = (searchString) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const getCaseMessage = (searchString) => {
|
||||
return axios
|
||||
.get(BASE_URL + "/api/endpoint/getcasemessage_api?id=" + searchString)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
return error.response;
|
||||
});
|
||||
};
|
||||
|
||||
export const getIncidentbyID = (searchString) => {
|
||||
return axios
|
||||
.get(
|
||||
|
||||
@@ -36,6 +36,7 @@ const Case = (props) => {
|
||||
incidentid={props.incidentid}
|
||||
showMap={props.showMap}
|
||||
currentView={props.currentView}
|
||||
messagesObj={props.messagesObj}
|
||||
/>
|
||||
<Documents
|
||||
incidentid={props.incidentid}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
import cookie from "cookie-cutter";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { useRouter } from "next/router";
|
||||
import { useState } from "react";
|
||||
import { formatDates } from "../utils";
|
||||
export default function CaseNoticeBanner(props) {
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
const { messagesObj } = props;
|
||||
const router = useRouter();
|
||||
|
||||
const noticeContent = messagesObj.value[0].description;
|
||||
const noticeTitle = messagesObj.value[0].subject.split("Banner ")[1];
|
||||
|
||||
const bannerOpenCookie = typeof cookie.get("pedwNotice") == "undefined";
|
||||
let messagesObjArr = messagesObj.value;
|
||||
|
||||
return (
|
||||
<>
|
||||
{messagesObjArr.map((message, index) => (
|
||||
<div className="govuk-warning-text noticebanner" key={index}>
|
||||
<strong className="govuk-warning-text__text">
|
||||
<span className="govuk-visually-hidden">Warning</span>
|
||||
</strong>
|
||||
<div>
|
||||
<div className=" govuk-body-s">
|
||||
<h2 className="govuk-heading-s">
|
||||
{(
|
||||
message.subject.match(
|
||||
new RegExp(">>>", "g")
|
||||
) || []
|
||||
).length > 0
|
||||
? router.locale == "cy"
|
||||
? message.subject
|
||||
.split("Banner ")[1]
|
||||
.split(">>>")[1]
|
||||
: message.subject
|
||||
.split("Banner ")[1]
|
||||
.split(">>>")[0]
|
||||
: (
|
||||
message.subject.match(
|
||||
new RegExp(";", "g")
|
||||
) || []
|
||||
).length > 0
|
||||
? router.locale == "cy"
|
||||
? message.subject
|
||||
.split("Banner ")[1]
|
||||
.split(";")[1]
|
||||
: message.subject
|
||||
.split("Banner ")[1]
|
||||
.split(";")[0]
|
||||
: message.subject.split("Banner ")[1]}
|
||||
</h2>
|
||||
</div>
|
||||
<div className="govuk-body-s">
|
||||
{(
|
||||
message.description.match(
|
||||
new RegExp(">>>", "g")
|
||||
) || []
|
||||
).length > 0
|
||||
? router.locale == "cy"
|
||||
? message.description.split(">>>")[1]
|
||||
: message.description.split(">>>")[0]
|
||||
: (
|
||||
message.description.match(
|
||||
new RegExp(";", "g")
|
||||
) || []
|
||||
).length > 0
|
||||
? router.locale == "cy"
|
||||
? message.description.split(";")[1]
|
||||
: message.description.split(";")[0]
|
||||
: message.description}
|
||||
</div>
|
||||
<div className="govuk-body-xs govuk-!-margin-bottom-0 ">
|
||||
{t("case:date-raised")}:{" "}
|
||||
{formatDates(message.createdon)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -54,7 +54,7 @@ import Pinswg_planningobligationappeals106id from "./summaryTypes/pinswg_plannin
|
||||
import Pinswg_rowid from "./summaryTypes/pinswg_rowid";
|
||||
import Pinswg_transportandworkactid from "./summaryTypes/pinswg_transportandworkactid";
|
||||
import Pinswg_wayleaveid from "./summaryTypes/pinswg_wayleaveid";
|
||||
|
||||
import CaseNoticeBanner from "./caseNoticeBanner";
|
||||
const CaseSummary = (props) => {
|
||||
let { t } = useTranslation();
|
||||
|
||||
@@ -79,6 +79,7 @@ const CaseSummary = (props) => {
|
||||
setWatchedCasesDetails,
|
||||
showMap,
|
||||
currentView,
|
||||
messagesObj,
|
||||
} = props;
|
||||
|
||||
const showLoginCheck =
|
||||
@@ -224,7 +225,9 @@ const CaseSummary = (props) => {
|
||||
? casesObj.pinswg_title
|
||||
: casesObj.reference}
|
||||
</h1>
|
||||
|
||||
{props.messagesObj["@odata.count"] > 0 && (
|
||||
<CaseNoticeBanner messagesObj={props.messagesObj} />
|
||||
)}
|
||||
<dl className="govuk-summary-list govuk-!-margin-bottom-9">
|
||||
<div className="govuk-summary-list__row">
|
||||
<dt className="govuk-summary-list__key">
|
||||
|
||||
@@ -97,5 +97,6 @@
|
||||
"do-you-want-to-delete-case-label": "Ydych chi am ddileu achos",
|
||||
"do-you-want-to-delete-case-disclaimer-label": "Unwaith y caiff ei dileu, bydd yr holl wybodaeth a gyflwynwyd gennych yn cael ei cholli.",
|
||||
"representation-date-passed-label": "Y cyfnod cynrychioli ar gyfer yr apêl hon yw rhwng {{startDate}} a {{endDate}}",
|
||||
"representation-date-passed-additional-label": "Gallwch wneud sylw drwy e-bostio,"
|
||||
"representation-date-passed-additional-label": "Gallwch wneud sylw drwy e-bostio,",
|
||||
"date-raised": "Dyddiad codi"
|
||||
}
|
||||
@@ -97,5 +97,6 @@
|
||||
"do-you-want-to-delete-case-label": "Do you want to delete case ",
|
||||
"do-you-want-to-delete-case-disclaimer-label": "Once deleted all information you have submited, will be lost.",
|
||||
"representation-date-passed-label": "The representation period for this appeal is between {{startDate}} and {{endDate}}",
|
||||
"representation-date-passed-additional-label": "You can make a representation by emailing,"
|
||||
"representation-date-passed-additional-label": "You can make a representation by emailing,",
|
||||
"date-raised": "Date raised"
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* @swagger
|
||||
* /api/endpoint/getmessage_api:
|
||||
* get:
|
||||
* tags: [Search]
|
||||
* description: Gets banner message from activities
|
||||
* parameters:
|
||||
* - name: searchString
|
||||
* in: query
|
||||
* required: true
|
||||
* schema:
|
||||
* type: string
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Success
|
||||
*/
|
||||
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import { azureHeadersPaged, 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 searchString = req.query.id;
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl = `tasks?$select=_regardingobjectid_value,subject,description,createdon,statuscode,scheduledend,scheduledstart&$count=true&$filter=_regardingobjectid_value eq ${searchString} and contains(subject, 'Banner') and statuscode ne 5&$orderby=createdon desc`;
|
||||
|
||||
console.log(
|
||||
"\n==========================================\n",
|
||||
"\nCase messages ",
|
||||
"\nSearch String: " + searchString,
|
||||
"\n\nQuery url: " + queryUrl,
|
||||
"\n\nRelay link: " + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
"\n==========================================\n"
|
||||
);
|
||||
|
||||
var apiResponse = _.isEmpty(req.query)
|
||||
? res.status(400).json()
|
||||
: searchString.length > 0
|
||||
? axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch((error) => {
|
||||
consoleLogger(error);
|
||||
res.status(400).json(error);
|
||||
})
|
||||
: res.status(400).json();
|
||||
|
||||
return apiResponse;
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import {
|
||||
getBasicSearch,
|
||||
getCaseMessage,
|
||||
getIP,
|
||||
getPersonalAccount,
|
||||
getPortalLogin,
|
||||
@@ -90,6 +91,7 @@ const CaseHome = (props) => {
|
||||
props.searchResultsObj.representationsObj
|
||||
}
|
||||
showLoginCheck={true}
|
||||
messagesObj={props.messagesObj}
|
||||
/>
|
||||
</div>
|
||||
<Footer
|
||||
@@ -208,6 +210,9 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
// },
|
||||
currentType: "directResultsObj",
|
||||
docsOffline: process.env.DOCAPI_OFFLINE || false,
|
||||
messagesObj: await getCaseMessage(
|
||||
searchResultsObj.value[0].incidentid
|
||||
),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import {
|
||||
getBasicSearch,
|
||||
getCaseMessage,
|
||||
getIP,
|
||||
getMyCases,
|
||||
getMyLPACases,
|
||||
@@ -100,6 +101,7 @@ const CaseHome = (props) => {
|
||||
props.searchResultsObj.representationsObj
|
||||
}
|
||||
showLoginCheck={true}
|
||||
messagesObj={props.messagesObj}
|
||||
/>
|
||||
</div>
|
||||
<Footer
|
||||
@@ -340,6 +342,9 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
// },
|
||||
currentType: "directResultsObj",
|
||||
docsOffline: process.env.DOCAPI_OFFLINE || false,
|
||||
messagesObj: await getCaseMessage(
|
||||
searchResultsObj.value[0].incidentid
|
||||
),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2642,7 +2642,6 @@ fade {
|
||||
border-left: 10px solid $blue;
|
||||
color: $black;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 18px;
|
||||
padding: 20px 20px 30px 5px;
|
||||
margin-top: 20px;
|
||||
@@ -2673,7 +2672,7 @@ fade {
|
||||
display: block;
|
||||
float: left;
|
||||
left: -14px;
|
||||
|
||||
top: -40%;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user