Merged PR 2274: case deadline and watch stream on results
case deadline and wat Related work items: #22423, #22783
This commit is contained in:
@@ -82,7 +82,7 @@ export const getSelectQuery = (appealTypeName) => {
|
||||
return "&$select=pinswg_eiarequired,pinswg_anticipatedgridreferenceeastingtext,pinswg_anticipatedgridreferencenorthingtext,_pinswg_appellant_value,pinswg_name,pinswg_addressline1,pinswg_addressline2,pinswg_postcode,pinswg_addresstown,_pinswg_associatedlpa_value,pinswg_addresscounty,pinswg_applicationacceptedasvalid,pinswg_applicationrejectedasinvalid,pinswg_choiceofprocedure,pinswg_confirmrequesttovaryapplication,pinswg_dateeventrequested,pinswg_dateofdecision,pinswg_dateofrequesttovarytheapplication,pinswg_dateofsubmissionofapplication,pinswg_dateprojectpublishedonwebsite,pinswg_deadlineforsubmissionofapplication,pinswg_endofrepresentationperiod,pinswg_inspectorreportsubmittedtowelshgovernment,pinswg_procedureconfirmed,pinswg_projectdescription,pinswg_projectlocation,pinswg_recommendation,pinswg_rejectrequesttovaryapplication,pinswg_reportdueby,pinswg_suspensiondates,pinswg_suspensionenddates,pinswg_suspensionstartdate,pinswg_validnoticeofintentiontosubmitanapplicati,pinswg_webaddress,pinswg_withdrawndate,pinswg_writtenacceptanceofnotification,statuscode,pinswg_casestage,pinswg_startdateofevent,pinswg_typeofevent";
|
||||
case "pinswg_sipses":
|
||||
// return "&$select=pinswg_anticipatedgridreferenceeastingtext,pinswg_anticipatedgridreferencenorthingtext,_pinswg_appellant_value,pinswg_name,pinswg_addressline1,pinswg_addressline2,pinswg_postcode,pinswg_addresstown,_pinswg_associatedlpa_value,pinswg_addresscounty,pinswg_applicationacceptedasvalid,pinswg_applicationrejectedasinvalid,pinswg_choiceofprocedure,pinswg_confirmrequesttovaryapplication,pinswg_dateeventrequested,pinswg_dateofdecision,pinswg_dateofrequesttovarytheapplication,pinswg_dateofsubmissionofapplication,pinswg_dateprojectpublishedonwebsite,pinswg_deadlineforsubmissionofapplication,pinswg_decision,pinswg_endofrepresentationperiod,pinswg_inspectorreportsubmittedtowelshgovernment,pinswg_procedureconfirmed,pinswg_projectdescription,pinswg_projectlocation,pinswg_recommendation,pinswg_rejectrequesttovaryapplication,pinswg_reportdueby,pinswg_suspensiondates,pinswg_suspensionenddates,pinswg_suspensionstartdates,pinswg_validnoticeofintentiontosubmitanapplicati,pinswg_webaddress,pinswg_withdrawndate,pinswg_writtenacceptanceofnotification,statuscode,pinswg_casestage,_pinswg_dnsids_value,pinswg_startdateofevent,pinswg_typeofevent";
|
||||
return "&$select=_pinswg_projecttype_value,pinswg_eiarequired,pinswg_anticipatedgridrefeasting,pinswg_anticipatedgridrefnorthing,_pinswg_appellant_value,pinswg_name,_pinswg_associatedlpa_value,pinswg_choiceofprocedure,pinswg_decision,pinswg_projectdescription,pinswg_projectlocation,pinswg_recommendation,statuscode,pinswg_casestage,_pinswg_sipscase_value,pinswg_writtenacceptanceofnotification,pinswg_validnoticeofintentiontosubmit,pinswg_deadlineforsubmissionofapplication,pinswg_screeningstartdate,pinswg_eiatargetdate,pinswg_targetextended,pinswg_directionissueddate,pinswg_eiarequired,pinswg_scopingstartdate,pinswg_scopingtargetdate,pinswg_scopingtargetextended,pinswg_scopingoutcomeissueddate,pinswg_essubmitted,pinswg_deemedmarinelicenseappliedfor,pinswg_validationdeadlineextension,pinswg_consultationopen,pinswg_consultationclose,pinswg_reportissuedtowelshministers,pinswg_decisionissuedtoapplicant,pinswg_decisionoutcome,pinswg_redetermination,pinswg_redeterminationconsultationdeadline";
|
||||
return "&$select=pinswg_casedeadline,_pinswg_projecttype_value,pinswg_eiarequired,pinswg_anticipatedgridrefeasting,pinswg_anticipatedgridrefnorthing,_pinswg_appellant_value,pinswg_name,_pinswg_associatedlpa_value,pinswg_choiceofprocedure,pinswg_decision,pinswg_projectdescription,pinswg_projectlocation,pinswg_recommendation,statuscode,pinswg_casestage,_pinswg_sipscase_value,pinswg_writtenacceptanceofnotification,pinswg_validnoticeofintentiontosubmit,pinswg_deadlineforsubmissionofapplication,pinswg_screeningstartdate,pinswg_eiatargetdate,pinswg_targetextended,pinswg_directionissueddate,pinswg_eiarequired,pinswg_scopingstartdate,pinswg_scopingtargetdate,pinswg_scopingtargetextended,pinswg_scopingoutcomeissueddate,pinswg_essubmitted,pinswg_deemedmarinelicenseappliedfor,pinswg_validationdeadlineextension,pinswg_consultationopen,pinswg_consultationclose,pinswg_reportissuedtowelshministers,pinswg_decisionissuedtoapplicant,pinswg_decisionoutcome,pinswg_redetermination,pinswg_redeterminationconsultationdeadline";
|
||||
break;
|
||||
default:
|
||||
return "";
|
||||
|
||||
@@ -222,7 +222,9 @@ const EventsDetails = (props) => {
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Watch live stream
|
||||
{t(
|
||||
"case:live-event-link"
|
||||
)}
|
||||
</a>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -379,12 +379,12 @@ const CaseSummary = (props) => {
|
||||
className="govuk-notification-banner__title"
|
||||
id="live-event-title"
|
||||
>
|
||||
Live event
|
||||
{t("case:live-event-subheading")}
|
||||
</h2>
|
||||
</div>
|
||||
<div className="govuk-notification-banner__content">
|
||||
<p className="govuk-notification-banner__heading">
|
||||
A live streamed event is happening now.
|
||||
{t("case:live-event-copy")}
|
||||
</p>
|
||||
|
||||
{livePublishedEvent.pinswg_eventname && (
|
||||
@@ -401,7 +401,7 @@ const CaseSummary = (props) => {
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Watch live stream
|
||||
{t("case:live-event-link")}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -29,6 +29,17 @@ const Pinswg_sipscase = (props) => {
|
||||
);
|
||||
}
|
||||
|
||||
const extensions =
|
||||
detailsObj.pinswg_CaseDeadlineExtension_pinswg_sips || [];
|
||||
|
||||
const latest = extensions.sort(
|
||||
(a, b) =>
|
||||
new Date(b.pinswg_datedeadlineextended) -
|
||||
new Date(a.pinswg_datedeadlineextended)
|
||||
)[0];
|
||||
|
||||
console.log(latest);
|
||||
|
||||
return (
|
||||
<>
|
||||
{detailsObj.pinswg_projectdescription != null ? (
|
||||
@@ -485,7 +496,48 @@ const Pinswg_sipscase = (props) => {
|
||||
<h3 className="govuk-heading-m govuk-!-margin-bottom-7">
|
||||
{t("case:summary-dates-label")}
|
||||
</h3>
|
||||
<h4 className="govuk-heading-s ">
|
||||
<dl className="govuk-summary-list govuk-!-font-size-16 govuk-!-margin-bottom-9">
|
||||
<SummaryRow
|
||||
label={"Case deadline"}
|
||||
value={(() => {
|
||||
const fallback = t(
|
||||
"case:summary-awaiting-information-label"
|
||||
);
|
||||
|
||||
const extensions =
|
||||
detailsObj.pinswg_CaseDeadlineExtension_pinswg_sips ||
|
||||
[];
|
||||
|
||||
const latestExtension =
|
||||
extensions
|
||||
.filter(
|
||||
(extension) =>
|
||||
!_.isEmpty(
|
||||
extension.pinswg_datedeadlineextended
|
||||
)
|
||||
)
|
||||
.sort(
|
||||
(a, b) =>
|
||||
new Date(
|
||||
b.pinswg_datedeadlineextended
|
||||
) -
|
||||
new Date(
|
||||
a.pinswg_datedeadlineextended
|
||||
)
|
||||
)[0];
|
||||
|
||||
const dateToDisplay =
|
||||
latestExtension
|
||||
? latestExtension.pinswg_datedeadlineextended
|
||||
: detailsObj.pinswg_casedeadline;
|
||||
|
||||
return !_.isEmpty(dateToDisplay)
|
||||
? formatDates(dateToDisplay)
|
||||
: fallback;
|
||||
})()}
|
||||
/>
|
||||
</dl>
|
||||
<h4 className="govuk-heading-s">
|
||||
{t(
|
||||
"case:summary-pre-submission-sub-title"
|
||||
)}
|
||||
|
||||
@@ -30,6 +30,7 @@ import {
|
||||
getWatchedCasesProxy
|
||||
} from "../../actions/services/portalService";
|
||||
import RepsOnResults from "./repsonresults";
|
||||
import LiveLink from "./liveLink";
|
||||
|
||||
const escapeRegExp = (string) => string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
|
||||
@@ -394,6 +395,12 @@ const SearchResults = (props) => {
|
||||
<RepsOnResults
|
||||
detailsObj={detailsObj}
|
||||
/>
|
||||
<LiveLink
|
||||
detailsObj={detailsObj}
|
||||
appealType={
|
||||
item.pinswg_appealcasetype
|
||||
}
|
||||
/>
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">
|
||||
|
||||
@@ -8,6 +8,7 @@ import { connect } from "react-redux";
|
||||
import transLookup from "../../data/lookuptranslations.json";
|
||||
import PaginationControl from "./pagination";
|
||||
import RepsOnResults from "./repsonresults";
|
||||
import LiveLink from "./liveLink";
|
||||
|
||||
import {
|
||||
getBasicDNSSearchPaged,
|
||||
@@ -468,6 +469,12 @@ const DNSSearchResults = (props) => {
|
||||
item.pinswg_appealcasetype
|
||||
}
|
||||
/>
|
||||
<LiveLink
|
||||
detailsObj={detailsObj}
|
||||
appealType={
|
||||
item.pinswg_appealcasetype
|
||||
}
|
||||
/>
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import Link from "next/link";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
|
||||
const isSameDay = (dateA, dateB) =>
|
||||
dateA.getFullYear() === dateB.getFullYear() &&
|
||||
dateA.getMonth() === dateB.getMonth() &&
|
||||
dateA.getDate() === dateB.getDate();
|
||||
|
||||
const getLiveEvent = (detailsObj) => {
|
||||
const events = detailsObj?.pinswg_sips_pinswg_sipsevent || [];
|
||||
|
||||
if (!Array.isArray(events) || events.length === 0) return null;
|
||||
|
||||
const now = new Date();
|
||||
|
||||
return events.find((event) => {
|
||||
if (!event?.pinswg_dateeventrequested) return false;
|
||||
|
||||
const eventDate = new Date(event.pinswg_dateeventrequested);
|
||||
|
||||
return isSameDay(eventDate, now);
|
||||
});
|
||||
};
|
||||
|
||||
const LiveLink = ({ detailsObj }) => {
|
||||
let { t } = useTranslation();
|
||||
const liveEvent = getLiveEvent(detailsObj);
|
||||
|
||||
if (!liveEvent || !liveEvent.pinswg_linktotheevent) return null;
|
||||
|
||||
return (
|
||||
<div className="govuk-!-margin-top-3">
|
||||
<a
|
||||
href={liveEvent.pinswg_linktotheevent}
|
||||
className="govuk-link"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{t("case:live-event-link")}
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default LiveLink;
|
||||
@@ -39,6 +39,7 @@ import {
|
||||
|
||||
import { sendGAEvent } from "@next/third-parties/google";
|
||||
import RepsOnResults from "./repsonresults";
|
||||
import LiveLink from "./liveLink";
|
||||
import { query } from "jsonpath";
|
||||
|
||||
const escapeRegExp = (string) => string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
@@ -478,6 +479,12 @@ const SearchResults = (props) => {
|
||||
item.pinswg_appealcasetype
|
||||
}
|
||||
/>
|
||||
<LiveLink
|
||||
detailsObj={detailsObj}
|
||||
appealType={
|
||||
item.pinswg_appealcasetype
|
||||
}
|
||||
/>
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||
<span className="results-visually-hidden">
|
||||
|
||||
@@ -145,5 +145,8 @@
|
||||
"summary-decision-issued-to-applicant": "Penderfyniad a Gyhoeddwyd i'r Ymgeisydd",
|
||||
"summary-decision-outcome": "Canlyniad y Penderfyniad",
|
||||
"media-title": "Recordiadau digwyddiadau",
|
||||
"video-heading": "Fideos"
|
||||
"video-heading": "Fideos",
|
||||
"live-event-subheading": "Digwyddiad byw",
|
||||
"live-event-copy": "Mae digwyddiad sy'n cael ei ffrydio'n fyw yn digwydd nawr.",
|
||||
"live-event-link": "Gwylio'r ffrydio byw"
|
||||
}
|
||||
@@ -146,5 +146,8 @@
|
||||
"summary-decision-issued-to-applicant": "Decision Issued to Applicant",
|
||||
"summary-decision-outcome": "Decision Outcome",
|
||||
"media-title": "Event recordings",
|
||||
"video-heading": "Videos"
|
||||
"video-heading": "Videos",
|
||||
"live-event-subheading": "Live event",
|
||||
"live-event-copy": "A live streamed event is happening now.",
|
||||
"live-event-link": "Watch live stream"
|
||||
}
|
||||
@@ -86,7 +86,10 @@ export default async function ApiProxy(req, res) {
|
||||
"&$count=true" +
|
||||
"&$expand=" +
|
||||
navigationProperty +
|
||||
"($select=ticketnumber)";
|
||||
"($select=ticketnumber)" +
|
||||
(primaryIdAttribute == "pinswg_sipscase"
|
||||
? ",pinswg_CaseDeadlineExtension_pinswg_sips($select=pinswg_casedeadlineextensionid,pinswg_noofdaysextended,pinswg_reasonforextension,pinswg_agreedorimposedextension,pinswg_datedeadlineextended)"
|
||||
: "");
|
||||
|
||||
queryUrl = queryUrl + getSelectQuery(appealTypeName);
|
||||
|
||||
|
||||
@@ -86,7 +86,10 @@ export default async function ApiProxy(req, res) {
|
||||
"&$count=true" +
|
||||
"&$expand=" +
|
||||
navigationProperty +
|
||||
"($select=ticketnumber)";
|
||||
"($select=ticketnumber)" +
|
||||
(primaryIdAttribute == "pinswg_sipscase"
|
||||
? ",pinswg_sipscase($select=ticketnumber),pinswg_CaseDeadlineExtension_pinswg_sips($select=pinswg_casedeadlineextensionid,pinswg_noofdaysextended,pinswg_reasonforextension,pinswg_agreedorimposedextension,pinswg_datedeadlineextended),pinswg_sips_pinswg_sipsevent($select=pinswg_linktotheevent,pinswg_name,pinswg_dateeventrequested,pinswg_typeofevent,createdon,modifiedon)"
|
||||
: "");
|
||||
|
||||
queryUrl =
|
||||
queryUrl +
|
||||
@@ -137,7 +140,7 @@ export default async function ApiProxy(req, res) {
|
||||
|
||||
if (_.has(data, "@odata.nextLink") === true) {
|
||||
const dataStr = JSON.stringify(data["@odata.nextLink"]);
|
||||
data["@odata.nextLink"] = dataStr.split("/v8.2/")[1];
|
||||
data["@odata.nextLink"] = dataStr.split("/v9.2/")[1];
|
||||
}
|
||||
|
||||
return respondSuccess(res, data);
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import { respondError } from "../middleware/apiResponse";
|
||||
import { relayGet } from "../middleware/relayForwarding";
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
const caseid = req.query.caseid;
|
||||
|
||||
if (typeof caseid !== "string" || caseid.trim().length === 0) {
|
||||
return respondError(res, {
|
||||
status: 400,
|
||||
code: "CASE_ID_REQUIRED",
|
||||
message: "caseid is required"
|
||||
});
|
||||
}
|
||||
|
||||
const queryUrl =
|
||||
"pinswg_casedeadlineextensions?$count=true&$filter=_pinswg_regardingcase_value eq " +
|
||||
caseid +
|
||||
" and pinswg_publishtoweb eq true&$select=pinswg_videoplatformurl,pinswg_eventrecordingid,pinswg_publishtoweb,pinswg_eventrecordingname,pinswg_eventrecordingpublisheddate,createdon";
|
||||
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
res,
|
||||
errorResponse: {
|
||||
status: 400,
|
||||
code: "SIPS_MEDIA_FETCH_FAILED",
|
||||
message: "Failed to fetch SIPS media"
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user