From 72525479e025653057b32162e187dc929270aff6 Mon Sep 17 00:00:00 2001 From: Greg Hawkins Date: Mon, 30 Dec 2024 11:07:52 +0000 Subject: [PATCH] Placement request page - add blue banner --- integration_tests/pages/match/searchPage.ts | 14 -------------- integration_tests/pages/page.ts | 14 ++++++++++++++ .../tests/admin/placementRequests.cy.ts | 3 +++ server/views/admin/placementRequests/show.njk | 6 ++++++ 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/integration_tests/pages/match/searchPage.ts b/integration_tests/pages/match/searchPage.ts index b3e237978c..1ebbf628a3 100644 --- a/integration_tests/pages/match/searchPage.ts +++ b/integration_tests/pages/match/searchPage.ts @@ -3,8 +3,6 @@ import { Cas1SpaceSearchResult, Cas1SpaceSearchResults, PlacementRequestDetail } import Page from '../page' import { placementRequestSummaryListForMatching, summaryCardRows } from '../../../server/utils/match' import paths from '../../../server/paths/match' -import { isFullPerson } from '../../../server/utils/personUtils' -import { DateFormats } from '../../../server/utils/dateUtils' import { occupancyCriteriaMap } from '../../../server/utils/match/occupancy' export default class SearchPage extends Page { @@ -22,18 +20,6 @@ export default class SearchPage extends Page { this.shouldShowMatchingDetails(placementRequest) } - shouldShowKeyPersonDetails(placementRequest: PlacementRequestDetail) { - cy.get('.prisoner-info').within(() => { - const { person } = placementRequest - if (!isFullPerson(person)) throw new Error('test requires a Full Person') - - cy.get('span').contains(person.name) - cy.get('span').contains(`CRN: ${person.crn}`) - cy.get('span').contains(`Tier: ${placementRequest?.risks?.tier?.value.level}`) - cy.get('span').contains(`Date of birth: ${DateFormats.isoDateToUIDate(person.dateOfBirth, { format: 'short' })}`) - }) - } - shouldShowMatchingDetails(placementRequest: PlacementRequestDetail) { cy.get('.govuk-details').within(() => { this.shouldContainSummaryListItems(placementRequestSummaryListForMatching(placementRequest)) diff --git a/integration_tests/pages/page.ts b/integration_tests/pages/page.ts index 9b37fbd633..7b116b9e8e 100644 --- a/integration_tests/pages/page.ts +++ b/integration_tests/pages/page.ts @@ -9,6 +9,7 @@ import { Person, PersonAcctAlert, PersonStatus, + PlacementRequestDetail, PrisonCaseNote, SortOrder, TimelineEvent, @@ -21,6 +22,7 @@ import { sentenceCase } from '../../server/utils/utils' import { SumbmittedApplicationSummaryCards } from '../../server/utils/applications/submittedApplicationSummaryCards' import { eventTypeTranslations } from '../../server/utils/applications/utils' import { oasysSectionsToExclude } from '../../server/utils/oasysImportUtils' +import { isFullPerson } from '../../server/utils/personUtils' export type PageElement = Cypress.Chainable @@ -622,4 +624,16 @@ export default abstract class Page { clickMenuItem(label: string): void { cy.get('[aria-label="Primary navigation"] a').contains(label).click() } + + shouldShowKeyPersonDetails(placementRequest: PlacementRequestDetail) { + cy.get('.prisoner-info').within(() => { + const { person } = placementRequest + if (!isFullPerson(person)) throw new Error('test requires a Full Person') + + cy.get('span').contains(person.name) + cy.get('span').contains(`CRN: ${person.crn}`) + cy.get('span').contains(`Tier: ${placementRequest?.risks?.tier?.value.level}`) + cy.get('span').contains(`Date of birth: ${DateFormats.isoDateToUIDate(person.dateOfBirth, { format: 'short' })}`) + }) + } } diff --git a/integration_tests/tests/admin/placementRequests.cy.ts b/integration_tests/tests/admin/placementRequests.cy.ts index f248effbdd..7f4a21004e 100644 --- a/integration_tests/tests/admin/placementRequests.cy.ts +++ b/integration_tests/tests/admin/placementRequests.cy.ts @@ -144,6 +144,9 @@ context('Placement Requests', () => { // Then I should be taken to the placement request page let showPage = Page.verifyOnPage(ShowPage, unmatchedPlacementRequest) + // And I should see the Key-person details in the blue banner + showPage.shouldShowKeyPersonDetails(unmatchedPlacementRequest) + // And I should see the information about the placement request showPage.shouldShowSummary() showPage.shouldShowMatchingInformationSummary() diff --git a/server/views/admin/placementRequests/show.njk b/server/views/admin/placementRequests/show.njk index 6c9f295046..0a4fdabe54 100644 --- a/server/views/admin/placementRequests/show.njk +++ b/server/views/admin/placementRequests/show.njk @@ -2,10 +2,16 @@ {%- from "moj/components/identity-bar/macro.njk" import mojIdentityBar -%} {% from "govuk/components/notification-banner/macro.njk" import govukNotificationBanner %} +{% from "../../components/keyDetails/macro.njk" import keyDetails %} {% extends "../../partials/layout.njk" %} {% set pageTitle = applicationName + " - View Placement Request" %} +{% block header %} + {{ super() }} + {{ keyDetails(MatchUtils.keyDetails(placementRequest)) }} +{% endblock %} + {% block content %} {% include "../../_messages.njk" %}