Skip to content

Commit

Permalink
CMG-107 align error page with CCARD (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
carloveo-moj authored Mar 28, 2024
1 parent 9c4214c commit 6e6e6c2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
2 changes: 1 addition & 1 deletion server/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export default function createApp(services: Services): express.Application {
app.use(authorisationMiddleware())
app.use(setUpCsrf())
app.use(setUpCurrentUser(services))
app.use('/:nomsId', populateCurrentPrisoner(services.prisonerSearchService))
app.get('*', getFrontendComponents(services))
app.use('/:nomsId', populateCurrentPrisoner(services.prisonerSearchService))

app.use(routes(services))

Expand Down
5 changes: 2 additions & 3 deletions server/middleware/populateCurrentPrisoner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ export default function populateCurrentPrisoner(prisonerSearchService: PrisonerS
if (username && nomsId) {
try {
const prisoner = await prisonerSearchService.getPrisonerDetails(nomsId, caseloads, username)
if (caseloads.includes(prisoner.prisonId)) {
res.locals.prisoner = prisoner
} else {
res.locals.prisoner = prisoner
if (!caseloads.includes(prisoner.prisonId)) {
throw FullPageError.notInCaseLoadError()
}
} catch (error) {
Expand Down
28 changes: 13 additions & 15 deletions server/views/pages/error.njk
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,29 @@

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-xl govuk-!-margin-bottom-6" data-qa="error-heading">
{% if status === 404 and not errorKey %}
<h1 class="govuk-heading-xl" data-qa="error-heading">
{% if errorKey === 'NOT_IN_CASELOAD' %}
The details for this person cannot be found
{% elif status === 404 and not errorKey %}
Page not found
{% else %}
There is a problem
{% endif %}

</h1>

</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
{% if errorKey %}
{% if errorKey === 'NOT_IN_CASELOAD' %}
<p class="govuk-body">The details for this person cannot be found.</p>
<p class="govuk-body"> This could be because this person:</p>
<p class="govuk-body">This could be because this person:</p>
<ul class="govuk-list govuk-list--bullet">
<li>is not in your caseload</li>
<li>has no bookings assigned to them</li>
<li>has no active bookings</li>
<li>offence dates</li>
<li>sentences</li>
<li>adjustments </li>
<li>is not in your case load</li>
<li>has no bookings assigned to them</li>
<li>has no active bookings</li>
</ul>

<p class="govuk-body govuk-!-margin-top-6">
Check the details in NOMIS and then <a href="/">try again</a>.
</p>
<p class="gouk-body">Check the details in NOMIS and then <a class="govuk-link" href="{{ url }}">try again</a>.</p>
{% elif errorKey === 'NO_SENTENCES' %}
<p>There are no active sentences recorded.</p>

Expand Down

0 comments on commit 6e6e6c2

Please sign in to comment.