From 6da478ab85d37adb6c4bf5ea1cd53a6b2898ebc7 Mon Sep 17 00:00:00 2001 From: Daniel Liburd Date: Wed, 20 Sep 2023 15:25:00 +0100 Subject: [PATCH] Render accommodation sharing in tracking banner In a previous change[1], we included presentation data in the initial submission of a referral, for easier extraction in the assess & manage journeys. This commit adds the sharing suitability information to the tracking banner if it's available. As we're accessing this data from a free object with no type safety, we explicitly check for `true` or `false`. If this data is not present, the conditional will return falsey and not render the section. [1] https://github.com/ministryofjustice/hmpps-temporary-accommodation-ui/pull/620 --- cypress_shared/components/placeContextHeader.ts | 1 + .../components/place-context-header/macro.njk | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/cypress_shared/components/placeContextHeader.ts b/cypress_shared/components/placeContextHeader.ts index 050a22fda..45510dfcf 100644 --- a/cypress_shared/components/placeContextHeader.ts +++ b/cypress_shared/components/placeContextHeader.ts @@ -39,6 +39,7 @@ export default class PlaceContextHeaderComponent extends Component { 'contain', `Accommodation required from: ${DateFormats.isoDateToUIDate(application.arrivalDate, { format: 'short' })}`, ) + cy.root().should('contain', 'Suitable to share: Yes') }) } } diff --git a/server/views/temporary-accommodation/components/place-context-header/macro.njk b/server/views/temporary-accommodation/components/place-context-header/macro.njk index 486bf4fa7..706c104d0 100644 --- a/server/views/temporary-accommodation/components/place-context-header/macro.njk +++ b/server/views/temporary-accommodation/components/place-context-header/macro.njk @@ -21,6 +21,12 @@ {% if placeContext.assessment.application.arrivalDate %}
Accommodation required from: {{ formatDate(placeContext.assessment.application.arrivalDate, {format: 'short'}) }}
{% endif %} + {% if placeContext.assessment.summaryData.isAbleToShare === true %} +
Suitable to share: Yes
+ {% endif %} + {% if placeContext.assessment.summaryData.isAbleToShare === false %} +
Suitable to share: No
+ {% endif %} View referral summary (opens in new tab)