import { JSONPath as jsonpath } from "jsonpath-plus"; import _ from "lodash"; import useTranslation from "next-translate/useTranslation"; import Link from "next/link"; import { useRouter } from "next/router"; 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 MediaDetails from "./media"; import StatusDetails from "./status"; import { createWatchedCases, deleteWatchedCases, getWatchedCasesProxy, setCaseInvolvment } from "../../actions/services/portalService"; import { getLinkedCases } from "../../actions/services/searchService"; import { getPortalModuleDetailsProxy } from "../../actions/services/caseService"; import { setCurrentLinkedCases, setCurrentReference, setCurrentView } from "../../store/currentView/action"; import { setWatchedCases, setWatchedCasesDetails } from "../../store/watchedCases/action"; import { signIn, useSession } from "next-auth/react"; import { destroyCookie, parseCookies, setCookie } from "nookies"; import { getFormCollectionByID, getDetailsProxy, hasOwn } from "../utils"; import { getLivePublishedEvent, isEventLiveNow } from "./summary/utils/liveEvent"; import * as CaseTypes from "./summaryTypes"; // ✅ must match filename exactly import { capitalizeFirstLetter, formatDates, hasValidKey, isObjectNotEmpty, hasOwnPropertyAndNotNull, linkedCasesList, getBilingualText } from "./summary/utils/helpers"; import { isConsultationWindowOpen, isGeneralRepresentationWindowOpen, canShowRepButtonForAppealType, getEntryCtaLabelKey, shouldSuppressBlockedMessage, getGeneralBlockedEndDate, isRepresentationPeriodEnded } from "./summary/utils/representationEntry"; import { resolveSearchResultsHref, isDnsRoutePath } from "../../lib/routing/routeState"; import CaseNoticeBanner from "./caseNoticeBanner"; import WatchModal from "./watchmodal"; import EIADetails from "./eia"; import MapComponent from "../mapping"; import OSPoint from "ospoint"; const CaseSummary = (props) => { let { t } = useTranslation(); const router = useRouter(); const { locale } = router; const { appealTypeID, incidentid, caseReference, myCases, myRepresentations, watchedCases, awaitingSubmission, searchResultsObj, searchDetailsObj, directSearchResultsObj, currentType, setCurrentLinkedCases, linkedCasesReference, setCurrentReference, setWatchedCases, setWatchedCasesDetails, showMap, currentView, messagesObj, docsOffline, ticketnumber, mapTarget } = props; const showLoginCheck = currentType == "directResultsObj" ? "true" : currentView.showLogin; //let showLoginCheck = props.showLoginCheck; const { data: session, status } = useSession(); const [isModalOpen, setIsModalOpen] = useState(false); const [whichTab, setWhichTab] = useState("case-details"); const handleOpenModal = () => { setIsModalOpen(true); }; const handleCloseModal = () => { setIsModalOpen(false); }; const cookies = parseCookies(); const isLPA = props.accountDetails.accountDetails[ "pinswg_typeofinvolvement@OData.Community.Display.V1.FormattedValue" ] == "LPA" ? true : false; const selectWatchedCase = (loggedInUser, incidentID, appealType) => { let updateBody = { "pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")", "pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")", "pinswg_appealcasetype": +appealType }; createWatchedCases(updateBody) .then((data) => data) .then(() => { getWatchedCasesProxy(loggedInUser).then((data) => { (setWatchedCases(data), getDetailsProxy(data, "myWatchedCases").then((data) => { setWatchedCasesDetails(data); })); }); }); //setCaseInvolvment(incidentid, loggedInUser); }; const selectEmailNotifications = ( emailaddress, loggedInUser, incidentID, appealType ) => { let updateBody = { "pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")", "pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")", "pinswg_appealcasetype": +appealType, "pinswg_emailnotifications": true }; console.log("Email signed up"); createWatchedCases(updateBody) .then((data) => data) .then(() => { getWatchedCasesProxy(props.accountDetails.loggedinUserId).then( (data) => { (setWatchedCases(data), getDetailsProxy(data, "myWatchedCases").then( (data) => { setWatchedCasesDetails(data); } )); } ); }); }; const isWatchedCase = (whichIncident) => { let isWatched = jsonpath({ path: "$..value[?(@ && @._pinswg_watchedcase_value=='" + whichIncident + "')]", json: watchedCases, eval: true }); return isWatched; }; const isEmailSignUp = (whichIncident) => { let isEmail = jsonpath({ path: "$..value[?(@ && @._pinswg_watchedcase_value=='" + whichIncident + "' && @.pinswg_emailnotifications==true)]", json: watchedCases, eval: true }); return isEmail; }; const deleteItem = (caseID, topThreeType) => { let cookies = parseCookies(); topThreeType == "watchedCases" && deleteWatchedCases(caseID) .then((data) => data) .then(() => { getWatchedCasesProxy(cookies.pinsUser).then((data) => { let showWatchedCases = (submittedArr) => { const required = submittedArr.value.filter((el) => { return ( el.pinswg_representationsubmitted == null ); }); let newObj = {}; return Object.assign(newObj, { "@odata.count": required.length, "value": required }); }; data = showWatchedCases(data); data.value.sort(function compare(a, b) { var dateA = new Date(a.createdon); var dateB = new Date(b.createdon); return dateB - dateA; }); (setWatchedCases(data), getDetailsProxy(data, "myWatchedCases").then( (data) => { setWatchedCasesDetails(data); } )); }); }); }; const noRepresentationLink = ["/dnsdetails", "/dns/[developmentName]"]; let setCaseQueryObj = currentType == "directResultsObj" ? props.searchResultsObj : props[currentType]; let setCaseDetailsObj = currentType == "directResultsObj" ? props.searchDetailsObj : props[currentType + "Details"]; var casesObj = {}; currentType == "searchResultsObj" ? (casesObj = jsonpath({ path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]', json: searchResultsObj, eval: true })) : currentType == "watchedCases" ? (casesObj = jsonpath({ path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]', json: setCaseQueryObj, eval: true })) : currentType == "myCases" ? (casesObj = jsonpath({ path: '$..[?(@ && @.pinswg_title=="' + caseReference + '")]', json: setCaseQueryObj, eval: true })) : currentType == "directResultsObj" ? (casesObj = jsonpath({ path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]', json: setCaseQueryObj, eval: true })) : (casesObj = jsonpath({ path: '$..[?(@ && @.reference=="' + caseReference + '")]', json: setCaseQueryObj, eval: true })); casesObj = Object.assign({}, ...casesObj); var detailsObj = {}; currentType == "searchResultsObj" ? (detailsObj = jsonpath({ path: '$..[?(@ && @.pinswg_name=="' + caseReference + '")]', json: searchDetailsObj, eval: true })) : currentType == "directResultsObj" ? (detailsObj = setCaseDetailsObj[0].value[0]) : (detailsObj = jsonpath({ path: '$..[?(@ && @.pinswg_name=="' + caseReference + '")]', jsopn: setCaseDetailsObj, eval: true })); detailsObj = typeof detailsObj == "object" ? detailsObj : detailsObj[0]; let showDetails = typeof detailsObj != "undefined" ? true : false; var timestamp = showDetails ? detailsObj.hasOwnProperty("pinswg_representation_period_end_date") ? Date.parse(detailsObj.pinswg_representation_period_end_date) : "n/a" : "n/a"; if (isNaN(timestamp) == false) { var d = new Date(timestamp); } let hasEndDate = typeof d != "undefined"; const hasEventsTabData = isObjectNotEmpty(props, "eventsObj") && Array.isArray(props.eventsObj?.value) && props.eventsObj.value.length > 0; const hasMediaTabData = isObjectNotEmpty(props, "mediaObj") && Array.isArray(props.mediaObj?.value) && props.mediaObj.value.length > 0; const livePublishedEvent = hasEventsTabData ? getLivePublishedEvent(props.eventsObj) : null; let point = {}; let siteCoords = {}; let center = {}; point = new OSPoint( detailsObj.pinswg_anticipatedgridreferencenorthingtext || detailsObj.pinswg_anticipatedgridrefnorthing, detailsObj.pinswg_anticipatedgridreferenceeastingtext || detailsObj.pinswg_anticipatedgridrefeasting ); siteCoords = point.toOSGB36(); //console.log(siteCoords); center = { id: "", lat: isNaN(parseFloat(siteCoords.latitude)) ? 52.412272 : parseFloat(siteCoords.latitude), lng: isNaN(parseFloat(siteCoords.longitude)) ? -3.437989 : parseFloat(siteCoords.longitude) }; const zoom = isNaN(parseFloat(siteCoords.latitude)) ? 7 : 12; const isDnsRoute = isDnsRoutePath(router.pathname); const searchHref = resolveSearchResultsHref({ query: router.query, hasSession: Boolean(session), includeViewAll: true, fallbackToMyPortalWhenNoFlags: true, isDnsRoute }); let showDetailsBlock = showDetails == true ? ( <>
{livePublishedEvent && (

{t("case:live-event-subheading")}

{t("case:live-event-copy")}

{livePublishedEvent.pinswg_eventname && (

{livePublishedEvent.pinswg_eventname}

)} {t("case:live-event-link")}
)}

{t("case:summary-reference-label")}:{" "} {currentType == "searchResultsObj" ? detailsObj.pinswg_name : currentType == "directResultsObj" ? casesObj.title : currentType == "watchedCases" ? casesObj.pinswg_title : casesObj.reference}

Contents

{/*

*/} {props.messagesObj["@odata.count"] > 0 && ( )}
{getFormCollectionByID( appealTypeID || setCaseQueryObj.value[0] .pinswg_appealcasetype ).PrimaryIdAttribute == "pinswg_dnsid" ? t( "case:summary-applicantonly-label" ) : getFormCollectionByID( appealTypeID || setCaseQueryObj .value[0] .pinswg_appealcasetype ).PrimaryIdAttribute == "pinswg_nonvalidationid" ? t( "case:summary-appellantonly-label" ) : t( "case:summary-applicant-label" )}
{casesObj.pinswg_appellantagent == 846040001 ? casesObj.pinswg_appellantfirstname + " " + casesObj.pinswg_appellantlastname : detailsObj[ "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" ] || "not entered"}
{detailsObj.pinswg_agentcontactname != null && (hasOwn( detailsObj, "pinswg_agentcontactname" ) ? (
{t( "case:summary-agent-label" )}
{hasOwn( detailsObj, "pinswg_agentcontactname" ) ? detailsObj.pinswg_agentcontactname : ""}
) : ( "" ))}
{t( "case:summary-site-address-label" )}
{getFormCollectionByID( appealTypeID || setCaseQueryObj.value[0] .pinswg_appealcasetype ).PrimaryIdAttribute == "pinswg_dnsid" || getFormCollectionByID( appealTypeID ).PrimaryIdAttribute == "pinswg_sipscase" ? detailsObj.pinswg_projectlocation != null ? detailsObj.pinswg_projectlocation.indexOf( ";" ) < 0 ? detailsObj.pinswg_projectlocation : router.locale == "cy" ? detailsObj.pinswg_projectlocation.split( ";" )[1] : detailsObj.pinswg_projectlocation.split( ";" )[0] : "" : ""} {hasOwn( detailsObj, "pinswg_siteaddressline1" ) ? detailsObj.pinswg_siteaddressline1 : ""} {hasOwn( detailsObj, "pinswg_addressline1" ) ? detailsObj.pinswg_addressline1 : ""} {hasOwn( detailsObj, "pinswg_siteaddressline1" ) && detailsObj.pinswg_siteaddressline1 != null &&
} {hasOwn( detailsObj, "pinswg_addressline1" ) && detailsObj.pinswg_addressline1 != null &&
} {hasOwn( detailsObj, "pinswg_siteaddressline2" ) ? detailsObj.pinswg_siteaddressline2 : ""} {hasOwn( detailsObj, "pinswg_addressline2" ) ? detailsObj.pinswg_addressline2 : ""} {hasOwn( detailsObj, "pinswg_addressline2" ) && detailsObj.pinswg_addressline2 != null &&
} {hasOwn( detailsObj, "pinswg_siteaddresstown" ) ? detailsObj.pinswg_siteaddresstown : ""} {hasOwn( detailsObj, "pinswg_addresstown" ) ? detailsObj.pinswg_addresstown : ""} {hasOwn( detailsObj, "pinswg_siteaddresstown" ) && detailsObj.pinswg_siteaddresstown != null &&
} {hasOwn( detailsObj, "pinswg_addresstown" ) && detailsObj.pinswg_addresstown != null &&
} {hasOwn( detailsObj, "pinswg_siteaddresscounty" ) ? detailsObj.pinswg_siteaddresscounty : ""} {hasOwn( detailsObj, "pinswg_addresscounty" ) ? detailsObj.pinswg_addresscounty : ""} {hasOwn( detailsObj, "pinswg_siteaddresscounty" ) && detailsObj.pinswg_siteaddresscounty != null &&
} {hasOwn( detailsObj, "pinswg_addresscounty" ) && detailsObj.pinswg_addresscounty != null &&
} {hasOwn( detailsObj, "pinswg_siteaddresspostcode" ) ? detailsObj.pinswg_siteaddresspostcode : ""} {hasOwn( detailsObj, "pinswg_postcode" ) ? detailsObj.pinswg_postcode : ""}
{casesObj.description != null && (
{t( "case:summary-description-label" )}
{getBilingualText( casesObj.description, router.locale )}
)} {detailsObj.pinswg_casestage != null && (
{t( "case:summary-case-stage-label" )}
{router.locale == "cy" ? jsonpath({ path: '$..[?(@.value=="' + detailsObj[ "pinswg_casestage@OData.Community.Display.V1.FormattedValue" ] + '")].value_cy', json: transLookup, eval: true }) : detailsObj[ "pinswg_casestage@OData.Community.Display.V1.FormattedValue" ] || t( "case:summary-no-date-entered-label" )}
)} {casesObj.pinswg_environmentalstatementlocation != null && (
{t( "case:summary-environmental-statement-label" )}
{ casesObj.pinswg_environmentalstatementlocation }
)}
{t( "case:summary-last-modified-label" )}
{detailsObj.modifiedon > casesObj.modifiedon ? formatDates( detailsObj.modifiedon ) : formatDates( casesObj.modifiedon )}
{showLoginCheck == "true" && ( <>
{getFormCollectionByID( appealTypeID ).PrimaryIdAttribute == "pinswg_sipscase" && isConsultationWindowOpen( detailsObj ) && ( <> {canShowRepButtonForAppealType( { "appealType": props .currentView .caseReference .appealType, "isLPA": isLPA, "searchDetailsObj": props.searchDetailsObj } ) ? ( <> {t( getEntryCtaLabelKey( props .currentView .caseReference .appealType ) )} ) : shouldSuppressBlockedMessage( { "appealType": props .currentView .caseReference .appealType, "isLPA": isLPA } ) ? ( "" ) : ( <>

{t( "case:representation-date-passed-label", { startDate: formatDates( detailsObj.pinswg_consultationopen ), endDate: formatDates( detailsObj.pinswg_consultationclose ) } )}
{" "} {t( "case:representation-date-passed-additional-label" )}{" "} {t( "home:login-contact-email" )}

)} )} {isGeneralRepresentationWindowOpen( detailsObj ) && ( <> {canShowRepButtonForAppealType( { "appealType": props .currentView .caseReference .appealType, "isLPA": isLPA, "searchDetailsObj": props.searchDetailsObj } ) ? ( <> {t( "case:summary-make-representation-label" )} ) : shouldSuppressBlockedMessage( { "appealType": props .currentView .caseReference .appealType, "isLPA": isLPA } ) ? ( "" ) : ( <>

{t( "case:representation-date-passed-label", { startDate: formatDates( detailsObj.pinswg_startdate ), endDate: props .currentView .caseReference .appealType == 846040019 ? formatDates( getGeneralBlockedEndDate( detailsObj, props .currentView .caseReference .appealType ) ) : formatDates( getGeneralBlockedEndDate( detailsObj, props .currentView .caseReference .appealType ) ) } )}
{" "} {t( "case:representation-date-passed-additional-label" )}{" "} {t( "home:login-contact-email" )}

)} )} {" "} {t( "case:summary-back-button-label" )}
{session && (isWatchedCase( props.currentView .caseReference .incidentid ).length > 0 == true ? ( ) : ( <> ))} {session && (isEmailSignUp( props.currentView .caseReference .incidentid ).length > 0 == true ? ( ) : ( <> ))} {!session && ( <> {" "} )}
{hasOwn( detailsObj, "pinswg_startdate" ) && (detailsObj.pinswg_startdate != null || detailsObj.pinswg_finalcommentsduedate != null) && isRepresentationPeriodEnded( detailsObj ) && (
{props.currentView .caseReference .appealType == 84604002 ? t( "case:consultation-period-ended-on-label" ) : t( "case:representation-period-ended-on-label" )} {props.currentView .caseReference .appealType == 846040019 ? formatDates( detailsObj.pinswg_statementduedate ) : formatDates( detailsObj.pinswg_finalcommentsduedate )}
)}
)}
{showSummary( appealTypeID, casesObj, detailsObj, formatDates, linkedCasesList, currentView, showMap )}
{((hasValidKey( detailsObj, "pinswg_anticipatedgridreferencenorthingtext" ) && hasValidKey( detailsObj, "pinswg_anticipatedgridreferenceeastingtext" )) || (hasValidKey( detailsObj, "pinswg_anticipatedgridrefeasting" ) && hasValidKey( detailsObj, "pinswg_anticipatedgridrefnorthing" ))) && (
{/* */}
{t( "case:summary-site-address-label" )}
{getFormCollectionByID( appealTypeID ).PrimaryIdAttribute == "pinswg_dnsid" || getFormCollectionByID( appealTypeID ).PrimaryIdAttribute == "pinswg_sipscase" ? detailsObj.pinswg_projectlocation != null ? detailsObj.pinswg_projectlocation.indexOf( ";" ) < 0 ? detailsObj.pinswg_projectlocation : router.locale == "cy" ? detailsObj.pinswg_projectlocation.split( ";" )[1] : detailsObj.pinswg_projectlocation.split( ";" )[0] : "" : ""} {hasOwn( detailsObj, "pinswg_siteaddressline1" ) ? detailsObj.pinswg_siteaddressline1 : ""} {hasOwn( detailsObj, "pinswg_addressline1" ) ? detailsObj.pinswg_addressline1 : ""} {hasOwn( detailsObj, "pinswg_siteaddressline1" ) && detailsObj.pinswg_siteaddressline1 != null &&
} {hasOwn( detailsObj, "pinswg_addressline1" ) && detailsObj.pinswg_addressline1 != null &&
} {hasOwn( detailsObj, "pinswg_siteaddressline2" ) ? detailsObj.pinswg_siteaddressline2 : ""} {hasOwn( detailsObj, "pinswg_addressline2" ) ? detailsObj.pinswg_addressline2 : ""} {hasOwn( detailsObj, "pinswg_addressline2" ) && detailsObj.pinswg_addressline2 != null &&
} {hasOwn( detailsObj, "pinswg_siteaddresstown" ) ? detailsObj.pinswg_siteaddresstown : ""} {hasOwn( detailsObj, "pinswg_addresstown" ) ? detailsObj.pinswg_addresstown : ""} {hasOwn( detailsObj, "pinswg_siteaddresstown" ) && detailsObj.pinswg_siteaddresstown != null &&
} {hasOwn( detailsObj, "pinswg_addresstown" ) && detailsObj.pinswg_addresstown != null &&
} {hasOwn( detailsObj, "pinswg_siteaddresscounty" ) ? detailsObj.pinswg_siteaddresscounty : ""} {hasOwn( detailsObj, "pinswg_addresscounty" ) ? detailsObj.pinswg_addresscounty : ""} {hasOwn( detailsObj, "pinswg_siteaddresscounty" ) && detailsObj.pinswg_siteaddresscounty != null &&
} {hasOwn( detailsObj, "pinswg_addresscounty" ) && detailsObj.pinswg_addresscounty != null &&
} {hasOwn( detailsObj, "pinswg_siteaddresspostcode" ) ? detailsObj.pinswg_siteaddresspostcode : ""} {hasOwn( detailsObj, "pinswg_postcode" ) ? detailsObj.pinswg_postcode : ""}
)}

{t( "case:summary-eia-screening-heading" )}

{t( "case:summary-eia-screening-start-date-label" )}
{" "}
{hasOwn( detailsObj, "pinswg_screeningstartdate" ) ? !_.isEmpty( detailsObj.pinswg_screeningstartdate ) ? formatDates( detailsObj.pinswg_screeningstartdate ) : t( "case:summary-awaiting-information-label" ) : t( "case:summary-awaiting-information-label" )}
{t( "case:summary-eia-screening-target-date-label" )}
{" "}
{hasOwn( detailsObj, "pinswg_eiatargetdate" ) ? !_.isEmpty( detailsObj.pinswg_eiatargetdate ) ? formatDates( detailsObj.pinswg_eiatargetdate ) : t( "case:summary-awaiting-information-label" ) : t( "case:summary-awaiting-information-label" )}
{hasValidKey( detailsObj, "pinswg_targetextended" ) && (
{t( "case:summary-eia-screening-target-extended-label" )}
{" "}
{hasOwn( detailsObj, "pinswg_targetextended" ) ? !_.isEmpty( detailsObj.pinswg_targetextended ) ? formatDates( detailsObj.pinswg_targetextended ) : t( "case:summary-awaiting-information-label" ) : t( "case:summary-awaiting-information-label" )}
)}
{t( "case:summary-eia-screening-direction-issued-label" )}
{" "}
{hasOwn( detailsObj, "pinswg_directionissueddate" ) ? !_.isEmpty( detailsObj.pinswg_directionissueddate ) ? formatDates( detailsObj.pinswg_directionissueddate ) : t( "case:summary-awaiting-information-label" ) : t( "case:summary-awaiting-information-label" )}
{hasValidKey( detailsObj, "pinswg_eiarequired" ) && (
{t( "case:summary-eia-required-label" )}
{hasOwn( detailsObj, "pinswg_eiarequired" ) ? detailsObj.pinswg_eiarequired ? router.locale == "cy" ? "Ie" : "Yes" : router.locale == "cy" ? "Na" : "No" : t( "case:summary-awaiting-information-label" )}
)}

{t( "case:summary-eia-scoping-heading" )}

{t( "case:summary-eia-scoping-start-date-label" )}
{" "}
{hasOwn( detailsObj, "pinswg_scopingstartdate" ) ? !_.isEmpty( detailsObj.pinswg_scopingstartdate ) ? formatDates( detailsObj.pinswg_scopingstartdate ) : t( "case:summary-awaiting-information-label" ) : t( "case:summary-awaiting-information-label" )}
{t( "case:summary-eia-scoping-target-date-label" )}
{" "}
{hasOwn( detailsObj, "pinswg_scopingtargetdate" ) ? !_.isEmpty( detailsObj.pinswg_scopingtargetdate ) ? formatDates( detailsObj.pinswg_scopingtargetdate ) : t( "case:summary-awaiting-information-label" ) : t( "case:summary-awaiting-information-label" )}
{hasValidKey( detailsObj, "pinswg_scopingtargetextended" ) && (
{t( "case:summary-eia-scoping-target-extended-label" )}
{hasOwn( detailsObj, "pinswg_scopingtargetextended" ) ? !_.isEmpty( detailsObj.pinswg_scopingtargetextended ) ? formatDates( detailsObj.pinswg_scopingtargetextended ) : t( "case:summary-awaiting-information-label" ) : t( "case:summary-awaiting-information-label" )}
)}
{t( "case:summary-eia-scoping-direction-issued-date-label" )}
{" "}
{hasOwn( detailsObj, "pinswg_scopingoutcomeissueddate" ) ? !_.isEmpty( detailsObj.pinswg_scopingoutcomeissueddate ) ? formatDates( detailsObj.pinswg_scopingoutcomeissueddate ) : t( "case:summary-awaiting-information-label" ) : t( "case:summary-awaiting-information-label" )}
{getFormCollectionByID(appealTypeID) .PrimaryIdAttribute == "pinswg_sipscase" && ( )} {hasEventsTabData && (
)} {hasMediaTabData && (
)}
) : ( <>

{t("case:summary-no-details-label")}

{showLoginCheck == "true" && (
{noRepresentationLink.includes( router.pathname ) == true ? ( "" ) : ( {t( "case:summary-make-representation-label" )} )}
)} ); function showSummary( appealTypeID, casesObj, detailsObj, formatDates, linkedCasesList, currentView, showMap ) { const id = getFormCollectionByID( appealTypeID || setCaseQueryObj.value[0].pinswg_appealcasetype ).PrimaryIdAttribute; const Component = CaseTypes[capitalizeFirstLetter(id)]; return Component ? ( ) : null; } const fallbackIncidentId = setCaseQueryObj?.value?.[0]?.incidentid; useEffect(() => { const linkCaseObj = async () => { let docObj = await getLinkedCases( incidentid || fallbackIncidentId ).then((data) => { //console.log(data); setCurrentLinkedCases(data); return data; }); return linkCaseObj; }; const linkedCases = linkCaseObj(); }, [incidentid, fallbackIncidentId, setCurrentLinkedCases]); let now = new Date(); let expDate = new Date(now); expDate.setDate(now.getDate() + 365); function formatDates(dateObj, showTime) { var dateObj = new Date(dateObj); var dd = String(dateObj.getDate()).padStart(2, "0"); var mm = String(dateObj.getMonth() + 1).padStart(2, "0"); //January is 0! var yyyy = dateObj.getFullYear(); var hh = dateObj.getHours(); hh = ("0" + hh).slice(-2); var mins = dateObj.getMinutes(); mins = ("0" + mins).slice(-2); const dateStr = showTime ? hh == 0 && mins == 0 ? "" : hh + ":" + mins : dd + "/" + mm + "/" + yyyy + " "; return dateStr; } function linkedCasesList(linkedCasesReference) { //console.log(linkedCasesReference); linkedCasesReference = linkedCasesReference.value || []; return ( <> ); } if (status == "authenticated" && cookies.pedwWatchCase != null) { selectWatchedCase( props.accountDetails.accountDetails.contactid, incidentid, appealTypeID ); destroyCookie({}, "pedwWatchCase", { path: "/" }); } return <>{showDetailsBlock}; }; const mapStateToProps = (state) => { return { accountDetails: state.accountDetails, currentView: state.currentView, search: state.search, // searchResultsObj: state.searchResultsObj, documentDetailsObj: state.searchResultsObj.documentDetailsObj, formData: state.formData, appealType: state.appealType, form: state.form, myCases: state.myCases, watchedCases: state.watchedCases, myRepresentations: state.myRepresentations, awaitingSubmission: state.awaitingSubmission, mySubmittedReps: state.myRepresentations.mySubmittedReps }; }; const mapDispatchToProps = (dispatch) => { return { setCurrentLinkedCases: (parentIncidentid) => { dispatch(setCurrentLinkedCases(parentIncidentid)); }, setCurrentReference: (currentReference) => { dispatch(setCurrentReference(currentReference)); }, setWatchedCases: (watchedCases) => { dispatch(setWatchedCases(watchedCases)); }, setWatchedCasesDetails: (watchedCasesDetails) => { dispatch(setWatchedCasesDetails(watchedCasesDetails)); }, setCurrentView: (currentView) => { dispatch(setCurrentView(currentView)); } }; }; export default connect(mapStateToProps, mapDispatchToProps)(CaseSummary);