Skip to content

Commit

Permalink
MAN-190: add lao restricted cases (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmcphee77 authored Dec 3, 2024
1 parent 33c21b2 commit db6867b
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 21 deletions.
4 changes: 4 additions & 0 deletions assets/scss/local.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
min-height: 600px;
}

.govuk-link--text-colour {
color: #0b0c0c;
}

.app-organisation-nav-title {
float: right;
padding-top: 19px;
Expand Down
6 changes: 5 additions & 1 deletion integration_tests/e2e/myCases.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ context('My cases', () => {
cy.visit('/case')
const page = Page.verifyOnPage(YourCasesPage)
page.getRowData('myCases', 'nameOrCrn', 'Value1').should('contain.text', 'X778160')
page.getRowData('myCases', 'dob', 'Value1').should('contain.text', 'X778160')
page.getRowData('myCases', 'dob', 'Value1').should('contain.text', '25 Sep 1975')

page.getRowData('myCases', 'nameOrCrn', 'Value4').should('contain.text', 'Restricted access')
page.getRowData('myCases', 'nameOrCrn', 'Value4').should('contain.text', 'X808126')
page.getRowData('myCases', 'dob', 'Value4').should('contain.text', 'Restricted')
page.getPagination().should('contain.text', 'Showing 1 to 10 of 33 cases.')
})
})
51 changes: 39 additions & 12 deletions server/views/pages/caseload/minimal-cases.njk
Original file line number Diff line number Diff line change
Expand Up @@ -106,31 +106,58 @@
{% set rows = [] %}
{% for case in caseload.caseload %}
{% set fullName %}
{{ case.caseName.surname }}, {{ case.caseName.forename }}
{% if case.limitedAccess === true %}
<span class="govuk-link--text-colour govuk-link--no-visited-state">Restricted access</span>
{% else %}
{{ case.caseName.surname }}, {{ case.caseName.forename }}
{% endif %}
{% endset %}
{% set crn %}
{{ case.crn }}
{% endset %}
{% set sentenceHtml %}
{% if case.numberOfAdditionalSentences > 0 %}
{% if case.limitedAccess === true %}
Restricted
{% elseif case.numberOfAdditionalSentences > 0 %}
{{ case.latestSentence }}<br><a class="govuk-link" href="./case/{{ case.crn }}/sentence">+ {{ case.numberOfAdditionalSentences }} more</a>
{% else %}
{{ case.latestSentence }}
{% endif %}
{% endset %}

{% set lastContactHtml %}
{% if case.limitedAccess === true %}
Restricted
{% elseif case.previousAppointment %}
<a class="govuk-link" href="./case/{{ case.crn }}/activity-log/activity/{{ case.previousAppointment.id }}"> {{ case.previousAppointment.description }} </a><br/><span class="secondary-text">{{ case.previousAppointment.date | dateWithYearShortMonth }}</span>
{% endif %}
{% endset %}

{% set nextContactHtml %}
{% if case.limitedAccess === true %}
Restricted
{% elseif case.nextAppointment %}
<a class="govuk-link" href="./case/{{ case.crn }}/activity-log/activity/{{ case.nextAppointment.id }}"> {{ case.nextAppointment.description }} </a><br/><span class="secondary-text">{{ case.nextAppointment.date | dateWithYearShortMonth }}</span>
{% endif %}
{% endset %}


{% set rows = (rows.push(
[
{ html: "<a class='govuk-!-font-weight-bold' href='./case/" + case.crn + "'>" + fullName + "</a>
</br>
<span class='govuk-!-font-weight-bold secondary-text'>" + crn + "</span>", attributes: { 'data-sort-value': case.caseName.surname, 'data-qa': 'nameOrCrnValue' + loop.index} },
{ html: case.dob | dateWithYearShortMonth + "</br><span class='secondary-text'>Age " + case.dob | yearsSince + "</span>",
attributes: { 'data-sort-value': case.dob, 'data-qa': 'dobValue' + loop.index } },
{ html: sentenceHtml },
{ html: "<a class='govuk-link' href='./case/" + case.crn + "/activity-log/activity/" + case.previousAppointment.id + "'>" + case.previousAppointment.description + "</a></br><span class='secondary-text'>" + case.previousAppointment.date | dateWithYearShortMonth + "</span>", attributes: { "data-sort-value": case.previousAppointment.date } }
if case.previousAppointment,
{ html: "<a class='govuk-link' href='./case/" + case.crn + "/appointments/appointment/" + case.nextAppointment.id + "'>" + case.nextAppointment.description + "</a></br><span class='secondary-text'>" + case.nextAppointment.date | dateWithYearShortMonth + "</span>", attributes: { "data-sort-value": case.nextAppointment.date } }
if case.nextAppointment
{ html: "<a class='govuk-!-font-weight-bold' href='./case/" + case.crn + "'>" + fullName + "</a></br><span class='govuk-!-font-weight-bold secondary-text'>" + crn + "</span>",
attributes: { 'data-qa': 'nameOrCrnValue' + loop.index} },
{ html: case.dob | dateWithYearShortMonth + "</br><span class='secondary-text'>Age " + case.dob | yearsSince + "</span>" if case.dob else "Restricted",
attributes: { 'data-qa': 'dobValue' + loop.index }
},
{ html: sentenceHtml,
attributes: { 'data-qa': 'sentenceValue' + loop.index }
},
{ html: lastContactHtml,
attributes: { 'data-qa': 'lastContactValue' + loop.index }
},
{ html: nextContactHtml,
attributes: { 'data-qa': 'nextContactValue' + loop.index }
}
]
), rows) %}
{% endfor %}
Expand Down
9 changes: 1 addition & 8 deletions wiremock/mappings/caseload.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,8 @@
"numberOfAdditionalSentences": 1
},
{
"caseName": {
"forename": "Cody",
"middleName": "",
"surname": "Watsica"
},
"crn": "X808126",
"dob": "1984-10-03",
"latestSentence": "Adult Custody < 12m",
"numberOfAdditionalSentences": 0
"limitedAccess": true
},
{
"caseName": {
Expand Down

0 comments on commit db6867b

Please sign in to comment.