diff --git a/components/case/summaryTypes/pinswg_advertsid.js b/components/case/summaryTypes/pinswg_advertsid.js index fc899e68..15f4e299 100644 --- a/components/case/summaryTypes/pinswg_advertsid.js +++ b/components/case/summaryTypes/pinswg_advertsid.js @@ -5,6 +5,7 @@ import { useRouter } from "next/router"; import transLookup from "../../../data/lookuptranslations.json"; import SummaryCard from "../summary/components/SummaryCard"; import SummaryRow from "../summary/components/SummaryRow"; +import { getCaseLpaDisplayLines } from "../../utils/getCaseLpaDisplayValue"; const Pinswg_advertsid = (props) => { let { t } = useTranslation(); @@ -64,20 +65,16 @@ const Pinswg_advertsid = (props) => { + {getCaseLpaDisplayLines({ + casesObj, + detailsObj, + locale: router.locale, + transLookup + }).map((name) => ( +
{name}
+ ))} + } /> { let { t } = useTranslation(); @@ -43,20 +44,16 @@ const Pinswg_callinss77id = (props) => { + {getCaseLpaDisplayLines({ + casesObj, + detailsObj, + locale: router.locale, + transLookup + }).map((name) => ( +
{name}
+ ))} + } /> { let { t } = useTranslation(); @@ -43,20 +44,16 @@ const Pinswg_commonlandid = (props) => { + {getCaseLpaDisplayLines({ + casesObj, + detailsObj, + locale: router.locale, + transLookup + }).map((name) => ( +
{name}
+ ))} + } /> { let { t } = useTranslation(); @@ -43,20 +44,16 @@ const Pinswg_communityinfrastructurelevyid = (props) => { + {getCaseLpaDisplayLines({ + casesObj, + detailsObj, + locale: router.locale, + transLookup + }).map((name) => ( +
{name}
+ ))} + } /> { point = new OSPoint( detailsObj.pinswg_anticipatedgridreferencenorthingtext, - detailsObj.pinswg_anticipatedgridreferenceeastingtext, + detailsObj.pinswg_anticipatedgridreferenceeastingtext ); siteCoords = point.toOSGB36(); //console.log(siteCoords); @@ -35,7 +36,7 @@ const Pinswg_dnsid = (props) => { : parseFloat(siteCoords.latitude), lng: isNaN(parseFloat(siteCoords.longitude)) ? -3.437989 - : parseFloat(siteCoords.longitude), + : parseFloat(siteCoords.longitude) }; const zoom = isNaN(parseFloat(siteCoords.latitude)) ? 7 : 12; @@ -58,7 +59,7 @@ const Pinswg_dnsid = (props) => {

{getBilingualText( detailsObj.pinswg_projectdescription, - router.locale, + router.locale )}

@@ -67,7 +68,7 @@ const Pinswg_dnsid = (props) => {
{
{ ] + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : casesObj[ "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" ] || t( - "case:summary-no-date-entered-label", + "case:summary-no-date-entered-label" ) - } - /> {detailsObj.pinswg_webaddress != null && ( { detailsObj.pinswg_webaddress + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : ( { rel="noreferrer" href={ detailsObj.pinswg_webaddress.indexOf( - "https://", + "https://" ) ? "https://" + detailsObj.pinswg_webaddress @@ -159,45 +154,31 @@ const Pinswg_dnsid = (props) => { ) || t( - "case:summary-no-date-entered-label", + "case:summary-no-date-entered-label" ) - } - /> )} + {getCaseLpaDisplayLines({ + casesObj, + detailsObj, + locale: router.locale, + transLookup + }).map((name) => ( +
{name}
+ ))} + } - /> { "pinswg_eiarequired@OData.Community.Display.V1.FormattedValue" ] + '")].value_cy', - transLookup, + transLookup ) : detailsObj[ "pinswg_eiarequired@OData.Community.Display.V1.FormattedValue" ] || t( - "case:summary-to-be-confirmed-label", + "case:summary-to-be-confirmed-label" ) - } - /> { ] + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : detailsObj[ "pinswg_choiceofprocedure@OData.Community.Display.V1.FormattedValue" ] || t( - "case:summary-to-be-confirmed-label", + "case:summary-to-be-confirmed-label" ) - } - /> {/* { } /> */} { ] + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : detailsObj[ "pinswg_typeofevent@OData.Community.Display.V1.FormattedValue" ] || "" - } - />
@@ -370,13 +333,13 @@ const Pinswg_dnsid = (props) => { ] + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : detailsObj[ "pinswg_decision@OData.Community.Display.V1.FormattedValue" ] || t( - "case:summary-no-information-to-date-label", + "case:summary-no-information-to-date-label" )}
@@ -389,54 +352,49 @@ const Pinswg_dnsid = (props) => {
{casesObj.numberofchildincidents > 0 && (
{t( - "case:summary-case-link-status-label", + "case:summary-case-link-status-label" )}
{_.has(casesObj, [ - "numberofchildincidents", + "numberofchildincidents" ]) ? casesObj.numberofchildincidents > 0 ? t( - "case:summary-case-link-status-linked", + "case:summary-case-link-status-linked" ) : t( - "case:summary-case-link-status-not-linked", + "case:summary-case-link-status-not-linked" ) : t( - "case:summary-case-link-status-not-linked", + "case:summary-case-link-status-not-linked" )}
@@ -445,13 +403,13 @@ const Pinswg_dnsid = (props) => {
{t( - "case:summary-linked-cases-label", + "case:summary-linked-cases-label" )}
{linkedCasesList( props.currentView - .linkedCaseReferences, + .linkedCaseReferences )}
@@ -509,370 +467,305 @@ const Pinswg_dnsid = (props) => { } /> */} {_.has( detailsObj, - "pinswg_applicationacceptedasvalid", + "pinswg_applicationacceptedasvalid" ) && !_.isEmpty( - detailsObj.pinswg_applicationrejectedasinvalid, + detailsObj.pinswg_applicationrejectedasinvalid ) && ( )} {_.has( detailsObj, - "pinswg_applicationrejectedasinvalid", + "pinswg_applicationrejectedasinvalid" ) && !_.isEmpty( - detailsObj.pinswg_applicationrejectedasinvalid, + detailsObj.pinswg_applicationrejectedasinvalid ) && ( )} {_.has( detailsObj, - "pinswg_dateofrequesttovarytheapplication", + "pinswg_dateofrequesttovarytheapplication" ) && !_.isEmpty( - detailsObj.pinswg_dateofrequesttovarytheapplication, + detailsObj.pinswg_dateofrequesttovarytheapplication ) && ( )} {_.has( detailsObj, - "pinswg_confirmrequesttovaryapplication", + "pinswg_confirmrequesttovaryapplication" ) && !_.isEmpty( - detailsObj.pinswg_confirmrequesttovaryapplication, + detailsObj.pinswg_confirmrequesttovaryapplication ) && (_.has( detailsObj, - "pinswg_rejectrequesttovaryapplication", + "pinswg_rejectrequesttovaryapplication" ) && _.isEmpty( - detailsObj.pinswg_rejectrequesttovaryapplication, + detailsObj.pinswg_rejectrequesttovaryapplication ) ? ( ) : ( "" ))} {_.has( detailsObj, - "pinswg_rejectrequesttovaryapplication", + "pinswg_rejectrequesttovaryapplication" ) && !_.isEmpty( - detailsObj.pinswg_rejectrequesttovaryapplication, + detailsObj.pinswg_rejectrequesttovaryapplication ) && (_.has( detailsObj, - "pinswg_confirmrequesttovaryapplication", + "pinswg_confirmrequesttovaryapplication" ) && _.isEmpty( - detailsObj.pinswg_confirmrequesttovaryapplication, + detailsObj.pinswg_confirmrequesttovaryapplication ) ? ( ) : ( "" ))} {_.has( detailsObj, - "pinswg_suspensionstartdates", + "pinswg_suspensionstartdates" ) && !_.isEmpty( - detailsObj.pinswg_suspensionstartdates, + detailsObj.pinswg_suspensionstartdates ) && ( )} {/* { } /> */} {_.has( detailsObj, - "pinswg_withdrawndate", + "pinswg_withdrawndate" ) && !_.isEmpty( - detailsObj.pinswg_withdrawndate, + detailsObj.pinswg_withdrawndate ) && ( )}
diff --git a/components/case/summaryTypes/pinswg_electricityactid.js b/components/case/summaryTypes/pinswg_electricityactid.js index c5b862bb..c4ba9e7c 100644 --- a/components/case/summaryTypes/pinswg_electricityactid.js +++ b/components/case/summaryTypes/pinswg_electricityactid.js @@ -5,6 +5,7 @@ import { useRouter } from "next/router"; import transLookup from "../../../data/lookuptranslations.json"; import SummaryCard from "../summary/components/SummaryCard"; import SummaryRow from "../summary/components/SummaryRow"; +import { getCaseLpaDisplayLines } from "../../utils/getCaseLpaDisplayValue"; const Pinswg_electricityactid = (props) => { let { t } = useTranslation(); @@ -62,11 +63,10 @@ const Pinswg_electricityactid = (props) => {
{ ] + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : casesObj[ "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" @@ -84,42 +84,28 @@ const Pinswg_electricityactid = (props) => { t( "case:summary-no-date-entered-label" ) - } - /> + {getCaseLpaDisplayLines({ + casesObj, + detailsObj, + locale: router.locale, + transLookup + }).map((name) => ( +
{name}
+ ))} + } - /> { t( "case:summary-to-be-confirmed-label" ) - } - />
@@ -157,11 +141,10 @@ const Pinswg_electricityactid = (props) => {
{ ] + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : detailsObj[ "pinswg_procedure@OData.Community.Display.V1.FormattedValue" ] || "" - } - /> { ] + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : detailsObj[ "pinswg_typeofevent@OData.Community.Display.V1.FormattedValue" ] || "" - } - /> { ] + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : casesObj[ "statuscode@OData.Community.Display.V1.FormattedValue" @@ -229,9 +202,7 @@ const Pinswg_electricityactid = (props) => { t( "case:summary-no-date-entered-label" ) - } - />
@@ -247,7 +218,7 @@ const Pinswg_electricityactid = (props) => { ] + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : detailsObj[ "pinswg_decision@OData.Community.Display.V1.FormattedValue" @@ -274,7 +245,7 @@ const Pinswg_electricityactid = (props) => {
{_.has(casesObj, [ - "numberofchildincidents", + "numberofchildincidents" ]) ? casesObj.numberofchildincidents > 0 @@ -308,13 +279,10 @@ const Pinswg_electricityactid = (props) => { "" )} { detailsObj.pinswg_recommendation + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : detailsObj.pinswg_recommendation || t( "case:summary-no-date-entered-label" ) - } - /> {detailsObj.pinswg_webaddress != null && ( { detailsObj.pinswg_webaddress + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : detailsObj.pinswg_webaddress || t( "case:summary-no-date-entered-label" ) - } - /> )}
@@ -371,11 +332,10 @@ const Pinswg_electricityactid = (props) => {
{ : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - - } - - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - />
diff --git a/components/case/summaryTypes/pinswg_enforcementlistedbuildingconseid.js b/components/case/summaryTypes/pinswg_enforcementlistedbuildingconseid.js index e4da5a54..0002b178 100644 --- a/components/case/summaryTypes/pinswg_enforcementlistedbuildingconseid.js +++ b/components/case/summaryTypes/pinswg_enforcementlistedbuildingconseid.js @@ -5,6 +5,7 @@ import { useRouter } from "next/router"; import transLookup from "../../../data/lookuptranslations.json"; import SummaryCard from "../summary/components/SummaryCard"; import SummaryRow from "../summary/components/SummaryRow"; +import { getCaseLpaDisplayLines } from "../../utils/getCaseLpaDisplayValue"; const Pinswg_enforcementlistedbuildingconseid = (props) => { let { t } = useTranslation(); @@ -43,20 +44,16 @@ const Pinswg_enforcementlistedbuildingconseid = (props) => { + {getCaseLpaDisplayLines({ + casesObj, + detailsObj, + locale: router.locale, + transLookup + }).map((name) => ( +
{name}
+ ))} + } /> { let { t } = useTranslation(); @@ -20,208 +21,184 @@ const Pinswg_enforcementnoticeappeals174id = (props) => { title={t("case:summary-case-details-label")} >
- - - + + {getCaseLpaDisplayLines({ + casesObj, + detailsObj, + locale: router.locale, + transLookup + }).map((name) => ( +
{name}
+ ))} + + } + /> + - + - + - + -
-
- {t("case:summary-decision-label")} -
-
- {router.locale == "cy" - ? jsonpath({ - path: - '$..[?(@ && @.value=="' + - detailsObj[ - "pinswg_decision@OData.Community.Display.V1.FormattedValue" - ] + - '")].value_cy', - json: transLookup, - eval: true, - }) - : detailsObj[ + ] + + '")].value_cy', + json: transLookup, + eval: true + }) + : casesObj[ + "statuscode@OData.Community.Display.V1.FormattedValue" + ] || + t("case:summary-no-date-entered-label") + } + /> +
+
+ {t("case:summary-decision-label")} +
+
+ {router.locale == "cy" + ? jsonpath({ + path: + '$..[?(@ && @.value=="' + + detailsObj[ "pinswg_decision@OData.Community.Display.V1.FormattedValue" - ] || - t( - "case:summary-no-information-to-date-label" - )} + ] + + '")].value_cy', + json: transLookup, + eval: true + }) + : detailsObj[ + "pinswg_decision@OData.Community.Display.V1.FormattedValue" + ] || + t( + "case:summary-no-information-to-date-label" + )} -
- {/* +
+ {/* {casesObj.caseDetails .outcome_document || ""} */} -
-
- {casesObj.numberofchildincidents > 0 && ( -
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
- )} - {casesObj.numberofchildincidents > 0 ? ( -
-
- {t( - "case:summary-linked-cases-label" - )} -
-
- {linkedCasesList( - props.currentView - .linkedCaseReferences - )} -
-
- ) : ( - "" - )} -
+ + + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t("case:summary-case-link-status-label")} +
+
+ {_.has(casesObj, ["numberofchildincidents"]) + ? casesObj.numberofchildincidents > 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + )} +
+
+ )} + {casesObj.numberofchildincidents > 0 ? ( +
+
+ {t("case:summary-linked-cases-label")} +
+
+ {linkedCasesList( + props.currentView.linkedCaseReferences + )} +
+
+ ) : ( + "" + )} + { headingTag="h3" >
- - label={t("case:summary-start-date-label")} + - value={_.has(detailsObj, "pinswg_startdate") - ? !_.isEmpty( - detailsObj.pinswg_startdate - ) - ? formatDates( - detailsObj.pinswg_startdate - ) - : t( - "case:summary-no-date-entered-label" - ) - : _.has( - detailsObj, - "pinswg_startdates" - ) - ? !_.isEmpty( - detailsObj.pinswg_startdates - ) - ? formatDates( - detailsObj.pinswg_startdates - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} + - /> - - - - - - /> - - - - - {/* + {/* { "case:summary-no-date-entered-label" )} /> */} - - label={t("case:summary-event-date-label")} - - value={_.has( - detailsObj, - "pinswg_dateeventrequested" - ) - ? !_.isEmpty( - detailsObj.pinswg_dateeventrequested - ) - ? formatDates( - detailsObj.pinswg_dateeventrequested - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} - - /> - - - -
+ + +
diff --git a/components/case/summaryTypes/pinswg_environmentalpermittingid.js b/components/case/summaryTypes/pinswg_environmentalpermittingid.js index f05ea672..1c187aa0 100644 --- a/components/case/summaryTypes/pinswg_environmentalpermittingid.js +++ b/components/case/summaryTypes/pinswg_environmentalpermittingid.js @@ -5,6 +5,7 @@ import { useRouter } from "next/router"; import transLookup from "../../../data/lookuptranslations.json"; import SummaryCard from "../summary/components/SummaryCard"; import SummaryRow from "../summary/components/SummaryRow"; +import { getCaseLpaDisplayLines } from "../../utils/getCaseLpaDisplayValue"; const Pinswg_environmentalpermittingid = (props) => { let { t } = useTranslation(); @@ -20,236 +21,209 @@ const Pinswg_environmentalpermittingid = (props) => { title={t("case:summary-case-details-label")} >
- - - + + {getCaseLpaDisplayLines({ + casesObj, + detailsObj, + locale: router.locale, + transLookup + }).map((name) => ( +
{name}
+ ))} + + } + /> + - + - + - + -
-
- {t("case:summary-decision-label")} -
-
- {router.locale == "cy" - ? jsonpath({ - path: - '$..[?(@ && @.value=="' + - detailsObj[ - "pinswg_decision@OData.Community.Display.V1.FormattedValue" - ] + - '")].value_cy', - json: transLookup, - eval: true, - }) - : detailsObj[ + ] + + '")].value_cy', + json: transLookup, + eval: true + }) + : casesObj[ + "statuscode@OData.Community.Display.V1.FormattedValue" + ] || + t("case:summary-no-date-entered-label") + } + /> +
+
+ {t("case:summary-decision-label")} +
+
+ {router.locale == "cy" + ? jsonpath({ + path: + '$..[?(@ && @.value=="' + + detailsObj[ "pinswg_decision@OData.Community.Display.V1.FormattedValue" - ] || - t( - "case:summary-no-information-to-date-label" - )} + ] + + '")].value_cy', + json: transLookup, + eval: true + }) + : detailsObj[ + "pinswg_decision@OData.Community.Display.V1.FormattedValue" + ] || + t( + "case:summary-no-information-to-date-label" + )} -
- {/* +
+ {/* {casesObj.caseDetails .outcome_document || ""} */} -
-
- {casesObj.numberofchildincidents > 0 && ( -
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
- )} - {casesObj.numberofchildincidents > 0 ? ( -
-
- {t( - "case:summary-linked-cases-label" - )} -
-
- {linkedCasesList( - props.currentView - .linkedCaseReferences - )} -
-
- ) : ( - "" - )} - -
+ + + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t("case:summary-case-link-status-label")} +
+
+ {_.has(casesObj, ["numberofchildincidents"]) + ? casesObj.numberofchildincidents > 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + )} +
+
+ )} + {casesObj.numberofchildincidents > 0 ? ( +
+
+ {t("case:summary-linked-cases-label")} +
+
+ {linkedCasesList( + props.currentView.linkedCaseReferences + )} +
+
+ ) : ( + "" + )} + + { headingTag="h3" >
- - label={t("case:summary-start-date-label")} + - value={_.has(detailsObj, "pinswg_startdate") - ? !_.isEmpty( - detailsObj.pinswg_startdate - ) - ? formatDates( - detailsObj.pinswg_startdate - ) - : t( - "case:summary-no-date-entered-label" - ) - : _.has( - detailsObj, - "pinswg_startdates" - ) - ? !_.isEmpty( - detailsObj.pinswg_startdates - ) - ? formatDates( - detailsObj.pinswg_startdates - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} + - /> - - - - - - /> - - - - - {/* + {/* { "case:summary-no-date-entered-label" )} /> */} - - label={t("case:summary-event-date-label")} - - value={_.has( - detailsObj, - "pinswg_dateeventrequested" - ) - ? !_.isEmpty( - detailsObj.pinswg_dateeventrequested - ) - ? formatDates( - detailsObj.pinswg_dateeventrequested - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} - - /> - - - -
+ + +
diff --git a/components/case/summaryTypes/pinswg_harbourrevisionorderid.js b/components/case/summaryTypes/pinswg_harbourrevisionorderid.js index 761bc8b8..33e59bf5 100644 --- a/components/case/summaryTypes/pinswg_harbourrevisionorderid.js +++ b/components/case/summaryTypes/pinswg_harbourrevisionorderid.js @@ -5,6 +5,7 @@ import { useRouter } from "next/router"; import transLookup from "../../../data/lookuptranslations.json"; import SummaryCard from "../summary/components/SummaryCard"; import SummaryRow from "../summary/components/SummaryRow"; +import { getCaseLpaDisplayLines } from "../../utils/getCaseLpaDisplayValue"; const Pinswg_harbourrevisionorderid = (props) => { let { t } = useTranslation(); @@ -62,11 +63,10 @@ const Pinswg_harbourrevisionorderid = (props) => {
{ ] + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : casesObj[ "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" @@ -84,42 +84,28 @@ const Pinswg_harbourrevisionorderid = (props) => { t( "case:summary-no-date-entered-label" ) - } - /> + {getCaseLpaDisplayLines({ + casesObj, + detailsObj, + locale: router.locale, + transLookup + }).map((name) => ( +
{name}
+ ))} + } - /> { t( "case:summary-to-be-confirmed-label" ) - } - />
@@ -157,11 +141,10 @@ const Pinswg_harbourrevisionorderid = (props) => {
{ ] + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : detailsObj[ "pinswg_procedure@OData.Community.Display.V1.FormattedValue" ] || "" - } - /> { ] + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : casesObj[ "statuscode@OData.Community.Display.V1.FormattedValue" @@ -203,9 +181,7 @@ const Pinswg_harbourrevisionorderid = (props) => { t( "case:summary-no-date-entered-label" ) - } - />
@@ -221,7 +197,7 @@ const Pinswg_harbourrevisionorderid = (props) => { ] + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : detailsObj[ "pinswg_decision@OData.Community.Display.V1.FormattedValue" @@ -248,7 +224,7 @@ const Pinswg_harbourrevisionorderid = (props) => {
{_.has(casesObj, [ - "numberofchildincidents", + "numberofchildincidents" ]) ? casesObj.numberofchildincidents > 0 @@ -282,13 +258,10 @@ const Pinswg_harbourrevisionorderid = (props) => { "" )} { detailsObj.pinswg_recommendation + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : detailsObj.pinswg_recommendation || t( "case:summary-no-date-entered-label" ) - } - /> {detailsObj.pinswg_webaddress != null && ( { detailsObj.pinswg_webaddress + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : detailsObj.pinswg_webaddress || t( "case:summary-no-date-entered-label" ) - } - /> )}
@@ -345,11 +311,10 @@ const Pinswg_harbourrevisionorderid = (props) => {
{ : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - - } - - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - /> { : t( "case:summary-no-date-entered-label" ) - } - />
diff --git a/components/case/summaryTypes/pinswg_hedgeshedgerowstreepreservatioid.js b/components/case/summaryTypes/pinswg_hedgeshedgerowstreepreservatioid.js index 4f3c1222..a8d9b7e1 100644 --- a/components/case/summaryTypes/pinswg_hedgeshedgerowstreepreservatioid.js +++ b/components/case/summaryTypes/pinswg_hedgeshedgerowstreepreservatioid.js @@ -5,6 +5,7 @@ import { useRouter } from "next/router"; import transLookup from "../../../data/lookuptranslations.json"; import SummaryCard from "../summary/components/SummaryCard"; import SummaryRow from "../summary/components/SummaryRow"; +import { getCaseLpaDisplayLines } from "../../utils/getCaseLpaDisplayValue"; const Pinswg_hedgeshedgerowstreepreservatioid = (props) => { let { t } = useTranslation(); @@ -20,264 +21,230 @@ const Pinswg_hedgeshedgerowstreepreservatioid = (props) => { title={t("case:summary-case-details-label")} >
- - /> - - - - /> - - - + {getCaseLpaDisplayLines({ + casesObj, + detailsObj, + locale: router.locale, + transLookup + }).map((name) => ( +
{name}
+ ))} + + } + /> + - + - + - + -
-
- {t("case:summary-decision-label")} -
-
- {router.locale == "cy" - ? jsonpath({ - path: - '$..[?(@ && @.value=="' + - detailsObj[ - "pinswg_decision@OData.Community.Display.V1.FormattedValue" - ] + - '")].value_cy', - json: transLookup, - eval: true, - }) - : detailsObj[ + ] + + '")].value_cy', + json: transLookup, + eval: true + }) + : casesObj[ + "statuscode@OData.Community.Display.V1.FormattedValue" + ] || + t("case:summary-no-date-entered-label") + } + /> +
+
+ {t("case:summary-decision-label")} +
+
+ {router.locale == "cy" + ? jsonpath({ + path: + '$..[?(@ && @.value=="' + + detailsObj[ "pinswg_decision@OData.Community.Display.V1.FormattedValue" - ] || - t( - "case:summary-no-information-to-date-label" - )} + ] + + '")].value_cy', + json: transLookup, + eval: true + }) + : detailsObj[ + "pinswg_decision@OData.Community.Display.V1.FormattedValue" + ] || + t( + "case:summary-no-information-to-date-label" + )} -
- {/* +
+ {/* {casesObj.caseDetails .outcome_document || ""} */} -
-
- {casesObj.numberofchildincidents > 0 && ( -
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
- )} - {casesObj.numberofchildincidents > 0 ? ( -
-
- {t( - "case:summary-linked-cases-label" - )} -
-
- {linkedCasesList( - props.currentView - .linkedCaseReferences - )} -
-
- ) : ( - "" - )} - -
+ + + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t("case:summary-case-link-status-label")} +
+
+ {_.has(casesObj, ["numberofchildincidents"]) + ? casesObj.numberofchildincidents > 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + )} +
+
+ )} + {casesObj.numberofchildincidents > 0 ? ( +
+
+ {t("case:summary-linked-cases-label")} +
+
+ {linkedCasesList( + props.currentView.linkedCaseReferences + )} +
+
+ ) : ( + "" + )} + + { headingTag="h3" >
- - label={t("case:summary-start-date-label")} + - value={_.has(detailsObj, "pinswg_startdate") - ? !_.isEmpty( - detailsObj.pinswg_startdate - ) - ? formatDates( - detailsObj.pinswg_startdate - ) - : t( - "case:summary-no-date-entered-label" - ) - : _.has( - detailsObj, - "pinswg_startdates" - ) - ? !_.isEmpty( - detailsObj.pinswg_startdates - ) - ? formatDates( - detailsObj.pinswg_startdates - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} + - /> - - - - - - /> - - - - - {/* + {/* { "case:summary-no-date-entered-label" )} /> */} - - label={t("case:summary-event-date-label")} - - value={_.has( - detailsObj, - "pinswg_dateeventrequested" - ) - ? !_.isEmpty( - detailsObj.pinswg_dateeventrequested - ) - ? formatDates( - detailsObj.pinswg_dateeventrequested - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} - - /> - - - -
+ + +
diff --git a/components/case/summaryTypes/pinswg_householderappealhasid.js b/components/case/summaryTypes/pinswg_householderappealhasid.js index e6ebeff8..08efd379 100644 --- a/components/case/summaryTypes/pinswg_householderappealhasid.js +++ b/components/case/summaryTypes/pinswg_householderappealhasid.js @@ -5,6 +5,7 @@ import { useRouter } from "next/router"; import transLookup from "../../../data/lookuptranslations.json"; import SummaryCard from "../summary/components/SummaryCard"; import SummaryRow from "../summary/components/SummaryRow"; +import { getCaseLpaDisplayLines } from "../../utils/getCaseLpaDisplayValue"; const Pinswg_householderappealhasid = (props) => { let { t } = useTranslation(); @@ -43,20 +44,16 @@ const Pinswg_householderappealhasid = (props) => { + {getCaseLpaDisplayLines({ + casesObj, + detailsObj, + locale: router.locale, + transLookup + }).map((name) => ( +
{name}
+ ))} + } /> { let { t } = useTranslation(); @@ -20,208 +21,184 @@ const Pinswg_lawfuldevelopmentcertificatappid = (props) => { title={t("case:summary-case-details-label")} >
- - - + + {getCaseLpaDisplayLines({ + casesObj, + detailsObj, + locale: router.locale, + transLookup + }).map((name) => ( +
{name}
+ ))} + + } + /> + - + - + - + -
-
- {t("case:summary-decision-label")} -
-
- {router.locale == "cy" - ? jsonpath({ - path: - '$..[?(@ && @.value=="' + - detailsObj[ - "pinswg_decision@OData.Community.Display.V1.FormattedValue" - ] + - '")].value_cy', - json: transLookup, - eval: true, - }) - : detailsObj[ + ] + + '")].value_cy', + json: transLookup, + eval: true + }) + : casesObj[ + "statuscode@OData.Community.Display.V1.FormattedValue" + ] || + t("case:summary-no-date-entered-label") + } + /> +
+
+ {t("case:summary-decision-label")} +
+
+ {router.locale == "cy" + ? jsonpath({ + path: + '$..[?(@ && @.value=="' + + detailsObj[ "pinswg_decision@OData.Community.Display.V1.FormattedValue" - ] || - t( - "case:summary-no-information-to-date-label" - )} + ] + + '")].value_cy', + json: transLookup, + eval: true + }) + : detailsObj[ + "pinswg_decision@OData.Community.Display.V1.FormattedValue" + ] || + t( + "case:summary-no-information-to-date-label" + )} -
- {/* +
+ {/* {casesObj.caseDetails .outcome_document || ""} */} -
-
- {casesObj.numberofchildincidents > 0 && ( -
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
- )} - {casesObj.numberofchildincidents > 0 ? ( -
-
- {t( - "case:summary-linked-cases-label" - )} -
-
- {linkedCasesList( - props.currentView - .linkedCaseReferences - )} -
-
- ) : ( - "" - )} -
+ + + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t("case:summary-case-link-status-label")} +
+
+ {_.has(casesObj, ["numberofchildincidents"]) + ? casesObj.numberofchildincidents > 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + )} +
+
+ )} + {casesObj.numberofchildincidents > 0 ? ( +
+
+ {t("case:summary-linked-cases-label")} +
+
+ {linkedCasesList( + props.currentView.linkedCaseReferences + )} +
+
+ ) : ( + "" + )} + { headingTag="h3" >
- - label={t("case:summary-start-date-label")} + - value={_.has(detailsObj, "pinswg_startdate") - ? !_.isEmpty( - detailsObj.pinswg_startdate - ) - ? formatDates( - detailsObj.pinswg_startdate - ) - : t( - "case:summary-no-date-entered-label" - ) - : _.has( - detailsObj, - "pinswg_startdates" - ) - ? !_.isEmpty( - detailsObj.pinswg_startdates - ) - ? formatDates( - detailsObj.pinswg_startdates - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} + - /> - - - - - - /> - - - - - {/* + {/* { "case:summary-no-date-entered-label" )} /> */} - - label={t("case:summary-event-date-label")} - - value={_.has( - detailsObj, - "pinswg_dateeventrequested" - ) - ? !_.isEmpty( - detailsObj.pinswg_dateeventrequested - ) - ? formatDates( - detailsObj.pinswg_dateeventrequested - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} - - /> - - - -
+ + +
diff --git a/components/case/summaryTypes/pinswg_ldpid.js b/components/case/summaryTypes/pinswg_ldpid.js index 998e0177..38473121 100644 --- a/components/case/summaryTypes/pinswg_ldpid.js +++ b/components/case/summaryTypes/pinswg_ldpid.js @@ -5,6 +5,7 @@ import { useRouter } from "next/router"; import transLookup from "../../../data/lookuptranslations.json"; import SummaryCard from "../summary/components/SummaryCard"; import SummaryRow from "../summary/components/SummaryRow"; +import { getCaseLpaDisplayLines } from "../../utils/getCaseLpaDisplayValue"; const Pinswg_ldpid = (props) => { let { t } = useTranslation(); @@ -20,191 +21,167 @@ const Pinswg_ldpid = (props) => { title={t("case:summary-case-details-label")} >
- + + {getCaseLpaDisplayLines({ + casesObj, + detailsObj, + locale: router.locale, + transLookup + }).map((name) => ( +
{name}
+ ))} + + } + /> - /> - - - - + - + -
-
- {t("case:summary-decision-label")} -
-
- {router.locale == "cy" - ? jsonpath({ - path: - '$..[?(@ && @.value=="' + - detailsObj[ - "pinswg_decision@OData.Community.Display.V1.FormattedValue" - ] + - '")].value_cy', - json: transLookup, - eval: true, - }) - : detailsObj[ + ] + + '")].value_cy', + json: transLookup, + eval: true + }) + : casesObj[ + "statuscode@OData.Community.Display.V1.FormattedValue" + ] || + t("case:summary-no-date-entered-label") + } + /> +
+
+ {t("case:summary-decision-label")} +
+
+ {router.locale == "cy" + ? jsonpath({ + path: + '$..[?(@ && @.value=="' + + detailsObj[ "pinswg_decision@OData.Community.Display.V1.FormattedValue" - ] || - t( - "case:summary-no-information-to-date-label" - )} + ] + + '")].value_cy', + json: transLookup, + eval: true + }) + : detailsObj[ + "pinswg_decision@OData.Community.Display.V1.FormattedValue" + ] || + t( + "case:summary-no-information-to-date-label" + )} -
- {/* +
+ {/* {casesObj.caseDetails .outcome_document || ""} */} -
-
- {casesObj.numberofchildincidents > 0 && ( -
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
- )} - {casesObj.numberofchildincidents > 0 ? ( -
-
- {t( - "case:summary-linked-cases-label" - )} -
-
- {linkedCasesList( - props.currentView - .linkedCaseReferences - )} -
-
- ) : ( - "" - )} -
+ + + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t("case:summary-case-link-status-label")} +
+
+ {_.has(casesObj, ["numberofchildincidents"]) + ? casesObj.numberofchildincidents > 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + )} +
+
+ )} + {casesObj.numberofchildincidents > 0 ? ( +
+
+ {t("case:summary-linked-cases-label")} +
+
+ {linkedCasesList( + props.currentView.linkedCaseReferences + )} +
+
+ ) : ( + "" + )} + { headingTag="h3" >
- - label={t("case:summary-start-date-label")} + - value={_.has(detailsObj, "pinswg_startdate") - ? !_.isEmpty( - detailsObj.pinswg_startdate - ) - ? formatDates( - detailsObj.pinswg_startdate - ) - : t( - "case:summary-no-date-entered-label" - ) - : _.has( - detailsObj, - "pinswg_startdates" - ) - ? !_.isEmpty( - detailsObj.pinswg_startdates - ) - ? formatDates( - detailsObj.pinswg_startdates - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} + - /> - - - - - - /> - - - - - {/* + {/* { "case:summary-no-date-entered-label" )} /> */} - - label={t("case:summary-event-date-label")} - - value={_.has( - detailsObj, - "pinswg_dateeventrequested" - ) - ? !_.isEmpty( - detailsObj.pinswg_dateeventrequested - ) - ? formatDates( - detailsObj.pinswg_dateeventrequested - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} - - /> - - - -
+ + +
diff --git a/components/case/summaryTypes/pinswg_listedbuildingandconservationrid.js b/components/case/summaryTypes/pinswg_listedbuildingandconservationrid.js index 112ecd17..4129fd69 100644 --- a/components/case/summaryTypes/pinswg_listedbuildingandconservationrid.js +++ b/components/case/summaryTypes/pinswg_listedbuildingandconservationrid.js @@ -5,6 +5,7 @@ import { useRouter } from "next/router"; import transLookup from "../../../data/lookuptranslations.json"; import SummaryCard from "../summary/components/SummaryCard"; import SummaryRow from "../summary/components/SummaryRow"; +import { getCaseLpaDisplayLines } from "../../utils/getCaseLpaDisplayValue"; const Pinswg_listedbuildingandconservationrid = (props) => { let { t } = useTranslation(); @@ -20,208 +21,184 @@ const Pinswg_listedbuildingandconservationrid = (props) => { title={t("case:summary-case-details-label")} >
- - - + + {getCaseLpaDisplayLines({ + casesObj, + detailsObj, + locale: router.locale, + transLookup + }).map((name) => ( +
{name}
+ ))} + + } + /> + - + - + - + -
-
- {t("case:summary-decision-label")} -
-
- {router.locale == "cy" - ? jsonpath({ - path: - '$..[?(@ && @.value=="' + - detailsObj[ - "pinswg_decision@OData.Community.Display.V1.FormattedValue" - ] + - '")].value_cy', - json: transLookup, - eval: true, - }) - : detailsObj[ + ] + + '")].value_cy', + json: transLookup, + eval: true + }) + : casesObj[ + "statuscode@OData.Community.Display.V1.FormattedValue" + ] || + t("case:summary-no-date-entered-label") + } + /> +
+
+ {t("case:summary-decision-label")} +
+
+ {router.locale == "cy" + ? jsonpath({ + path: + '$..[?(@ && @.value=="' + + detailsObj[ "pinswg_decision@OData.Community.Display.V1.FormattedValue" - ] || - t( - "case:summary-no-information-to-date-label" - )} + ] + + '")].value_cy', + json: transLookup, + eval: true + }) + : detailsObj[ + "pinswg_decision@OData.Community.Display.V1.FormattedValue" + ] || + t( + "case:summary-no-information-to-date-label" + )} -
- {/* +
+ {/* {casesObj.caseDetails .outcome_document || ""} */} -
-
- {casesObj.numberofchildincidents > 0 && ( -
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
- )} - {casesObj.numberofchildincidents > 0 ? ( -
-
- {t( - "case:summary-linked-cases-label" - )} -
-
- {linkedCasesList( - props.currentView - .linkedCaseReferences - )} -
-
- ) : ( - "" - )} -
+ + + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t("case:summary-case-link-status-label")} +
+
+ {_.has(casesObj, ["numberofchildincidents"]) + ? casesObj.numberofchildincidents > 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + )} +
+
+ )} + {casesObj.numberofchildincidents > 0 ? ( +
+
+ {t("case:summary-linked-cases-label")} +
+
+ {linkedCasesList( + props.currentView.linkedCaseReferences + )} +
+
+ ) : ( + "" + )} + { headingTag="h3" >
- - label={t("case:summary-start-date-label")} + - value={_.has(detailsObj, "pinswg_startdate") - ? !_.isEmpty( - detailsObj.pinswg_startdate - ) - ? formatDates( - detailsObj.pinswg_startdate - ) - : t( - "case:summary-no-date-entered-label" - ) - : _.has( - detailsObj, - "pinswg_startdates" - ) - ? !_.isEmpty( - detailsObj.pinswg_startdates - ) - ? formatDates( - detailsObj.pinswg_startdates - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} + - /> - - - - - - /> - - - - - {/* + {/* { "case:summary-no-date-entered-label" )} /> */} - - label={t("case:summary-event-date-label")} - - value={_.has( - detailsObj, - "pinswg_dateeventrequested" - ) - ? !_.isEmpty( - detailsObj.pinswg_dateeventrequested - ) - ? formatDates( - detailsObj.pinswg_dateeventrequested - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} - - /> - - - -
+ + +
diff --git a/components/case/summaryTypes/pinswg_maintenanceoflands217id.js b/components/case/summaryTypes/pinswg_maintenanceoflands217id.js index 7f57ab0b..de281a53 100644 --- a/components/case/summaryTypes/pinswg_maintenanceoflands217id.js +++ b/components/case/summaryTypes/pinswg_maintenanceoflands217id.js @@ -5,6 +5,7 @@ import { useRouter } from "next/router"; import transLookup from "../../../data/lookuptranslations.json"; import SummaryCard from "../summary/components/SummaryCard"; import SummaryRow from "../summary/components/SummaryRow"; +import { getCaseLpaDisplayLines } from "../../utils/getCaseLpaDisplayValue"; const Pinswg_maintenanceoflands217id = (props) => { let { t } = useTranslation(); @@ -20,208 +21,184 @@ const Pinswg_maintenanceoflands217id = (props) => { title={t("case:summary-case-details-label")} >
- - - + + {getCaseLpaDisplayLines({ + casesObj, + detailsObj, + locale: router.locale, + transLookup + }).map((name) => ( +
{name}
+ ))} + + } + /> + - + - + - + -
-
- {t("case:summary-decision-label")} -
-
- {router.locale == "cy" - ? jsonpath({ - path: - '$..[?(@ && @.value=="' + - detailsObj[ - "pinswg_decision@OData.Community.Display.V1.FormattedValue" - ] + - '")].value_cy', - json: transLookup, - eval: true, - }) - : detailsObj[ + ] + + '")].value_cy', + json: transLookup, + eval: true + }) + : casesObj[ + "statuscode@OData.Community.Display.V1.FormattedValue" + ] || + t("case:summary-no-date-entered-label") + } + /> +
+
+ {t("case:summary-decision-label")} +
+
+ {router.locale == "cy" + ? jsonpath({ + path: + '$..[?(@ && @.value=="' + + detailsObj[ "pinswg_decision@OData.Community.Display.V1.FormattedValue" - ] || - t( - "case:summary-no-information-to-date-label" - )} + ] + + '")].value_cy', + json: transLookup, + eval: true + }) + : detailsObj[ + "pinswg_decision@OData.Community.Display.V1.FormattedValue" + ] || + t( + "case:summary-no-information-to-date-label" + )} -
- {/* +
+ {/* {casesObj.caseDetails .outcome_document || ""} */} -
-
- {casesObj.numberofchildincidents > 0 && ( -
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
- )} - {casesObj.numberofchildincidents > 0 ? ( -
-
- {t( - "case:summary-linked-cases-label" - )} -
-
- {linkedCasesList( - props.currentView - .linkedCaseReferences - )} -
-
- ) : ( - "" - )} -
+ + + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t("case:summary-case-link-status-label")} +
+
+ {_.has(casesObj, ["numberofchildincidents"]) + ? casesObj.numberofchildincidents > 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + )} +
+
+ )} + {casesObj.numberofchildincidents > 0 ? ( +
+
+ {t("case:summary-linked-cases-label")} +
+
+ {linkedCasesList( + props.currentView.linkedCaseReferences + )} +
+
+ ) : ( + "" + )} + { headingTag="h3" >
- - label={t("case:summary-start-date-label")} + - value={_.has(detailsObj, "pinswg_startdate") - ? !_.isEmpty( - detailsObj.pinswg_startdate - ) - ? formatDates( - detailsObj.pinswg_startdate - ) - : t( - "case:summary-no-date-entered-label" - ) - : _.has( - detailsObj, - "pinswg_startdates" - ) - ? !_.isEmpty( - detailsObj.pinswg_startdates - ) - ? formatDates( - detailsObj.pinswg_startdates - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} + - /> - - - - - - /> - - - - - {/* + {/* { "case:summary-no-date-entered-label" )} /> */} - - label={t("case:summary-event-date-label")} - - value={_.has( - detailsObj, - "pinswg_dateeventrequested" - ) - ? !_.isEmpty( - detailsObj.pinswg_dateeventrequested - ) - ? formatDates( - detailsObj.pinswg_dateeventrequested - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} - - /> - - - -
+ + +
diff --git a/components/case/summaryTypes/pinswg_miscellaneouscasewordid.js b/components/case/summaryTypes/pinswg_miscellaneouscasewordid.js index 36f54836..5e7f17ab 100644 --- a/components/case/summaryTypes/pinswg_miscellaneouscasewordid.js +++ b/components/case/summaryTypes/pinswg_miscellaneouscasewordid.js @@ -5,6 +5,7 @@ import { useRouter } from "next/router"; import transLookup from "../../../data/lookuptranslations.json"; import SummaryCard from "../summary/components/SummaryCard"; import SummaryRow from "../summary/components/SummaryRow"; +import { getCaseLpaDisplayLines } from "../../utils/getCaseLpaDisplayValue"; const Pinswg_miscellaneouscasewordid = (props) => { let { t } = useTranslation(); @@ -20,236 +21,209 @@ const Pinswg_miscellaneouscasewordid = (props) => { title={t("case:summary-case-details-label")} >
- - - + + {getCaseLpaDisplayLines({ + casesObj, + detailsObj, + locale: router.locale, + transLookup + }).map((name) => ( +
{name}
+ ))} + + } + /> + - + - + - + -
-
- {t("case:summary-decision-label")} -
-
- {router.locale == "cy" - ? jsonpath({ - path: - '$..[?(@ && @.value=="' + - detailsObj[ - "pinswg_decision@OData.Community.Display.V1.FormattedValue" - ] + - '")].value_cy', - json: transLookup, - eval: true, - }) - : detailsObj[ + ] + + '")].value_cy', + json: transLookup, + eval: true + }) + : casesObj[ + "statuscode@OData.Community.Display.V1.FormattedValue" + ] || + t("case:summary-no-date-entered-label") + } + /> +
+
+ {t("case:summary-decision-label")} +
+
+ {router.locale == "cy" + ? jsonpath({ + path: + '$..[?(@ && @.value=="' + + detailsObj[ "pinswg_decision@OData.Community.Display.V1.FormattedValue" - ] || - t( - "case:summary-no-information-to-date-label" - )} + ] + + '")].value_cy', + json: transLookup, + eval: true + }) + : detailsObj[ + "pinswg_decision@OData.Community.Display.V1.FormattedValue" + ] || + t( + "case:summary-no-information-to-date-label" + )} -
- {/* +
+ {/* {casesObj.caseDetails .outcome_document || ""} */} -
-
- {casesObj.numberofchildincidents > 0 && ( -
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
- )} - {casesObj.numberofchildincidents > 0 ? ( -
-
- {t( - "case:summary-linked-cases-label" - )} -
-
- {linkedCasesList( - props.currentView - .linkedCaseReferences - )} -
-
- ) : ( - "" - )} - -
+ + + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t("case:summary-case-link-status-label")} +
+
+ {_.has(casesObj, ["numberofchildincidents"]) + ? casesObj.numberofchildincidents > 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + )} +
+
+ )} + {casesObj.numberofchildincidents > 0 ? ( +
+
+ {t("case:summary-linked-cases-label")} +
+
+ {linkedCasesList( + props.currentView.linkedCaseReferences + )} +
+
+ ) : ( + "" + )} + + { headingTag="h3" >
- - label={t("case:summary-start-date-label")} + - value={_.has(detailsObj, "pinswg_startdate") - ? !_.isEmpty( - detailsObj.pinswg_startdate - ) - ? formatDates( - detailsObj.pinswg_startdate - ) - : t( - "case:summary-no-date-entered-label" - ) - : _.has( - detailsObj, - "pinswg_startdates" - ) - ? !_.isEmpty( - detailsObj.pinswg_startdates - ) - ? formatDates( - detailsObj.pinswg_startdates - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} + - /> - - - - - - /> - - - - - {/* + {/* { "case:summary-no-date-entered-label" )} /> */} - - label={t("case:summary-event-date-label")} - - value={_.has( - detailsObj, - "pinswg_dateeventrequested" - ) - ? !_.isEmpty( - detailsObj.pinswg_dateeventrequested - ) - ? formatDates( - detailsObj.pinswg_dateeventrequested - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} - - /> - - - -
+ + +
diff --git a/components/case/summaryTypes/pinswg_nonvalidationid.js b/components/case/summaryTypes/pinswg_nonvalidationid.js index 7c442217..0539f4bc 100644 --- a/components/case/summaryTypes/pinswg_nonvalidationid.js +++ b/components/case/summaryTypes/pinswg_nonvalidationid.js @@ -5,6 +5,7 @@ import { useRouter } from "next/router"; import transLookup from "../../../data/lookuptranslations.json"; import SummaryCard from "../summary/components/SummaryCard"; import SummaryRow from "../summary/components/SummaryRow"; +import { getCaseLpaDisplayLines } from "../../utils/getCaseLpaDisplayValue"; const Pinswg_nonvalidationid = (props) => { let { t } = useTranslation(); @@ -20,136 +21,95 @@ const Pinswg_nonvalidationid = (props) => { title={t("case:summary-case-details-label")} >
- + + {getCaseLpaDisplayLines({ + casesObj, + detailsObj, + locale: router.locale, + transLookup + }).map((name) => ( +
{name}
+ ))} + + } + /> - } - - /> - - - {/* */} - -
-
- {t("case:summary-decision-label")} -
-
- {router.locale == "cy" - ? jsonpath({ - path: - '$..[?(@ && @.value=="' + - detailsObj[ - "pinswg_decisionissued@OData.Community.Display.V1.FormattedValue" - ] + - '")].value_cy', - json: transLookup, - eval: true, - }) - : detailsObj[ + ] + + '")].value_cy', + json: transLookup, + eval: true + }) + : casesObj[ + "statuscode@OData.Community.Display.V1.FormattedValue" + ] || + t("case:summary-no-date-entered-label") + } + /> +
+
+ {t("case:summary-decision-label")} +
+
+ {router.locale == "cy" + ? jsonpath({ + path: + '$..[?(@ && @.value=="' + + detailsObj[ "pinswg_decisionissued@OData.Community.Display.V1.FormattedValue" - ] || - t( - "case:summary-no-information-to-date-label" - )} + ] + + '")].value_cy', + json: transLookup, + eval: true + }) + : detailsObj[ + "pinswg_decisionissued@OData.Community.Display.V1.FormattedValue" + ] || + t( + "case:summary-no-information-to-date-label" + )} -
- {/* +
+ {/* {casesObj.caseDetails .outcome_document || ""} */} -
-
-
+ + + { headingTag="h3" >
- - label={t("case:summary-start-date-label")} - - value={ - - _.has(detailsObj, "pinswg_validdate") - ? !_.isEmpty( - detailsObj.pinswg_validdate - ) - ? formatDates( - detailsObj.pinswg_validdate - ) - : t( - "case:summary-no-date-entered-label" - ) - : _.has( - detailsObj, - "pinswg_startdates" - ) - ? !_.isEmpty( - detailsObj.pinswg_startdates - ) - ? formatDates( - detailsObj.pinswg_startdates - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - ) - - } - - /> - - -
+ +
diff --git a/components/case/summaryTypes/pinswg_planningappeals78id.js b/components/case/summaryTypes/pinswg_planningappeals78id.js index cd48711f..c63c26d1 100644 --- a/components/case/summaryTypes/pinswg_planningappeals78id.js +++ b/components/case/summaryTypes/pinswg_planningappeals78id.js @@ -5,6 +5,7 @@ import { useRouter } from "next/router"; import transLookup from "../../../data/lookuptranslations.json"; import SummaryCard from "../summary/components/SummaryCard"; import SummaryRow from "../summary/components/SummaryRow"; +import { getCaseLpaDisplayValue, getCaseLpaDisplayLines } from "../../utils/getCaseLpaDisplayValue"; const Pinswg_planningappeals78id = (props) => { let { t } = useTranslation(); @@ -41,35 +42,23 @@ const Pinswg_planningappeals78id = (props) => { } /> + {getCaseLpaDisplayLines({ + casesObj, + detailsObj, + locale: router.locale, + transLookup + }).map((name) => ( +
{name}
+ ))} + } - /> { "pinswg_eiarequired@OData.Community.Display.V1.FormattedValue" ] || t("case:summary-to-be-confirmed-label") - } - /> { : detailsObj[ "pinswg_procedure@OData.Community.Display.V1.FormattedValue" ] || "" - } - /> { t( "case:summary-no-information-to-date-label" ) - } - /> { "statuscode@OData.Community.Display.V1.FormattedValue" ] || t("case:summary-no-date-entered-label") - } - />
@@ -196,11 +168,8 @@ const Pinswg_planningappeals78id = (props) => {
{ "case:summary-no-date-entered-label" ) : t("case:summary-no-date-entered-label") - } - /> {casesObj.numberofchildincidents > 0 && (
@@ -259,11 +226,8 @@ const Pinswg_planningappeals78id = (props) => { >
{ "case:summary-no-date-entered-label" ) : t("case:summary-no-date-entered-label") - } - /> { "case:summary-no-date-entered-label" ) : t("case:summary-no-date-entered-label") - - } - - /> { "case:summary-no-date-entered-label" ) : t("case:summary-no-date-entered-label") - - } - - /> {/* { /> */} { "case:summary-no-date-entered-label" ) : t("case:summary-no-date-entered-label") - - } - - /> {/* { /> */} { "case:summary-no-date-entered-label" ) : t("case:summary-no-date-entered-label") - - } - - /> {detailsObj.pinswg_typeofevent == 846040002 || detailsObj.pinswg_typeofevent == 846040007 || detailsObj.pinswg_typeofevent == 846040012 || detailsObj.pinswg_typeofevent == 846040009 ? ( { : t( "case:summary-no-date-entered-label" ) - } - /> ) : ( "" diff --git a/components/case/summaryTypes/pinswg_planningconditionss73s79id.js b/components/case/summaryTypes/pinswg_planningconditionss73s79id.js index 10b5a037..640499c7 100644 --- a/components/case/summaryTypes/pinswg_planningconditionss73s79id.js +++ b/components/case/summaryTypes/pinswg_planningconditionss73s79id.js @@ -5,6 +5,7 @@ import { useRouter } from "next/router"; import transLookup from "../../../data/lookuptranslations.json"; import SummaryCard from "../summary/components/SummaryCard"; import SummaryRow from "../summary/components/SummaryRow"; +import { getCaseLpaDisplayLines } from "../../utils/getCaseLpaDisplayValue"; const Pinswg_planningconditionss73s79id = (props) => { let { t } = useTranslation(); @@ -41,35 +42,23 @@ const Pinswg_planningconditionss73s79id = (props) => { } /> + {getCaseLpaDisplayLines({ + casesObj, + detailsObj, + locale: router.locale, + transLookup + }).map((name) => ( +
{name}
+ ))} + } - /> { "pinswg_detailedeiascreeningrequiered@OData.Community.Display.V1.FormattedValue" ] || t("case:summary-to-be-confirmed-label") - } - /> { : detailsObj[ "pinswg_procedure@OData.Community.Display.V1.FormattedValue" ] || "" - } - /> { : detailsObj[ "pinswg_typeofevent@OData.Community.Display.V1.FormattedValue" ] || "" - } - /> { "statuscode@OData.Community.Display.V1.FormattedValue" ] || t("case:summary-no-date-entered-label") - } - />
@@ -235,11 +207,8 @@ const Pinswg_planningconditionss73s79id = (props) => { >
{ "case:summary-no-date-entered-label" ) : t("case:summary-no-date-entered-label") - } - /> { "case:summary-no-date-entered-label" ) : t("case:summary-no-date-entered-label") - - } - - /> { "case:summary-no-date-entered-label" ) : t("case:summary-no-date-entered-label") - - } - - /> { "case:summary-no-date-entered-label" ) : t("case:summary-no-date-entered-label") - - } - - /> { "case:summary-no-date-entered-label" ) : t("case:summary-no-date-entered-label") - - } - - /> {/* { } /> */} { "case:summary-no-date-entered-label" ) : t("case:summary-no-date-entered-label") - } - /> { "case:summary-no-date-entered-label" ) : t("case:summary-no-date-entered-label") - - } - - /> { "case:summary-no-date-entered-label" ) : t("case:summary-no-date-entered-label") - } - />
diff --git a/components/case/summaryTypes/pinswg_planningobligationappeals106id.js b/components/case/summaryTypes/pinswg_planningobligationappeals106id.js index 0cdf0bdc..582251f1 100644 --- a/components/case/summaryTypes/pinswg_planningobligationappeals106id.js +++ b/components/case/summaryTypes/pinswg_planningobligationappeals106id.js @@ -5,6 +5,7 @@ import { useRouter } from "next/router"; import transLookup from "../../../data/lookuptranslations.json"; import SummaryCard from "../summary/components/SummaryCard"; import SummaryRow from "../summary/components/SummaryRow"; +import { getCaseLpaDisplayLines } from "../../utils/getCaseLpaDisplayValue"; const Pinswg_planningobligationappeals106id = (props) => { let { t } = useTranslation(); @@ -20,208 +21,184 @@ const Pinswg_planningobligationappeals106id = (props) => { title={t("case:summary-case-details-label")} >
- - - + + {getCaseLpaDisplayLines({ + casesObj, + detailsObj, + locale: router.locale, + transLookup + }).map((name) => ( +
{name}
+ ))} + + } + /> + - + - + - + -
-
- {t("case:summary-decision-label")} -
-
- {router.locale == "cy" - ? jsonpath({ - path: - '$..[?(@ && @.value=="' + - detailsObj[ - "pinswg_decision@OData.Community.Display.V1.FormattedValue" - ] + - '")].value_cy', - json: transLookup, - eval: true, - }) - : detailsObj[ + ] + + '")].value_cy', + json: transLookup, + eval: true + }) + : casesObj[ + "statuscode@OData.Community.Display.V1.FormattedValue" + ] || + t("case:summary-no-date-entered-label") + } + /> +
+
+ {t("case:summary-decision-label")} +
+
+ {router.locale == "cy" + ? jsonpath({ + path: + '$..[?(@ && @.value=="' + + detailsObj[ "pinswg_decision@OData.Community.Display.V1.FormattedValue" - ] || - t( - "case:summary-no-information-to-date-label" - )} + ] + + '")].value_cy', + json: transLookup, + eval: true + }) + : detailsObj[ + "pinswg_decision@OData.Community.Display.V1.FormattedValue" + ] || + t( + "case:summary-no-information-to-date-label" + )} -
- {/* +
+ {/* {casesObj.caseDetails .outcome_document || ""} */} -
-
- {casesObj.numberofchildincidents > 0 && ( -
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
- )} - {casesObj.numberofchildincidents > 0 ? ( -
-
- {t( - "case:summary-linked-cases-label" - )} -
-
- {linkedCasesList( - props.currentView - .linkedCaseReferences - )} -
-
- ) : ( - "" - )} -
+ +
+ {casesObj.numberofchildincidents > 0 && ( +
+
+ {t("case:summary-case-link-status-label")} +
+
+ {_.has(casesObj, ["numberofchildincidents"]) + ? casesObj.numberofchildincidents > 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + )} +
+
+ )} + {casesObj.numberofchildincidents > 0 ? ( +
+
+ {t("case:summary-linked-cases-label")} +
+
+ {linkedCasesList( + props.currentView.linkedCaseReferences + )} +
+
+ ) : ( + "" + )} +
{ headingTag="h3" >
- - label={t("case:summary-start-date-label")} + - value={_.has(detailsObj, "pinswg_startdate") - ? !_.isEmpty( - detailsObj.pinswg_startdate - ) - ? formatDates( - detailsObj.pinswg_startdate - ) - : t( - "case:summary-no-date-entered-label" - ) - : _.has( - detailsObj, - "pinswg_startdates" - ) - ? !_.isEmpty( - detailsObj.pinswg_startdates - ) - ? formatDates( - detailsObj.pinswg_startdates - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} + - /> - - - - - - /> - - - - - {/* + {/* { "case:summary-no-date-entered-label" )} /> */} - - label={t("case:summary-event-date-label")} - - value={_.has( - detailsObj, - "pinswg_dateeventrequested" - ) - ? !_.isEmpty( - detailsObj.pinswg_dateeventrequested - ) - ? formatDates( - detailsObj.pinswg_dateeventrequested - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} - - /> - - - -
+ + +
diff --git a/components/case/summaryTypes/pinswg_rowid.js b/components/case/summaryTypes/pinswg_rowid.js index f9b4341d..e709c92f 100644 --- a/components/case/summaryTypes/pinswg_rowid.js +++ b/components/case/summaryTypes/pinswg_rowid.js @@ -5,6 +5,7 @@ import { useRouter } from "next/router"; import transLookup from "../../../data/lookuptranslations.json"; import SummaryCard from "../summary/components/SummaryCard"; import SummaryRow from "../summary/components/SummaryRow"; +import { getCaseLpaDisplayLines } from "../../utils/getCaseLpaDisplayValue"; const Pinswg_rowid = (props) => { let { t } = useTranslation(); @@ -20,264 +21,230 @@ const Pinswg_rowid = (props) => { title={t("case:summary-case-details-label")} >
- - /> - - - - /> - - - + {getCaseLpaDisplayLines({ + casesObj, + detailsObj, + locale: router.locale, + transLookup + }).map((name) => ( +
{name}
+ ))} + + } + /> + - + - + - + -
-
- {t("case:summary-decision-label")} -
-
- {router.locale == "cy" - ? jsonpath({ - path: - '$..[?(@ && @.value=="' + - detailsObj[ - "pinswg_decision@OData.Community.Display.V1.FormattedValue" - ] + - '")].value_cy', - json: transLookup, - eval: true, - }) - : detailsObj[ + ] + + '")].value_cy', + json: transLookup, + eval: true + }) + : casesObj[ + "statuscode@OData.Community.Display.V1.FormattedValue" + ] || + t("case:summary-no-date-entered-label") + } + /> +
+
+ {t("case:summary-decision-label")} +
+
+ {router.locale == "cy" + ? jsonpath({ + path: + '$..[?(@ && @.value=="' + + detailsObj[ "pinswg_decision@OData.Community.Display.V1.FormattedValue" - ] || - t( - "case:summary-no-information-to-date-label" - )} + ] + + '")].value_cy', + json: transLookup, + eval: true + }) + : detailsObj[ + "pinswg_decision@OData.Community.Display.V1.FormattedValue" + ] || + t( + "case:summary-no-information-to-date-label" + )} -
- {/* +
+ {/* {casesObj.caseDetails .outcome_document || ""} */} -
-
- {casesObj.numberofchildincidents > 0 && ( -
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
- )} - {casesObj.numberofchildincidents > 0 ? ( -
-
- {t( - "case:summary-linked-cases-label" - )} -
-
- {linkedCasesList( - props.currentView - .linkedCaseReferences - )} -
-
- ) : ( - "" - )} - -
+ + + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t("case:summary-case-link-status-label")} +
+
+ {_.has(casesObj, ["numberofchildincidents"]) + ? casesObj.numberofchildincidents > 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + )} +
+
+ )} + {casesObj.numberofchildincidents > 0 ? ( +
+
+ {t("case:summary-linked-cases-label")} +
+
+ {linkedCasesList( + props.currentView.linkedCaseReferences + )} +
+
+ ) : ( + "" + )} + + { headingTag="h3" >
- - label={t("case:summary-start-date-label")} + - value={_.has(detailsObj, "pinswg_startdate") - ? !_.isEmpty( - detailsObj.pinswg_startdate - ) - ? formatDates( - detailsObj.pinswg_startdate - ) - : t( - "case:summary-no-date-entered-label" - ) - : _.has( - detailsObj, - "pinswg_startdates" - ) - ? !_.isEmpty( - detailsObj.pinswg_startdates - ) - ? formatDates( - detailsObj.pinswg_startdates - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} + - /> - - - - - - /> - - - - - {/* + {/* { "case:summary-no-date-entered-label" )} /> */} - - label={t("case:summary-event-date-label")} - - value={_.has( - detailsObj, - "pinswg_dateeventrequested" - ) - ? !_.isEmpty( - detailsObj.pinswg_dateeventrequested - ) - ? formatDates( - detailsObj.pinswg_dateeventrequested - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} - - /> - - - -
+ + +
diff --git a/components/case/summaryTypes/pinswg_sipscase.js b/components/case/summaryTypes/pinswg_sipscase.js index 2145f5fc..a8f8eba3 100644 --- a/components/case/summaryTypes/pinswg_sipscase.js +++ b/components/case/summaryTypes/pinswg_sipscase.js @@ -5,6 +5,7 @@ import useTranslation from "next-translate/useTranslation"; import transLookup from "../../../data/lookuptranslations.json"; import SummaryCard from "../summary/components/SummaryCard"; import SummaryRow from "../summary/components/SummaryRow"; +import { getCaseLpaDisplayLines } from "../../utils/getCaseLpaDisplayValue"; import GoogleMapComponent from "../../mapping"; @@ -86,11 +87,10 @@ const Pinswg_sipscase = (props) => {
{ t( "case:summary-no-date-entered-label" ) - } - /> {hasValidKey( @@ -116,11 +114,8 @@ const Pinswg_sipscase = (props) => { "_pinswg_projecttype_value" ) && ( { t( "case:summary-no-date-entered-label" ) - } - /> )} {detailsObj.pinswg_webaddress != null && ( { t( "case:summary-no-date-entered-label" ) - } - /> )} {/*
@@ -190,32 +178,26 @@ const Pinswg_sipscase = (props) => {
*/} - -
-
- {t("case:summary-lpa-label")} -
-
- {router.locale == "cy" - ? jsonpath( - '$..[?(@.value=="' + - casesObj[ - "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue" - ] + - '")].value_cy', - transLookup - ) - : casesObj[ - "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue" - ] || ""} -
-
+ {getCaseLpaDisplayLines({ + casesObj, + detailsObj, + locale: router.locale, + transLookup + }).map((name) => ( +
{name}
+ ))} + + } + /> + { t( "case:summary-to-be-confirmed-label" ) - } - /> { t( "case:summary-to-be-confirmed-label" ) - } - /> { t( "case:summary-to-be-confirmed-label" ) - } - /> {/* { { : t( "case:summary-no-information-to-date-label" ) - } - /> {casesObj.numberofchildincidents > 0 && (
@@ -525,13 +492,10 @@ const Pinswg_sipscase = (props) => {
{ : t( "case:summary-awaiting-information-label" ) - } - /> { : t( "case:summary-awaiting-information-label" ) - } - /> { : t( "case:summary-awaiting-information-label" ) - } - />
@@ -635,13 +587,10 @@ const Pinswg_sipscase = (props) => { "pinswg_validationdeadlineextension" ) && ( { : t( "case:summary-awaiting-information-label" ) - } - /> )} {hasValidKey( @@ -668,13 +615,10 @@ const Pinswg_sipscase = (props) => { "pinswg_casesuspensionstartdate" ) && ( { : t( "case:summary-awaiting-information-label" ) - } - /> )} {hasValidKey( @@ -701,13 +643,10 @@ const Pinswg_sipscase = (props) => { "pinswg_casesuspensionenddate" ) && ( { : t( "case:summary-awaiting-information-label" ) - } - /> )}
@@ -757,13 +694,10 @@ const Pinswg_sipscase = (props) => { "pinswg_reportissuedtowelshministers" ) && ( { : t( "case:summary-awaiting-information-label" ) - } - /> )} {hasValidKey( @@ -790,13 +722,10 @@ const Pinswg_sipscase = (props) => { "pinswg_decisionissuedtoapplicant" ) && ( { : t( "case:summary-awaiting-information-label" ) - } - /> )} {hasValidKey( @@ -823,13 +750,10 @@ const Pinswg_sipscase = (props) => { "pinswg_decisionoutcome" ) && ( { : t( "case:summary-awaiting-information-label" ) - } - /> )} @@ -872,13 +794,10 @@ const Pinswg_sipscase = (props) => { "pinswg_redetermination" ) && ( { : t( "case:summary-awaiting-information-label" ) - } - /> )} {hasValidKey( @@ -907,13 +824,10 @@ const Pinswg_sipscase = (props) => { "pinswg_redeterminationconsultationdeadline" ) && ( { : t( "case:summary-awaiting-information-label" ) - } - /> )} diff --git a/components/case/summaryTypes/pinswg_wayleaveid.js b/components/case/summaryTypes/pinswg_wayleaveid.js index 965b4e13..c5b043bd 100644 --- a/components/case/summaryTypes/pinswg_wayleaveid.js +++ b/components/case/summaryTypes/pinswg_wayleaveid.js @@ -5,6 +5,7 @@ import { useRouter } from "next/router"; import transLookup from "../../../data/lookuptranslations.json"; import SummaryCard from "../summary/components/SummaryCard"; import SummaryRow from "../summary/components/SummaryRow"; +import { getCaseLpaDisplayLines } from "../../utils/getCaseLpaDisplayValue"; const Pinswg_wayleaveid = (props) => { let { t } = useTranslation(); @@ -20,236 +21,209 @@ const Pinswg_wayleaveid = (props) => { title={t("case:summary-case-details-label")} >
- - - + + {getCaseLpaDisplayLines({ + casesObj, + detailsObj, + locale: router.locale, + transLookup + }).map((name) => ( +
{name}
+ ))} + + } + /> + - + - + - + -
-
- {t("case:summary-decision-label")} -
-
- {router.locale == "cy" - ? jsonpath({ - path: - '$..[?(@ && @.value=="' + - detailsObj[ - "pinswg_decision@OData.Community.Display.V1.FormattedValue" - ] + - '")].value_cy', - json: transLookup, - eval: true, - }) - : detailsObj[ + ] + + '")].value_cy', + json: transLookup, + eval: true + }) + : casesObj[ + "statuscode@OData.Community.Display.V1.FormattedValue" + ] || + t("case:summary-no-date-entered-label") + } + /> +
+
+ {t("case:summary-decision-label")} +
+
+ {router.locale == "cy" + ? jsonpath({ + path: + '$..[?(@ && @.value=="' + + detailsObj[ "pinswg_decision@OData.Community.Display.V1.FormattedValue" - ] || - t( - "case:summary-no-information-to-date-label" - )} + ] + + '")].value_cy', + json: transLookup, + eval: true + }) + : detailsObj[ + "pinswg_decision@OData.Community.Display.V1.FormattedValue" + ] || + t( + "case:summary-no-information-to-date-label" + )} -
- {/* +
+ {/* {casesObj.caseDetails .outcome_document || ""} */} -
-
- {casesObj.numberofchildincidents > 0 && ( -
-
- {t( - "case:summary-case-link-status-label" - )} -
-
- {_.has(casesObj, [ - "numberofchildincidents", - ]) - ? casesObj.numberofchildincidents > - 0 - ? t( - "case:summary-case-link-status-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - ) - : t( - "case:summary-case-link-status-not-linked" - )} -
-
- )} - {casesObj.numberofchildincidents > 0 ? ( -
-
- {t( - "case:summary-linked-cases-label" - )} -
-
- {linkedCasesList( - props.currentView - .linkedCaseReferences - )} -
-
- ) : ( - "" - )} - -
+ + + {casesObj.numberofchildincidents > 0 && ( +
+
+ {t("case:summary-case-link-status-label")} +
+
+ {_.has(casesObj, ["numberofchildincidents"]) + ? casesObj.numberofchildincidents > 0 + ? t( + "case:summary-case-link-status-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + ) + : t( + "case:summary-case-link-status-not-linked" + )} +
+
+ )} + {casesObj.numberofchildincidents > 0 ? ( +
+
+ {t("case:summary-linked-cases-label")} +
+
+ {linkedCasesList( + props.currentView.linkedCaseReferences + )} +
+
+ ) : ( + "" + )} + + { headingTag="h3" >
- - label={t("case:summary-start-date-label")} + - value={_.has(detailsObj, "pinswg_startdate") - ? !_.isEmpty( - detailsObj.pinswg_startdate - ) - ? formatDates( - detailsObj.pinswg_startdate - ) - : t( - "case:summary-no-date-entered-label" - ) - : _.has( - detailsObj, - "pinswg_startdates" - ) - ? !_.isEmpty( - detailsObj.pinswg_startdates - ) - ? formatDates( - detailsObj.pinswg_startdates - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} + - /> - - - - - - /> - - - - - {/* + {/* { "case:summary-no-date-entered-label" )} /> */} - - label={t("case:summary-event-date-label")} - - value={_.has( - detailsObj, - "pinswg_dateeventrequested" - ) - ? !_.isEmpty( - detailsObj.pinswg_dateeventrequested - ) - ? formatDates( - detailsObj.pinswg_dateeventrequested - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} - - /> - - - -
+ + +
diff --git a/components/utils/getCaseLpaDisplayValue.js b/components/utils/getCaseLpaDisplayValue.js new file mode 100644 index 00000000..027ef0e2 --- /dev/null +++ b/components/utils/getCaseLpaDisplayValue.js @@ -0,0 +1,69 @@ +import { JSONPath as jsonpath } from "jsonpath-plus"; + +const translateLpaName = ({ name, locale, transLookup }) => { + if (!name) return ""; + + if (locale !== "cy") return name; + + return ( + jsonpath({ + path: '$..[?(@ && @.value=="' + name + '")].value_cy', + json: transLookup, + eval: true + })?.[0] || name + ); +}; + +export const getCaseLpaNames = ({ + casesObj, + detailsObj, + locale, + transLookup +}) => { + if (!casesObj) return []; + + const primaryLpaName = + casesObj[ + "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue" + ] || ""; + + const translatedPrimaryLpaName = translateLpaName({ + name: primaryLpaName, + locale, + transLookup + }); + + const additionalLpaNames = (detailsObj.additionalLPAs || []).map((lpa) => + translateLpaName({ + name: lpa?.name || "", + locale, + transLookup + }) + ); + + return [ + ...new Set( + [translatedPrimaryLpaName, ...additionalLpaNames].filter(Boolean) + ) + ]; +}; + +export const getCaseLpaDisplayValue = ({ + casesObj, + detailsObj, + locale, + transLookup +}) => { + return getCaseLpaNames({ casesObj, detailsObj, locale, transLookup }).join( + ", " + ); +}; + +export const getCaseLpaDisplayLines = ({ + casesObj, + locale, + detailsObj, + transLookup +}) => { + return getCaseLpaNames({ casesObj, detailsObj, locale, transLookup }); +}; diff --git a/pages/api/endpoint/getbasicsearchdetails_api.js b/pages/api/endpoint/getbasicsearchdetails_api.js index a7d31b7b..d77f340f 100644 --- a/pages/api/endpoint/getbasicsearchdetails_api.js +++ b/pages/api/endpoint/getbasicsearchdetails_api.js @@ -32,8 +32,8 @@ import { azureHeaders } from "../../../actions/core/headers"; import { getSelectQuery } from "../../../actions/selectQueryTypes"; import { getNavigationPropertyByPrimaryAttribute } from "../../../components/utils"; -import { respondError } from "../middleware/apiResponse"; -import { relayGet } from "../middleware/relayForwarding"; +import { respondError, respondSuccess } from "../middleware/apiResponse"; +import { relayGetData } from "../middleware/relayForwarding"; export default async function ApiProxy(req, res) { const appealTypeName = req.query.appealTypeName; @@ -88,45 +88,50 @@ export default async function ApiProxy(req, res) { navigationProperty + "($select=ticketnumber)"; - //" and statuscode eq 1&$count=true"; - - // queryUrl = - // queryUrl + - // getSelectQuery(appealTypeName) + - // ",_" + - // (primaryIdAttribute == "pinswg_sipscase" - // ? "pinswg_sipscase_value" - // : primaryIdAttribute + "s_value"); - queryUrl = queryUrl + getSelectQuery(appealTypeName); - // console.log( - // "\n==========================================\n", - // "\nSearch Details query ", - // "\nAppealType: " + appealTypeName, - // "\nIncident ID: " + incidentID, - // "\n\nQuery url: " + queryUrl, - // "\n==========================================\n" - // ); + const incidentQueryUrl = + "incidents(" + + incidentID + + ")?$select=title,ticketnumber" + + "&$expand=pinswg_Incident_Account_AdditionalLPAs($select=name,accountnumber)" + + "&$count=true"; - return relayGet({ - queryUrl, - res, - requestOptionsBuilder: (accessToken) => azureHeaders(accessToken), - transformData: (data) => { - let flattened = data.value.map((r) => ({ - ...r, - ticketnumber: r[navigationProperty]?.ticketnumber || null - })); + try { + const [searchResult, incidentResult] = await Promise.all([ + relayGetData({ + queryUrl, + requestOptionsBuilder: (accessToken) => + azureHeaders(accessToken) + }), + relayGetData({ + queryUrl: incidentQueryUrl, + requestOptionsBuilder: (accessToken) => + azureHeaders(accessToken) + }) + ]); - data.value = flattened; + const data = searchResult.data; + const incidentData = incidentResult.data; + const additionalLPAs = + incidentData?.pinswg_Incident_Account_AdditionalLPAs || []; - return data; - }, - errorResponse: { + data.value = (data.value || []).map((r) => ({ + ...r, + ticketnumber: + r[navigationProperty]?.ticketnumber || + incidentData?.ticketnumber || + null, + incidenttitle: incidentData?.title || null, + additionalLPAs + })); + + return respondSuccess(res, data); + } catch (error) { + return respondError(res, { status: 400, code: "BASIC_SEARCH_DETAILS_FETCH_FAILED", message: "Failed to fetch basic search details" - } - }); + }); + } } diff --git a/pages/api/endpoint/getbasicsearchdetailspaged_api.js b/pages/api/endpoint/getbasicsearchdetailspaged_api.js index fdd0e050..95defa60 100644 --- a/pages/api/endpoint/getbasicsearchdetailspaged_api.js +++ b/pages/api/endpoint/getbasicsearchdetailspaged_api.js @@ -30,11 +30,11 @@ */ import _ from "lodash"; -import { azureHeadersPaged } from "../../../actions/core/headers"; +import { azureHeaders, azureHeadersPaged } from "../../../actions/core/headers"; import { getSelectQuery } from "../../../actions/selectQueryTypes"; import { getNavigationPropertyByPrimaryAttribute } from "../../../components/utils"; -import { respondError } from "../middleware/apiResponse"; -import { relayGet } from "../middleware/relayForwarding"; +import { respondError, respondSuccess } from "../middleware/apiResponse"; +import { relayGetData } from "../middleware/relayForwarding"; export default async function ApiProxy(req, res) { const appealTypeName = req.query.appealTypeName; @@ -76,13 +76,6 @@ export default async function ApiProxy(req, res) { primaryIdAttribute ).NavigationProperty; - // "?$filter=_" + - // (primaryIdAttribute == "pinswg_sipscase" - // ? "pinswg_sipscase_value" - // : primaryIdAttribute + "s_value ") + - // " eq " + - // incidentID + - let queryUrl = appealTypeName + "?$filter=" + @@ -92,8 +85,6 @@ export default async function ApiProxy(req, res) { navigationProperty + "($select=ticketnumber)"; - //" and statuscode eq 1&$count=true"; - queryUrl = queryUrl + getSelectQuery(appealTypeName) + @@ -102,29 +93,53 @@ export default async function ApiProxy(req, res) { ? "pinswg_sipscase_value" : primaryIdAttribute + "s_value"); - return relayGet({ - queryUrl, - res, - requestOptionsBuilder: (accessToken) => azureHeadersPaged(accessToken), - transformData: (data) => { - let flattened = data.value.map((r) => ({ - ...r, - ticketnumber: r[navigationProperty]?.ticketnumber || null - })); + const incidentQueryUrl = + "incidents(" + + req.query.incidentID + + ")?$select=title,ticketnumber" + + "&$expand=pinswg_Incident_Account_AdditionalLPAs($select=name,accountnumber)" + + "&$count=true"; - data.value = flattened; + try { + const [searchResult, incidentResult] = await Promise.all([ + relayGetData({ + queryUrl, + requestOptionsBuilder: (accessToken) => + azureHeadersPaged(accessToken) + }), + relayGetData({ + queryUrl: incidentQueryUrl, + requestOptionsBuilder: (accessToken) => + azureHeaders(accessToken) + }) + ]); - if (_.has(data, "@odata.nextLink") === true) { - const dataStr = JSON.stringify(data["@odata.nextLink"]); - data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]; - } + const data = searchResult.data; + const incidentData = incidentResult.data; + const additionalLPAs = + incidentData?.pinswg_Incident_Account_AdditionalLPAs || []; - return data; - }, - errorResponse: { + data.value = (data.value || []).map((r) => ({ + ...r, + ticketnumber: + r[navigationProperty]?.ticketnumber || + incidentData?.ticketnumber || + null, + incidenttitle: incidentData?.title || null, + additionalLPAs + })); + + if (_.has(data, "@odata.nextLink") === true) { + const dataStr = JSON.stringify(data["@odata.nextLink"]); + data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]; + } + + return respondSuccess(res, data); + } catch (error) { + return respondError(res, { status: 400, code: "BASIC_SEARCH_DETAILS_PAGED_FETCH_FAILED", message: "Failed to fetch paged basic search details" - } - }); + }); + } }