From 9140476a2a8793a00de67fa6f489cf7ea70864b6 Mon Sep 17 00:00:00 2001 From: Robert Bond Date: Wed, 29 Apr 2026 17:03:50 +0000 Subject: [PATCH] Merged PR 2285: tweak to live link tweak to live link Related work items: #22423 --- components/case/summary/utils/liveEvent.js | 10 ++++-- components/search/liveLink.js | 32 +++++-------------- i18n.js | 22 ++++++++++--- .../getbasicsearchdetailspaged_api.js | 2 +- pages/myportal/dns/[developmentName].js | 5 +-- 5 files changed, 37 insertions(+), 34 deletions(-) diff --git a/components/case/summary/utils/liveEvent.js b/components/case/summary/utils/liveEvent.js index bf507a5e..dde522e6 100644 --- a/components/case/summary/utils/liveEvent.js +++ b/components/case/summary/utils/liveEvent.js @@ -6,9 +6,15 @@ export function isEventLiveNow(item) { if (isNaN(start.getTime())) return false; - if (item.pinswg_enddateoftheevent) { - const end = new Date(item.pinswg_enddateoftheevent); + const endDateValue = + item.pinswg_enddateofevent || item.pinswg_enddateoftheevent; + + if (endDateValue) { + const end = new Date(endDateValue); if (isNaN(end.getTime())) return false; + + end.setHours(23, 59, 59, 999); + return now >= start && now <= end; } diff --git a/components/search/liveLink.js b/components/search/liveLink.js index 048db1cd..c39ad040 100644 --- a/components/search/liveLink.js +++ b/components/search/liveLink.js @@ -1,32 +1,16 @@ -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); - }); -}; +import { getLivePublishedEvent } from "../case/summary/utils/liveEvent"; const LiveLink = ({ detailsObj }) => { let { t } = useTranslation(); - const liveEvent = getLiveEvent(detailsObj); - if (!liveEvent || !liveEvent.pinswg_linktotheevent) return null; + const eventsObj = { + value: detailsObj?.pinswg_sips_pinswg_sipsevent || [] + }; + + const liveEvent = getLivePublishedEvent(eventsObj); + + if (!liveEvent) return null; return (
diff --git a/i18n.js b/i18n.js index f9df4e57..2831a5ae 100644 --- a/i18n.js +++ b/i18n.js @@ -27,7 +27,8 @@ module.exports = { "search", "dnsCommon", "dnsApplications", - "case" + "case", + "case-stages" ], "/myportal/dnsdetails": [ "case", @@ -36,7 +37,13 @@ module.exports = { "dnsApplications" ], "/myportal/dns/*": ["dnsCommon", "case", "common"], - "/myportal/dns/[developmentName]": ["dnsCommon", "case", "common"], + "/myportal/dns/[developmentName]": [ + "dnsCommon", + "case", + "common", + , + "case-stages" + ], "/advancedsearch": ["search", "myportal"], "/advancedsearchresults": ["search", "case"], "/searchresults": ["search", "case"], @@ -63,9 +70,14 @@ module.exports = { "/newappeal/*": ["newappeal", "home"], "/newappeal/[appealtypes]": ["newappeal", "home", "myportal"], "/newappeal/selectappeal": ["newappeal", "home"], - "/dns/*": ["dnsCommon", "case", "common"], - "/dns/[developmentName]": ["dnsCommon", "case", "common"], - "/dns": ["dnsCommon", "dnsHome"], + "/dns/*": ["dnsCommon", "case", "common", "case-stages"], + "/dns/[developmentName]": [ + "dnsCommon", + "case", + "common", + "case-stages" + ], + "/dns": ["dnsCommon", "dnsHome", , "case-stages"], "/dns/applications": ["dnsCommon", "dnsApplications"], "/dns/application-view": ["dnsCommon", "dnsApplicationView"], "/dnsapplications": ["search", "dnsCommon", "dnsApplications", "case"], diff --git a/pages/api/endpoint/getbasicsearchdetailspaged_api.js b/pages/api/endpoint/getbasicsearchdetailspaged_api.js index c5e019ce..985b54e0 100644 --- a/pages/api/endpoint/getbasicsearchdetailspaged_api.js +++ b/pages/api/endpoint/getbasicsearchdetailspaged_api.js @@ -88,7 +88,7 @@ export default async function ApiProxy(req, res) { navigationProperty + "($select=ticketnumber,statuscode)" + (primaryIdAttribute == "pinswg_sipscase" - ? ",pinswg_sipscase($select=ticketnumber),pinswg_CaseDeadlineExtension_pinswg_sips($select=pinswg_casedeadlineextensionid,pinswg_noofdaysextended,pinswg_reasonforextension,pinswg_agreedorimposedextension,pinswg_newcasedeadline),pinswg_sips_pinswg_sipsevent($select=pinswg_linktotheevent,pinswg_name,pinswg_dateeventrequested,pinswg_typeofevent,createdon,modifiedon)" + ? ",pinswg_sipscase($select=ticketnumber),pinswg_CaseDeadlineExtension_pinswg_sips($select=pinswg_casedeadlineextensionid,pinswg_noofdaysextended,pinswg_reasonforextension,pinswg_agreedorimposedextension,pinswg_newcasedeadline),pinswg_sips_pinswg_sipsevent($select=pinswg_eventpublishflag,pinswg_linktotheevent,pinswg_name,pinswg_dateeventrequested,pinswg_typeofevent,createdon,modifiedon)" : ""); queryUrl = diff --git a/pages/myportal/dns/[developmentName].js b/pages/myportal/dns/[developmentName].js index ff1eb099..af0d2e1b 100644 --- a/pages/myportal/dns/[developmentName].js +++ b/pages/myportal/dns/[developmentName].js @@ -30,7 +30,8 @@ import { setMediaDetails } from "../../../store/searchOutput/action"; import { wrapper } from "../../../store/store"; -import ServiceBanner from "../../../components/servicebanner"; +import ServiceBanner from "../../../components/myportal/servicebanner"; + const CaseHome = (props) => { const { footerLinks, @@ -61,7 +62,7 @@ const CaseHome = (props) => {
- +