Skip to content

Commit

Permalink
MAN-21 - update sentence page to new design
Browse files Browse the repository at this point in the history
  • Loading branch information
achimber-moj committed Oct 14, 2024
1 parent d9e1bfd commit 4e66fe4
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 11 deletions.
5 changes: 2 additions & 3 deletions integration_tests/e2e/sentence.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ context('Sentence', () => {
cy.visit('/case/X000001/sentence')
const page = Page.verifyOnPage(SentencePage)
page.headerCrn().should('contain.text', 'X000001')
page.headerName().should('contain.text', 'Eula Schmeler')
page.pageHeading().should('contain.text', 'Sentence: 3')
page.pageHeading().should('contain.text', 'Sentence: 1')
page.headerName().should('contain.text', 'Caroline Wolff')
cy.get('[data-qa=pageHeading]').eq(0).should('contain.text', 'Sentence')

page.getTab('overview').should('contain.text', 'Overview')
page.getTab('personalDetails').should('contain.text', 'Personal details')
Expand Down
21 changes: 13 additions & 8 deletions server/views/pages/sentence.njk
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,31 @@
{% endblock %}

{% block pageContent %}

{%- from "moj/components/side-navigation/macro.njk" import mojSideNavigation -%}
<div class="govuk-grid-row">
<div class="govuk-grid-column-one-quarter">
{% set items = [] %}
{% for sentence in sentenceDetails.sentences %}
{% if loop.first %}
{% set items = items.concat({"text": sentence.order.description, href: "#" + sentence.offenceDetails.eventNumber, active: true}) %}
{% else %}
{% set items = items.concat({"text": sentence.order.description, href: "#" + sentence.offenceDetails.eventNumber}) %}
{% endif %}
{% set items = items.concat(
{
"text": sentence.order.description,
href: "#sentence-" + loop.index
}
)
%}
{% endfor %}

{% set items = items.concat({"text": "Probation History", href: "#probation-history"}) %}

{{ mojSideNavigation({
label: 'Side navigation',
items: items
items: items,
classes: 'govuk-!-padding-top-0'
}) }}
</div>
<div class="govuk-grid-column-three-quarters">
{% for sentence in sentenceDetails.sentences %}
<h2 class="govuk-heading-m govuk-!-margin-bottom-2" data-qa="pageHeading">{{ sentence.order.description }}</h2>
<h2 class="govuk-heading-m govuk-!-margin-bottom-2" id="sentence-{{ loop.index }}" data-qa="pageHeading">{{ sentence.order.description }}</h2>

{% set hasAdditionalOffences = sentence.offenceDetails.additionalOffences and sentence.offenceDetails.additionalOffences.length > 0 %}
{% set additionalOffences %}
Expand Down Expand Up @@ -265,6 +269,7 @@
}) }}
{%- endfor %}

<h2 class="govuk-heading-m govuk-!-margin-bottom-2" id="probation-history" data-qa="pageHeading">Probation History</h2>
{% set history %}
{% set previousOrders %}
{% if sentenceDetails.probationHistory.numberOfTerminatedEvents == 1 %}
Expand Down
141 changes: 141 additions & 0 deletions wiremock/mappings/X778160-sentence.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"mappings": [
{
"request": {
"urlPattern": "/mas/sentence/X778160",
"method": "GET"
},
"response": {
"status": 200,
"jsonBody": {
"personSummary": {
"name": {
"forename": "Berge",
"surname": "Alton"
},
"crn": "X778160",
"dateOfBirth": "2012-03-13"
},
"sentences": [
{
"offenceDetails": {
"eventNumber": 1,
"offence": {
"description": "Burglary",
"count": 3
},
"dateOfOffence": "2024-03-20",
"notes": "overview",
"additionalOffences": [
{
"description": "Assault",
"count": 1
}
]
},
"conviction": {
"sentencingCourt": "Hull Court",
"responsibleCourt": "Birmingham Court",
"convictionDate": "2024-03-20",
"additionalSentences": [
{
"length": 3,
"description": "Disqualified from Driving"
}
]
},
"order": {
"description": "Default Sentence Type",
"length": 12,
"endDate": "2025-03-19",
"startDate": "2024-03-19"
},
"requirements": [
{
"code": "F",
"actualStartDate": "2024-04-12",
"description": "12 days RAR, 1 completed",
"length": 12,
"notes": "my notes",
"rar": {
"completed": 1,
"scheduled": 11,
"totalDays": 12
}
},
{
"code": "RM49",
"expectedStartDate": "2024-01-07",
"actualStartDate": "2024-01-12",
"expectedEndDate": "2024-03-10",
"actualEndDate": "2024-01-09",
"terminationReason": "Expired (Normal)",
"description": "Curfew (Electronic Monitored)",
"length": "10",
"lengthUnitValue": "Hours",
"notes": "curfew notes"
},
{
"code": "W",
"actualStartDate": "2015-05-22",
"description": "Unpaid Work - Regular",
"length": 100,
"lengthUnitValue": "Hours",
"notes": "unpaid work notes"
}
],
"courtDocuments": [
{
"id": "4d74f43c-5b42-4317-852e-56c7d29b610b",
"lastSaved": "2024-04-03",
"documentName": "Pre-sentence report"
},
{
"id": "6037becb-0d0c-44e1-8727-193f22df0494",
"lastSaved": "2024-04-01",
"documentName": "CPS Pack"
},
{
"id": "d072ed9a-999f-4333-a116-a871a845aeb3",
"lastSaved": "",
"documentName": "Previous convictions"
}
],
"unpaidWorkProgress": "7 minutes completed (of 100 hours)"
}
],
"probationHistory": {
"numberOfTerminatedEvents": 2,
"dateOfMostRecentTerminatedEvent": "2011-01-21",
"numberOfTerminatedEventBreaches": 2,
"numberOfProfessionalContacts": 3
}
},
"headers": {
"Content-Type": "application/json"
}
}
},
{
"request": {
"urlPattern": "/mas/personal-details/X000001/document/4d74f43c-5b42-4317-852e-56c7d29b610b",
"method": "GET"
},
"response": {
"status": 200,
"bodyFileName": "document.pdf",
"headers": {
"content-type": "application/msword;charset=UTF-8",
"content-length": "14812",
"content-disposition": "attachment; filename=\"doc1\"; filename*=UTF-8''doc1",
"accept-ranges": "bytes",
"content-range": "bytes 0-14811/14812",
"cache-control": "max-age=0, must-revalidate",
"etag": "1699630109776",
"last-modified": "Fri, 10 Nov 2023 15:28:29 GMT",
"Custom-Alfresco-Header": "should be ignored"
}
}
}
]
}

0 comments on commit 4e66fe4

Please sign in to comment.