diff --git a/server/data/model/sentenceDetails.ts b/server/data/model/sentenceDetails.ts index 859330c8..af2c5457 100644 --- a/server/data/model/sentenceDetails.ts +++ b/server/data/model/sentenceDetails.ts @@ -15,6 +15,7 @@ export interface Sentence { requirements: Requirement[] courtDocuments: CourtDocument[] unpaidWorkProgress: string + licenceConditions: LicenceCondition[] } export interface OffenceDetails { mainOffence: Offence @@ -67,6 +68,20 @@ export interface CourtDocument { documentName: string } +export interface LicenceCondition { + mainDescription: string + subTypeDescription: string + imposedReleasedDate: string + actualStartDate: string + notes: LicenceConditionNote[] +} + +export interface LicenceConditionNote { + createdBy: string + createdByDate: string + note: string + hasNotesBeenTruncated: boolean +} export interface ProbationHistory { numberOfTerminatedEvents: number dateOfMostRecentTerminatedEvent: string diff --git a/server/views/pages/sentence.njk b/server/views/pages/sentence.njk index b384d59b..2f185eea 100644 --- a/server/views/pages/sentence.njk +++ b/server/views/pages/sentence.njk @@ -116,6 +116,50 @@ {% endfor %} {% endset %} + + {% set hasLicenceConditions = sentence.licenceConditions and sentence.licenceConditions.length > 0 %} + + {% set notes = '' %} + {% set licenceConditions %} + {% for licenceCondition in sentence.licenceConditions %} + {% for lcNote in licenceCondition.notes %} + {% set notes %} +

{{ lcNote.note }}

Comment added by {{ lcNote.createdBy }} on {{ lcNote.createdByDate | dateWithYear }}

+ {% endset %} + {% else %} + {% set notes = 'No notes' %} + {% endfor %} + {% set licenceHtml %} + {{ govukSummaryList({ + rows: [ + { + key: { text: 'Subtype' }, + value: { text: licenceCondition.subTypeDescription } + } if licenceCondition.subTypeDescription, + { + key: { text: 'Imposed (Release) date' }, + value: { text: licenceCondition.imposedReleasedDate | dateWithYear } + }, + { + key: { text: 'Actual Start date' }, + value: { text: licenceCondition.actualStartDate | dateWithYear } + } if licenceCondition.actualStartDate, + { + key: { text: 'Notes' }, + value: { html: notes } + } if licenceCondition.notes + ] + }) }} + {% endset %} + {{ govukDetails({ + classes: 'govuk-!-margin-bottom-1', + summaryText: licenceCondition.mainDescription, + html: licenceHtml + }) }} + {% endfor %} + {% endset %} + + {% set hasRequirements = sentence.requirements and sentence.requirements.length > 0 %} {% set requirements %} {% for requirement in sentence.requirements %} @@ -230,10 +274,14 @@ key: { text: "Time elapsed" }, value: { html: '' + sentence.order.startDate | monthsOrDaysElapsed + ' (of ' + sentence.order.length + ' months)' | nl2br if sentence.order.startDate else 'No details' + '' } }, + { + key: { text: "Licence Conditions" }, + value: { html: licenceConditions} + } if hasLicenceConditions, { key: { text: "Requirements" }, - value: { html: '' + requirements if hasRequirements else 'No requirements' + ''} - }, + value: { html: '' + requirements + ''} + } if hasRequirements, { key: { text: "Unpaid Work Progress" }, value: { html: '' + sentence.unpaidWorkProgress + '' } diff --git a/wiremock/mappings/X000001-sentence.json b/wiremock/mappings/X000001-sentence.json index f8253dec..81a53a51 100644 --- a/wiremock/mappings/X000001-sentence.json +++ b/wiremock/mappings/X000001-sentence.json @@ -54,40 +54,7 @@ "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" - } - ], + "requirements": [], "courtDocuments": [ { "id": "4d74f43c-5b42-4317-852e-56c7d29b610b", @@ -105,7 +72,41 @@ "documentName": "Previous convictions" } ], - "unpaidWorkProgress": "7 minutes completed (of 100 hours)" + "licenceConditions": [ + { + "mainDescription": "Alcohol Monitoring (Electronic Monitoring)", + "subTypeDescription": "You must not drink any alcohol until [END DATE].", + "imposedReleasedDate": "2024-12-25", + "actualStartDate": "2024-12-26", + "notes": [ + { + "createdBy": "Jon Jones", + "createdByDate": "2024-08-21", + "note": "You must not drink any alcohol until [END DATE]. You will need to wear an electronic tag all the time so we can check this", + "hasNotesBeenTruncated": true + } + ] + }, + { + "mainDescription": "Residence at a specific place", + "subTypeDescription": "Bespoke Condition (See Notes)", + "imposedReleasedDate": "2024-10-03", + "actualStartDate": "2023-11-15", + "notes": [ + { + "createdBy": "Mark Smith", + "createdByDate": "2023-10-04", + "note": "James must reside at his parent's house in Scotland for the duration of his release on licence.", + "hasNotesBeenTruncated": false + } + ] + }, + { + "mainDescription": "Licence - Prohibited Activity", + "imposedReleasedDate": "2023-09-26", + "notes": [] + } + ] }, { "offenceDetails": { @@ -127,7 +128,43 @@ "endDate": "2025-01-31", "startDate": "2024-02-01" }, - "requirements": [] + "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": [], + "unpaidWorkProgress": "3 minutes completed (of 12 hours)", + "licenceConditions": [] } ], "probationHistory": { diff --git a/wiremock/mappings/X778160-sentence.json b/wiremock/mappings/X778160-sentence.json index ce1072de..7a7b5ed7 100644 --- a/wiremock/mappings/X778160-sentence.json +++ b/wiremock/mappings/X778160-sentence.json @@ -50,40 +50,7 @@ "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" - } - ], + "requirements": [], "courtDocuments": [ { "id": "4d74f43c-5b42-4317-852e-56c7d29b610b", @@ -101,7 +68,8 @@ "documentName": "Previous convictions" } ], - "unpaidWorkProgress": "7 minutes completed (of 100 hours)" + "unpaidWorkProgress": "7 minutes completed (of 100 hours)", + "licenceConditions": [] } ], "probationHistory": {