Skip to content

Commit

Permalink
MAN-299 display staff contacts card on personal details page
Browse files Browse the repository at this point in the history
  • Loading branch information
neil-mills committed Feb 5, 2025
1 parent df5dcf4 commit 6581441
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 16 deletions.
3 changes: 3 additions & 0 deletions server/routes/personalDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ArnsApiClient from '../data/arnsApiClient'
import TierApiClient from '../data/tierApiClient'
import type { Route } from '../@types'
import { toPredictors, toRoshWidget } from '../utils/utils'
import renders from '../controllers/renders'

export default function personalDetailRoutes(router: Router, { hmppsAuthClient }: Services) {
const get = (path: string | string[], handler: Route<void>) => router.get(path, asyncMiddleware(handler))
Expand Down Expand Up @@ -47,6 +48,8 @@ export default function personalDetailRoutes(router: Router, { hmppsAuthClient }
})
})

get('/case/:crn/personal-details/staff-contacts', renders.staffContacts(hmppsAuthClient))

get('/case/:crn/personal-details/personal-contact/:id', async (req, res, _next) => {
const { crn } = req.params
const { id } = req.params
Expand Down
14 changes: 10 additions & 4 deletions server/views/pages/personal-details.njk
Original file line number Diff line number Diff line change
Expand Up @@ -359,16 +359,15 @@
attributes: {'data-qa': 'identityNumberCard'},
titleText: "Identity numbers",
classes: 'govuk-!-margin-bottom-6 app-summary-card--large-title',
html: identityNumbers,
actions: {}
html: identityNumbers
}) }}

{% if personalDetails.staffContacts %}
{% set staffContactRows = [] %}
{% for staffContact in personalDetails.staffContacts %}
{% set staffContactRows = (staffContactRows.push({
key: { html: '<span data-qa="staffContactRoleLabel">' + staffContact.role + '</span><br><span class="govuk-body-s secondary-text" data-qa="staffContactLastUpdatedLabel">Last updated ' + staffContact.lastUpdated | dateWithYear + '</span>' },
value: { html: '<a href="/case/' + crn + '/personal-details/staff-contacts/' + staffContact.contactId + '" data-qa="staffContactNameValue">' + staffContact.name + '</a>' }
value: { html: '<span data-qa="staffContactNameValue">' + staffContact.name + '</span>' }
}), staffContactRows) %}
{% endfor %}

Expand All @@ -383,7 +382,14 @@
titleText: "Staff contacts",
classes: 'govuk-!-margin-bottom-6 app-summary-card--large-title',
html: staffContactList,
actions: {}
actions: {
items: [
{
text: 'View staff contacts',
href: '/case/' + crn + '/personal-details/staff-contacts'
}
]
}
}) }}
{% endif %}

Expand Down
33 changes: 21 additions & 12 deletions wiremock/mappings/X000001-full.json
Original file line number Diff line number Diff line change
Expand Up @@ -321,28 +321,37 @@
],
"staffContacts": [
{
"contactId": "123",
"name": "Arhsimna Xolfo",
"email": "",
"telephoneNumber": "",
"role": "Prison Offender Manager (POM)",
"lastUpdated": "2024-11-15"
"email": "[email protected]",
"telephoneNumber": "07321165373",
"provider": "London",
"probationDeliveryUnit": "All London",
"team": "Unallocated Team (N07)",
"allocatedUntil": "2025-04-22",
"lastUpdated": "2024-04-30"
},
{
"contactId": "456",
"name": "Yrhreender Hanandra",
"email": "",
"telephoneNumber": "",
"role": "Community Offender Manager (COM)",
"lastUpdated": "2024-11-15"
"email": "[email protected]",
"telephoneNumber": "07321165373",
"provider": "London",
"probationDeliveryUnit": "All London",
"team": "Unallocated Team (N07)",
"allocatedUntil": "2025-04-22",
"lastUpdated": "2024-04-30"
},
{
"contactId": "789",
"name": "Iwendeps Yvygsee",
"email": "",
"telephoneNumber": "",
"role": "Probation practitioner",
"lastUpdated": "2024-11-15"
"email": "[email protected]",
"telephoneNumber": "07321165373",
"provider": "London",
"probationDeliveryUnit": "All London",
"team": "Unallocated Team (N07)",
"allocatedUntil": "2025-04-22",
"lastUpdated": "2024-04-30"
}
],
"mainAddress": {
Expand Down

0 comments on commit 6581441

Please sign in to comment.