Skip to content

Commit

Permalink
Placement request page - add blue banner
Browse files Browse the repository at this point in the history
  • Loading branch information
gregkhawkins committed Dec 30, 2024
1 parent 3304f9a commit 7252547
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
14 changes: 0 additions & 14 deletions integration_tests/pages/match/searchPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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))
Expand Down
14 changes: 14 additions & 0 deletions integration_tests/pages/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
Person,
PersonAcctAlert,
PersonStatus,
PlacementRequestDetail,
PrisonCaseNote,
SortOrder,
TimelineEvent,
Expand All @@ -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<JQuery>

Expand Down Expand Up @@ -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' })}`)
})
}
}
3 changes: 3 additions & 0 deletions integration_tests/tests/admin/placementRequests.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 6 additions & 0 deletions server/views/admin/placementRequests/show.njk
Original file line number Diff line number Diff line change
Expand Up @@ -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" %}

Expand Down

0 comments on commit 7252547

Please sign in to comment.