@ministryofjustice/hmpps-mpop-frontend-components-lib 0.0.5 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -0
- package/dist/MPoPComponents.d.ts +5 -0
- package/dist/components/supervision-package/partials/_early-engagement.test.d.ts +1 -0
- package/dist/components/supervision-package/partials/_progress-bar.test.d.ts +1 -0
- package/dist/components/supervision-package/partials/tags.test.d.ts +1 -0
- package/dist/index.cjs.js +121 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +219 -1
- package/dist/index.esm.js +120 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/mpop/components/supervision-package/_supervision-package.scss +31 -1
- package/dist/mpop/components/supervision-package/partials/_early-engagement.njk +29 -0
- package/dist/mpop/components/supervision-package/partials/_progress-bar.njk +38 -0
- package/dist/mpop/components/supervision-package/partials/_tags.njk +19 -0
- package/dist/mpop/components/supervision-package/template.njk +62 -3
- package/dist/types/MPoPComponentsConfig.d.ts +1 -0
- package/dist/types/PersonSchedule.d.ts +138 -0
- package/dist/types/SupervisionPackage.d.ts +73 -0
- package/dist/utils/hasBreachedSentence.d.ts +8 -0
- package/dist/utils/hasBreachedSentence.test.d.ts +1 -0
- package/dist/utils/isEligibleForDiscretionaryAppointments.d.ts +6 -0
- package/dist/utils/isEligibleForDiscretionaryAppointments.test.d.ts +1 -0
- package/dist/utils/nunjucksFilters.d.ts +2 -0
- package/dist/utils/toTitleCase.d.ts +1 -0
- package/dist/utils/toTitleCase.test.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
# hmpps-mpop-frontend-components-lib
|
|
2
2
|
MPoP front-end library
|
|
3
3
|
|
|
4
|
+
## Usage
|
|
5
|
+
|
|
6
|
+
### Installation
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @ministryofjustice/hmpps-mpop-frontend-components-lib
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
### Nunjucks setup
|
|
13
|
+
|
|
14
|
+
The components in this library use custom Nunjucks filters. You must register them with your Nunjucks environment before rendering any components, otherwise you will see a `filter not found` error.
|
|
15
|
+
|
|
16
|
+
Call `mpopNunjucksSetup` once when configuring your application:
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import nunjucks from 'nunjucks'
|
|
20
|
+
import { mpopNunjucksSetup } from '@ministryofjustice/hmpps-mpop-frontend-components-lib'
|
|
21
|
+
|
|
22
|
+
const env = nunjucks.configure([...])
|
|
23
|
+
mpopNunjucksSetup(env)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### SCSS
|
|
27
|
+
|
|
28
|
+
Import the component styles in your SCSS entry point:
|
|
29
|
+
|
|
30
|
+
```scss
|
|
31
|
+
@import '@ministryofjustice/hmpps-mpop-frontend-components-lib/dist/all';
|
|
32
|
+
```
|
|
33
|
+
|
|
4
34
|
## Releasing
|
|
5
35
|
|
|
6
36
|
This package is published to npm using GitHub Releases and npm Trusted Publishing.
|
package/dist/MPoPComponents.d.ts
CHANGED
|
@@ -4,11 +4,16 @@ import type Logger from 'bunyan';
|
|
|
4
4
|
import type { MPoPComponentsConfig } from './types/MPoPComponentsConfig';
|
|
5
5
|
import type { LatestTierResponse, TierTag } from './types/TierCalculation';
|
|
6
6
|
import type { PersonalDetailsResponse } from './types/PersonalDetails';
|
|
7
|
+
import type { SupervisionPackageResponse } from './types/SupervisionPackage';
|
|
8
|
+
import { PersonScheduleResponse } from './types/PersonSchedule';
|
|
7
9
|
export declare const tierTags: Record<string, TierTag>;
|
|
8
10
|
export default class MPoPComponents {
|
|
9
11
|
private readonly tierApiRestClient;
|
|
10
12
|
private readonly masApiRestClient;
|
|
13
|
+
private readonly supervisionPackageApiRestClient;
|
|
11
14
|
constructor(authenticationClient: AuthenticationClient, config: MPoPComponentsConfig, logger?: Logger | Console);
|
|
12
15
|
getTierDetails(authOptions: AuthOptions | string, crn: string): Promise<LatestTierResponse>;
|
|
13
16
|
getPersonalDetails(authOptions: AuthOptions | string, crn: string): Promise<PersonalDetailsResponse>;
|
|
17
|
+
getSupervisionPackage(authOptions: AuthOptions | string, crn: string): Promise<SupervisionPackageResponse>;
|
|
18
|
+
getPersonSchedule(authOptions: AuthOptions | string, crn: string, type?: 'upcoming' | 'previous', page?: string, size?: string, sortBy?: string): Promise<PersonScheduleResponse>;
|
|
14
19
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.cjs.js
CHANGED
|
@@ -42,9 +42,10 @@ const tierTags = {
|
|
|
42
42
|
};
|
|
43
43
|
class MPoPComponents {
|
|
44
44
|
constructor(authenticationClient, config, logger = console) {
|
|
45
|
-
var _a;
|
|
45
|
+
var _a, _b;
|
|
46
46
|
this.tierApiRestClient = new SuppressingRestClient(new hmppsRestClient.RestClient('Tier API', config, logger, authenticationClient), logger);
|
|
47
47
|
this.masApiRestClient = new SuppressingRestClient(new hmppsRestClient.RestClient('MAS API', (_a = config.masApiConfig) !== null && _a !== void 0 ? _a : config, logger, authenticationClient), logger);
|
|
48
|
+
this.supervisionPackageApiRestClient = new SuppressingRestClient(new hmppsRestClient.RestClient('Supervision Package API', (_b = config.supervisionPackageApiConfig) !== null && _b !== void 0 ? _b : config, logger, authenticationClient), logger);
|
|
48
49
|
}
|
|
49
50
|
async getTierDetails(authOptions, crn) {
|
|
50
51
|
let error = null;
|
|
@@ -103,17 +104,17 @@ class MPoPComponents {
|
|
|
103
104
|
}
|
|
104
105
|
async getPersonalDetails(authOptions, crn) {
|
|
105
106
|
let error = null;
|
|
106
|
-
let
|
|
107
|
+
let personalDetailsResponse;
|
|
107
108
|
try {
|
|
108
109
|
const response = await this.masApiRestClient.get(`/personal-details/${crn}/summary`, authOptions);
|
|
109
110
|
if (!response) {
|
|
110
|
-
|
|
111
|
+
personalDetailsResponse = {
|
|
111
112
|
personalDetails: null,
|
|
112
113
|
httpStatus: 404,
|
|
113
114
|
};
|
|
114
115
|
}
|
|
115
116
|
else {
|
|
116
|
-
|
|
117
|
+
personalDetailsResponse = {
|
|
117
118
|
personalDetails: { ...response, age: yearsSince(response.dateOfBirth) },
|
|
118
119
|
httpStatus: 200,
|
|
119
120
|
};
|
|
@@ -122,17 +123,131 @@ class MPoPComponents {
|
|
|
122
123
|
catch (err) {
|
|
123
124
|
error = err instanceof Error ? err : new Error('500 Internal Server Error');
|
|
124
125
|
const responseStatus = err === null || err === void 0 ? void 0 : err.responseStatus;
|
|
125
|
-
|
|
126
|
+
personalDetailsResponse = {
|
|
126
127
|
personalDetails: null,
|
|
127
128
|
httpStatus: responseStatus !== null && responseStatus !== void 0 ? responseStatus : 500,
|
|
128
129
|
};
|
|
129
130
|
}
|
|
130
131
|
return {
|
|
131
|
-
...
|
|
132
|
+
...personalDetailsResponse,
|
|
133
|
+
error,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
async getSupervisionPackage(authOptions, crn) {
|
|
137
|
+
let error = null;
|
|
138
|
+
let supervisionPackageResponse;
|
|
139
|
+
try {
|
|
140
|
+
const response = await this.supervisionPackageApiRestClient.get(`/case/${crn}/current-phase`, authOptions);
|
|
141
|
+
if (!response) {
|
|
142
|
+
supervisionPackageResponse = {
|
|
143
|
+
supervisionPackage: null,
|
|
144
|
+
httpStatus: 404,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
supervisionPackageResponse = {
|
|
149
|
+
supervisionPackage: response,
|
|
150
|
+
httpStatus: 200,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
catch (err) {
|
|
155
|
+
const responseStatus = err === null || err === void 0 ? void 0 : err.responseStatus;
|
|
156
|
+
error = err instanceof Error ? err : new Error('500 Internal Server Error');
|
|
157
|
+
supervisionPackageResponse = {
|
|
158
|
+
supervisionPackage: null,
|
|
159
|
+
httpStatus: responseStatus !== null && responseStatus !== void 0 ? responseStatus : 500,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
return {
|
|
163
|
+
...supervisionPackageResponse,
|
|
164
|
+
error,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
async getPersonSchedule(authOptions, crn, type = 'upcoming', page = '0', size = '1', sortBy = '&sortBy=date&ascending=true') {
|
|
168
|
+
let error = null;
|
|
169
|
+
let personScheduleResponse;
|
|
170
|
+
try {
|
|
171
|
+
const queryParameters = `?${new URLSearchParams({ size, page }).toString()}${sortBy !== null && sortBy !== void 0 ? sortBy : ''}`;
|
|
172
|
+
const response = await this.masApiRestClient.get(`/schedule/${crn}/${type}${queryParameters}`, authOptions);
|
|
173
|
+
if (!response) {
|
|
174
|
+
personScheduleResponse = {
|
|
175
|
+
personSchedule: null,
|
|
176
|
+
httpStatus: 404,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
personScheduleResponse = {
|
|
181
|
+
personSchedule: response,
|
|
182
|
+
httpStatus: 200,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
catch (err) {
|
|
187
|
+
const responseStatus = err === null || err === void 0 ? void 0 : err.responseStatus;
|
|
188
|
+
error = err instanceof Error ? err : new Error('500 Internal Server Error');
|
|
189
|
+
personScheduleResponse = {
|
|
190
|
+
personSchedule: null,
|
|
191
|
+
httpStatus: responseStatus !== null && responseStatus !== void 0 ? responseStatus : 500,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
return {
|
|
195
|
+
...personScheduleResponse,
|
|
132
196
|
error,
|
|
133
197
|
};
|
|
134
198
|
}
|
|
135
199
|
}
|
|
136
200
|
|
|
201
|
+
const govukTime = (datetimeString) => {
|
|
202
|
+
if (!datetimeString || isBlank(datetimeString))
|
|
203
|
+
return null;
|
|
204
|
+
const datetime = luxon.DateTime.fromISO(datetimeString);
|
|
205
|
+
if (!datetime.isValid)
|
|
206
|
+
return null;
|
|
207
|
+
const hourMinuteFormat = datetime.minute === 0 ? 'ha' : 'h:mma';
|
|
208
|
+
return datetime.toFormat(hourMinuteFormat).toLowerCase();
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
const dateWithYear = (datetimeString, showTime = false) => {
|
|
212
|
+
if (!datetimeString || isBlank(datetimeString))
|
|
213
|
+
return null;
|
|
214
|
+
const dt = luxon.DateTime.fromISO(datetimeString, { zone: 'Europe/London' });
|
|
215
|
+
if (!dt.isValid)
|
|
216
|
+
return null;
|
|
217
|
+
const time = showTime ? govukTime(datetimeString) : null;
|
|
218
|
+
return `${dt.toFormat('d MMMM yyyy')}${time ? ` at ${time}` : ''}`;
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
const toTitleCase = (value) => {
|
|
222
|
+
if (!value)
|
|
223
|
+
return '';
|
|
224
|
+
const preservedWords = ['(NS)', '(Non', 'NS)'];
|
|
225
|
+
const lower = value.toLowerCase();
|
|
226
|
+
const titleCased = `${lower.charAt(0).toUpperCase()}${lower.substring(1)}`;
|
|
227
|
+
return preservedWords.reduce((result, word) => {
|
|
228
|
+
const escaped = word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
229
|
+
return result.replace(new RegExp(escaped, 'gi'), word);
|
|
230
|
+
}, titleCased);
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
const hasBreachedSentence = (sentences) => Array.isArray(sentences) &&
|
|
234
|
+
sentences.some(sentence => { var _a; return ((_a = sentence === null || sentence === void 0 ? void 0 : sentence.supervisionPackage) === null || _a === void 0 ? void 0 : _a.code) !== 'SPX' && (sentence === null || sentence === void 0 ? void 0 : sentence.inBreach) === true; });
|
|
235
|
+
|
|
236
|
+
const eligibleTiers = ['C', 'D', 'E', 'F', 'G'];
|
|
237
|
+
const isEligibleForDiscretionaryAppointments = (inputs, tierScore) => (inputs === null || inputs === void 0 ? void 0 : inputs.gender) === 'Female' &&
|
|
238
|
+
!(inputs === null || inputs === void 0 ? void 0 : inputs.integratedOffenderManagementRedRated) &&
|
|
239
|
+
!!tierScore &&
|
|
240
|
+
eligibleTiers.includes(tierScore);
|
|
241
|
+
|
|
242
|
+
const mpopNunjucksSetup = (env) => {
|
|
243
|
+
env.addFilter('dateWithYear', dateWithYear);
|
|
244
|
+
env.addFilter('govukTime', govukTime);
|
|
245
|
+
env.addFilter('toTitleCase', toTitleCase);
|
|
246
|
+
env.addFilter('hasBreachedSentence', hasBreachedSentence);
|
|
247
|
+
env.addFilter('isEligibleForDiscretionaryAppointments', isEligibleForDiscretionaryAppointments);
|
|
248
|
+
};
|
|
249
|
+
|
|
137
250
|
exports.MPoPComponents = MPoPComponents;
|
|
251
|
+
exports.addFilters = mpopNunjucksSetup;
|
|
252
|
+
exports.mpopNunjucksSetup = mpopNunjucksSetup;
|
|
138
253
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/SuppressingRestClient.ts","../src/utils/isBlank.ts","../src/utils/yearsSince.ts","../src/MPoPComponents.ts"],"sourcesContent":[null,null,null,null],"names":["DateTime","RestClient"],"mappings":";;;;;MAGa,qBAAqB,CAAA;IAChC,WAAA,CACmB,UAAsB,EACtB,MAAwB,EAAA;QADxB,IAAA,CAAA,UAAU,GAAV,UAAU;QACV,IAAA,CAAA,MAAM,GAAN,MAAM;IACtB;AAEH,IAAA,MAAM,GAAG,CAAI,IAAY,EAAE,WAAiC,EAAA;AAC1D,QAAA,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CACxB;YACE,IAAI;YACJ,YAAY,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,KAAI;AAC3C,gBAAA,IAAI,KAAK,CAAC,cAAc,KAAK,GAAG,EAAE;oBAChC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA,iCAAA,EAAoC,MAAM,CAAA,EAAA,EAAK,WAAW,CAAA,CAAE,CAAC;AAC/E,oBAAA,OAAO,IAAI;gBACb;AACA,gBAAA,MAAM,KAAK;YACb,CAAC;SACF,EACD,WAAW,CACZ;IACH;AACD;;ACxBM,MAAM,OAAO,GAAG,CAAC,GAAW,KAAc,CAAC,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC;;ACGnE,MAAM,UAAU,GAAG,CAAC,cAAsB,KAAmB;AAClE,IAAA,IAAI,CAAC,cAAc,IAAI,OAAO,CAAC,cAAc,CAAC;AAAE,QAAA,OAAO,IAAI;AAE3D,IAAA,MAAM,EAAE,GAAGA,cAAQ,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;IACtE,IAAI,CAAC,EAAE,CAAC,OAAO;AAAE,QAAA,OAAO,IAAI;IAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAACA,cAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;AAC5E,IAAA,OAAO,KAAK,CAAC,QAAQ,EAAE;AACzB,CAAC;;
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/SuppressingRestClient.ts","../src/utils/isBlank.ts","../src/utils/yearsSince.ts","../src/MPoPComponents.ts","../src/utils/govukTime.ts","../src/utils/dateWithYear.ts","../src/utils/toTitleCase.ts","../src/utils/hasBreachedSentence.ts","../src/utils/isEligibleForDiscretionaryAppointments.ts","../src/utils/nunjucksFilters.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null],"names":["DateTime","RestClient"],"mappings":";;;;;MAGa,qBAAqB,CAAA;IAChC,WAAA,CACmB,UAAsB,EACtB,MAAwB,EAAA;QADxB,IAAA,CAAA,UAAU,GAAV,UAAU;QACV,IAAA,CAAA,MAAM,GAAN,MAAM;IACtB;AAEH,IAAA,MAAM,GAAG,CAAI,I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,EAAE,mBAAmB,CAAC;AACzD,IAAA,GAAG,CAAC,SAAS,CAAC,wCAAwC,EAAE,sCAAsC,CAAC;AACjG;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ApiConfig, AuthOptions } from '@ministryofjustice/hmpps-rest-client';
|
|
2
2
|
import { AuthenticationClient } from '@ministryofjustice/hmpps-auth-clients';
|
|
3
3
|
import Logger from 'bunyan';
|
|
4
|
+
import { Environment } from 'nunjucks';
|
|
4
5
|
|
|
5
6
|
interface MPoPComponentsConfig extends ApiConfig {
|
|
6
7
|
masApiConfig?: ApiConfig;
|
|
8
|
+
supervisionPackageApiConfig?: ApiConfig;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
type TierTag = {
|
|
@@ -45,13 +47,229 @@ type PersonalDetailsSummary = {
|
|
|
45
47
|
age: string | null;
|
|
46
48
|
};
|
|
47
49
|
|
|
50
|
+
type SupervisionPackage = {
|
|
51
|
+
phase: {
|
|
52
|
+
name: {
|
|
53
|
+
code: string;
|
|
54
|
+
description: string;
|
|
55
|
+
};
|
|
56
|
+
startDate: string;
|
|
57
|
+
endDate: string;
|
|
58
|
+
};
|
|
59
|
+
earlyEngagement: {
|
|
60
|
+
startDate: string;
|
|
61
|
+
endDate: string;
|
|
62
|
+
weeks: number;
|
|
63
|
+
completed: number;
|
|
64
|
+
};
|
|
65
|
+
currentYear: {
|
|
66
|
+
startDate: string;
|
|
67
|
+
endDate: string;
|
|
68
|
+
isFirstYear: boolean;
|
|
69
|
+
appointments: {
|
|
70
|
+
allowance: number;
|
|
71
|
+
scheduled: number;
|
|
72
|
+
completed: number;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
inputs: {
|
|
76
|
+
date: string;
|
|
77
|
+
gender: string;
|
|
78
|
+
integratedOffenderManagementRedRated: boolean;
|
|
79
|
+
offenderPersonalDisorderPathway: boolean;
|
|
80
|
+
intensiveSupervisionCourt: boolean;
|
|
81
|
+
nationalSecurityDivision: boolean;
|
|
82
|
+
contactSuspendedDate?: string;
|
|
83
|
+
finalThirdEligibility: {
|
|
84
|
+
eligible: boolean;
|
|
85
|
+
since: string;
|
|
86
|
+
};
|
|
87
|
+
sentences: Array<Sentence>;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
type Sentence = {
|
|
91
|
+
eventNumber: string;
|
|
92
|
+
startDate: string;
|
|
93
|
+
endDate: string;
|
|
94
|
+
supervisionPackage: {
|
|
95
|
+
code: string;
|
|
96
|
+
description: string;
|
|
97
|
+
};
|
|
98
|
+
type: {
|
|
99
|
+
code: string;
|
|
100
|
+
description: string;
|
|
101
|
+
isCustodial: boolean;
|
|
102
|
+
};
|
|
103
|
+
custody: {
|
|
104
|
+
status: {
|
|
105
|
+
code: string;
|
|
106
|
+
description: string;
|
|
107
|
+
};
|
|
108
|
+
finalThirdDate: string;
|
|
109
|
+
releases: Array<Release>;
|
|
110
|
+
};
|
|
111
|
+
inBreach: boolean;
|
|
112
|
+
};
|
|
113
|
+
type Release = {
|
|
114
|
+
releaseDate: string;
|
|
115
|
+
recallDate?: string;
|
|
116
|
+
};
|
|
117
|
+
type SupervisionPackageResponse = {
|
|
118
|
+
supervisionPackage: SupervisionPackage | null;
|
|
119
|
+
httpStatus: number;
|
|
120
|
+
error?: Error | null;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
type PersonSchedule = {
|
|
124
|
+
personSummary: {
|
|
125
|
+
name: {
|
|
126
|
+
forename: string;
|
|
127
|
+
middleName?: string;
|
|
128
|
+
surname: string;
|
|
129
|
+
username?: string;
|
|
130
|
+
};
|
|
131
|
+
crn: string;
|
|
132
|
+
offenderId?: number;
|
|
133
|
+
pnc?: string;
|
|
134
|
+
dateOfBirth: string;
|
|
135
|
+
preferredLanguage?: string;
|
|
136
|
+
};
|
|
137
|
+
personSchedule: {
|
|
138
|
+
size: number;
|
|
139
|
+
page: number;
|
|
140
|
+
totalResults: number;
|
|
141
|
+
totalPages: number;
|
|
142
|
+
appointments: Array<Activity>;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
type PersonScheduleResponse = {
|
|
146
|
+
personSchedule: PersonSchedule | null;
|
|
147
|
+
httpStatus: number;
|
|
148
|
+
error?: Error | null;
|
|
149
|
+
};
|
|
150
|
+
type Activity = {
|
|
151
|
+
id: string;
|
|
152
|
+
eventNumber?: string;
|
|
153
|
+
type: string;
|
|
154
|
+
displayName?: string;
|
|
155
|
+
startDateTime: string;
|
|
156
|
+
endDateTime?: string;
|
|
157
|
+
rarToolKit?: string;
|
|
158
|
+
appointmentNotes?: Array<Note>;
|
|
159
|
+
appointmentNote?: Note;
|
|
160
|
+
isSensitive?: boolean;
|
|
161
|
+
hasOutcome?: boolean;
|
|
162
|
+
wasAbsent?: boolean;
|
|
163
|
+
officer?: {
|
|
164
|
+
code?: string;
|
|
165
|
+
name?: {
|
|
166
|
+
forename: string;
|
|
167
|
+
middleName?: string;
|
|
168
|
+
surname: string;
|
|
169
|
+
username?: string;
|
|
170
|
+
};
|
|
171
|
+
teamCode?: string;
|
|
172
|
+
providerCode?: string;
|
|
173
|
+
username?: string;
|
|
174
|
+
};
|
|
175
|
+
isInitial?: boolean;
|
|
176
|
+
isNationalStandard?: boolean;
|
|
177
|
+
location?: {
|
|
178
|
+
code?: string;
|
|
179
|
+
providerCode?: string;
|
|
180
|
+
teamCode?: string;
|
|
181
|
+
officeName?: string;
|
|
182
|
+
buildingName?: string;
|
|
183
|
+
buildingNumber?: string;
|
|
184
|
+
streetName?: string;
|
|
185
|
+
district?: string;
|
|
186
|
+
town?: string;
|
|
187
|
+
county?: string;
|
|
188
|
+
postcode?: string;
|
|
189
|
+
ldu?: string;
|
|
190
|
+
telephoneNumber?: string;
|
|
191
|
+
};
|
|
192
|
+
rescheduled?: boolean;
|
|
193
|
+
rescheduledStaff?: boolean;
|
|
194
|
+
rescheduledPop?: boolean;
|
|
195
|
+
didTheyComply?: boolean;
|
|
196
|
+
absentWaitingEvidence?: boolean;
|
|
197
|
+
enforcementAction?: {
|
|
198
|
+
responseByDate: string;
|
|
199
|
+
};
|
|
200
|
+
rearrangeOrCancelReason?: string;
|
|
201
|
+
rescheduledBy?: {
|
|
202
|
+
forename: string;
|
|
203
|
+
middleName?: string;
|
|
204
|
+
surname: string;
|
|
205
|
+
username?: string;
|
|
206
|
+
};
|
|
207
|
+
repeating?: boolean;
|
|
208
|
+
nonComplianceReason?: string;
|
|
209
|
+
documents?: Array<Document>;
|
|
210
|
+
isRarRelated?: boolean;
|
|
211
|
+
rarCategory?: string;
|
|
212
|
+
acceptableAbsence?: boolean;
|
|
213
|
+
acceptableAbsenceReason?: string;
|
|
214
|
+
isAppointment?: boolean;
|
|
215
|
+
isCommunication?: boolean;
|
|
216
|
+
action?: string;
|
|
217
|
+
isSystemContact?: boolean;
|
|
218
|
+
isEmailOrTextFromPop?: boolean;
|
|
219
|
+
isPhoneCallFromPop?: boolean;
|
|
220
|
+
isEmailOrTextToPop?: boolean;
|
|
221
|
+
isPhoneCallToPop?: boolean;
|
|
222
|
+
isInPast?: boolean;
|
|
223
|
+
isPastAppointment?: boolean;
|
|
224
|
+
countsTowardsRAR?: boolean;
|
|
225
|
+
lastUpdated?: string;
|
|
226
|
+
lastUpdatedBy?: {
|
|
227
|
+
forename: string;
|
|
228
|
+
middleName?: string;
|
|
229
|
+
surname: string;
|
|
230
|
+
username?: string;
|
|
231
|
+
};
|
|
232
|
+
description?: string;
|
|
233
|
+
outcome?: string;
|
|
234
|
+
deliusManaged?: boolean;
|
|
235
|
+
isVisor?: boolean;
|
|
236
|
+
eventId?: number;
|
|
237
|
+
component?: {
|
|
238
|
+
id?: number;
|
|
239
|
+
description?: string;
|
|
240
|
+
type?: string;
|
|
241
|
+
};
|
|
242
|
+
nsiId?: number;
|
|
243
|
+
esupervisionId?: string;
|
|
244
|
+
externalReference?: string;
|
|
245
|
+
isUpdatableContact?: boolean;
|
|
246
|
+
};
|
|
247
|
+
type Note = {
|
|
248
|
+
id: number;
|
|
249
|
+
createdBy?: string;
|
|
250
|
+
createdByDate?: string;
|
|
251
|
+
note: string;
|
|
252
|
+
hasNoteBeenTruncated?: boolean;
|
|
253
|
+
};
|
|
254
|
+
type Document = {
|
|
255
|
+
id: string;
|
|
256
|
+
name: string;
|
|
257
|
+
lastUpdated?: string;
|
|
258
|
+
createdAt?: string;
|
|
259
|
+
};
|
|
260
|
+
|
|
48
261
|
declare class MPoPComponents {
|
|
49
262
|
private readonly tierApiRestClient;
|
|
50
263
|
private readonly masApiRestClient;
|
|
264
|
+
private readonly supervisionPackageApiRestClient;
|
|
51
265
|
constructor(authenticationClient: AuthenticationClient, config: MPoPComponentsConfig, logger?: Logger | Console);
|
|
52
266
|
getTierDetails(authOptions: AuthOptions | string, crn: string): Promise<LatestTierResponse>;
|
|
53
267
|
getPersonalDetails(authOptions: AuthOptions | string, crn: string): Promise<PersonalDetailsResponse>;
|
|
268
|
+
getSupervisionPackage(authOptions: AuthOptions | string, crn: string): Promise<SupervisionPackageResponse>;
|
|
269
|
+
getPersonSchedule(authOptions: AuthOptions | string, crn: string, type?: 'upcoming' | 'previous', page?: string, size?: string, sortBy?: string): Promise<PersonScheduleResponse>;
|
|
54
270
|
}
|
|
55
271
|
|
|
56
|
-
|
|
272
|
+
declare const mpopNunjucksSetup: (env: Environment) => void;
|
|
273
|
+
|
|
274
|
+
export { MPoPComponents, mpopNunjucksSetup as addFilters, mpopNunjucksSetup };
|
|
57
275
|
export type { MPoPComponentsConfig };
|
package/dist/index.esm.js
CHANGED
|
@@ -40,9 +40,10 @@ const tierTags = {
|
|
|
40
40
|
};
|
|
41
41
|
class MPoPComponents {
|
|
42
42
|
constructor(authenticationClient, config, logger = console) {
|
|
43
|
-
var _a;
|
|
43
|
+
var _a, _b;
|
|
44
44
|
this.tierApiRestClient = new SuppressingRestClient(new RestClient('Tier API', config, logger, authenticationClient), logger);
|
|
45
45
|
this.masApiRestClient = new SuppressingRestClient(new RestClient('MAS API', (_a = config.masApiConfig) !== null && _a !== void 0 ? _a : config, logger, authenticationClient), logger);
|
|
46
|
+
this.supervisionPackageApiRestClient = new SuppressingRestClient(new RestClient('Supervision Package API', (_b = config.supervisionPackageApiConfig) !== null && _b !== void 0 ? _b : config, logger, authenticationClient), logger);
|
|
46
47
|
}
|
|
47
48
|
async getTierDetails(authOptions, crn) {
|
|
48
49
|
let error = null;
|
|
@@ -101,17 +102,17 @@ class MPoPComponents {
|
|
|
101
102
|
}
|
|
102
103
|
async getPersonalDetails(authOptions, crn) {
|
|
103
104
|
let error = null;
|
|
104
|
-
let
|
|
105
|
+
let personalDetailsResponse;
|
|
105
106
|
try {
|
|
106
107
|
const response = await this.masApiRestClient.get(`/personal-details/${crn}/summary`, authOptions);
|
|
107
108
|
if (!response) {
|
|
108
|
-
|
|
109
|
+
personalDetailsResponse = {
|
|
109
110
|
personalDetails: null,
|
|
110
111
|
httpStatus: 404,
|
|
111
112
|
};
|
|
112
113
|
}
|
|
113
114
|
else {
|
|
114
|
-
|
|
115
|
+
personalDetailsResponse = {
|
|
115
116
|
personalDetails: { ...response, age: yearsSince(response.dateOfBirth) },
|
|
116
117
|
httpStatus: 200,
|
|
117
118
|
};
|
|
@@ -120,17 +121,129 @@ class MPoPComponents {
|
|
|
120
121
|
catch (err) {
|
|
121
122
|
error = err instanceof Error ? err : new Error('500 Internal Server Error');
|
|
122
123
|
const responseStatus = err === null || err === void 0 ? void 0 : err.responseStatus;
|
|
123
|
-
|
|
124
|
+
personalDetailsResponse = {
|
|
124
125
|
personalDetails: null,
|
|
125
126
|
httpStatus: responseStatus !== null && responseStatus !== void 0 ? responseStatus : 500,
|
|
126
127
|
};
|
|
127
128
|
}
|
|
128
129
|
return {
|
|
129
|
-
...
|
|
130
|
+
...personalDetailsResponse,
|
|
131
|
+
error,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
async getSupervisionPackage(authOptions, crn) {
|
|
135
|
+
let error = null;
|
|
136
|
+
let supervisionPackageResponse;
|
|
137
|
+
try {
|
|
138
|
+
const response = await this.supervisionPackageApiRestClient.get(`/case/${crn}/current-phase`, authOptions);
|
|
139
|
+
if (!response) {
|
|
140
|
+
supervisionPackageResponse = {
|
|
141
|
+
supervisionPackage: null,
|
|
142
|
+
httpStatus: 404,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
supervisionPackageResponse = {
|
|
147
|
+
supervisionPackage: response,
|
|
148
|
+
httpStatus: 200,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
catch (err) {
|
|
153
|
+
const responseStatus = err === null || err === void 0 ? void 0 : err.responseStatus;
|
|
154
|
+
error = err instanceof Error ? err : new Error('500 Internal Server Error');
|
|
155
|
+
supervisionPackageResponse = {
|
|
156
|
+
supervisionPackage: null,
|
|
157
|
+
httpStatus: responseStatus !== null && responseStatus !== void 0 ? responseStatus : 500,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
...supervisionPackageResponse,
|
|
162
|
+
error,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
async getPersonSchedule(authOptions, crn, type = 'upcoming', page = '0', size = '1', sortBy = '&sortBy=date&ascending=true') {
|
|
166
|
+
let error = null;
|
|
167
|
+
let personScheduleResponse;
|
|
168
|
+
try {
|
|
169
|
+
const queryParameters = `?${new URLSearchParams({ size, page }).toString()}${sortBy !== null && sortBy !== void 0 ? sortBy : ''}`;
|
|
170
|
+
const response = await this.masApiRestClient.get(`/schedule/${crn}/${type}${queryParameters}`, authOptions);
|
|
171
|
+
if (!response) {
|
|
172
|
+
personScheduleResponse = {
|
|
173
|
+
personSchedule: null,
|
|
174
|
+
httpStatus: 404,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
personScheduleResponse = {
|
|
179
|
+
personSchedule: response,
|
|
180
|
+
httpStatus: 200,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
catch (err) {
|
|
185
|
+
const responseStatus = err === null || err === void 0 ? void 0 : err.responseStatus;
|
|
186
|
+
error = err instanceof Error ? err : new Error('500 Internal Server Error');
|
|
187
|
+
personScheduleResponse = {
|
|
188
|
+
personSchedule: null,
|
|
189
|
+
httpStatus: responseStatus !== null && responseStatus !== void 0 ? responseStatus : 500,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
return {
|
|
193
|
+
...personScheduleResponse,
|
|
130
194
|
error,
|
|
131
195
|
};
|
|
132
196
|
}
|
|
133
197
|
}
|
|
134
198
|
|
|
135
|
-
|
|
199
|
+
const govukTime = (datetimeString) => {
|
|
200
|
+
if (!datetimeString || isBlank(datetimeString))
|
|
201
|
+
return null;
|
|
202
|
+
const datetime = DateTime.fromISO(datetimeString);
|
|
203
|
+
if (!datetime.isValid)
|
|
204
|
+
return null;
|
|
205
|
+
const hourMinuteFormat = datetime.minute === 0 ? 'ha' : 'h:mma';
|
|
206
|
+
return datetime.toFormat(hourMinuteFormat).toLowerCase();
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
const dateWithYear = (datetimeString, showTime = false) => {
|
|
210
|
+
if (!datetimeString || isBlank(datetimeString))
|
|
211
|
+
return null;
|
|
212
|
+
const dt = DateTime.fromISO(datetimeString, { zone: 'Europe/London' });
|
|
213
|
+
if (!dt.isValid)
|
|
214
|
+
return null;
|
|
215
|
+
const time = showTime ? govukTime(datetimeString) : null;
|
|
216
|
+
return `${dt.toFormat('d MMMM yyyy')}${time ? ` at ${time}` : ''}`;
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
const toTitleCase = (value) => {
|
|
220
|
+
if (!value)
|
|
221
|
+
return '';
|
|
222
|
+
const preservedWords = ['(NS)', '(Non', 'NS)'];
|
|
223
|
+
const lower = value.toLowerCase();
|
|
224
|
+
const titleCased = `${lower.charAt(0).toUpperCase()}${lower.substring(1)}`;
|
|
225
|
+
return preservedWords.reduce((result, word) => {
|
|
226
|
+
const escaped = word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
227
|
+
return result.replace(new RegExp(escaped, 'gi'), word);
|
|
228
|
+
}, titleCased);
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
const hasBreachedSentence = (sentences) => Array.isArray(sentences) &&
|
|
232
|
+
sentences.some(sentence => { var _a; return ((_a = sentence === null || sentence === void 0 ? void 0 : sentence.supervisionPackage) === null || _a === void 0 ? void 0 : _a.code) !== 'SPX' && (sentence === null || sentence === void 0 ? void 0 : sentence.inBreach) === true; });
|
|
233
|
+
|
|
234
|
+
const eligibleTiers = ['C', 'D', 'E', 'F', 'G'];
|
|
235
|
+
const isEligibleForDiscretionaryAppointments = (inputs, tierScore) => (inputs === null || inputs === void 0 ? void 0 : inputs.gender) === 'Female' &&
|
|
236
|
+
!(inputs === null || inputs === void 0 ? void 0 : inputs.integratedOffenderManagementRedRated) &&
|
|
237
|
+
!!tierScore &&
|
|
238
|
+
eligibleTiers.includes(tierScore);
|
|
239
|
+
|
|
240
|
+
const mpopNunjucksSetup = (env) => {
|
|
241
|
+
env.addFilter('dateWithYear', dateWithYear);
|
|
242
|
+
env.addFilter('govukTime', govukTime);
|
|
243
|
+
env.addFilter('toTitleCase', toTitleCase);
|
|
244
|
+
env.addFilter('hasBreachedSentence', hasBreachedSentence);
|
|
245
|
+
env.addFilter('isEligibleForDiscretionaryAppointments', isEligibleForDiscretionaryAppointments);
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
export { MPoPComponents, mpopNunjucksSetup as addFilters, mpopNunjucksSetup };
|
|
136
249
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/SuppressingRestClient.ts","../src/utils/isBlank.ts","../src/utils/yearsSince.ts","../src/MPoPComponents.ts"],"sourcesContent":[null,null,null,null],"names":[],"mappings":";;;MAGa,qBAAqB,CAAA;IAChC,WAA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src/utils/isBlank.ts","../src/utils/yearsSince.ts","../src/MPoPComponents.ts","../src/utils/govukTime.ts","../src/utils/dateWithYear.ts","../src/utils/toTitleCase.ts","../src/utils/hasBreachedSentence.ts","../src/utils/isEligibleForDiscretionaryAppointments.ts","../src/utils/nunjucksFilters.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;;MAGa,qBAAqB,CAAA;IAChC,WAAA,CACmB,UAAsB,EACtB,MAAwB,EAAA;QADxB,IAAA,CAAA,UAAU,GAAV,UAAU;QACV,IAAA,CAAA,MAAM,GAAN,MAAM;IACtB;AAEH,IAAA,MAAM,GAAG,CAAI,IAAY,EAAE,WAAiC,EAAA;AAC1D,QAAA,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CACxB;YACE,IAAI;YACJ,YAAY,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,KAAI;AAC3C,gBAAA,IAAI,KAAK,CAAC,cAAc,KAAK,GAAG,EAAE;oBAChC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA,iCAAA,EAAoC,MAAM,CAAA,EAAA,EAAK,WAAW,CAAA,CAAE,CAAC;AAC/E,oBAAA,OAAO,IAAI;gBACb;AACA,gBAAA,MAAM,KAAK;YACb,CAAC;SACF,EACD,WAAW,CACZ;IACH;AACD;;ACxBM,MAAM,OAAO,GAAG,CAAC,GAAW,KAAc,CAAC,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC;;ACGnE,MAAM,UAAU,GAAG,CAAC,cAAsB,KAAmB;AAClE,IAAA,IAAI,CAAC,cAAc,IAAI,OAAO,CAAC,cAAc,CAAC;AAAE,QAAA,OAAO,IAAI;AAE3D,IAAA,MAAM,EAAE,GAAG,QAAQ,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;IACtE,IAAI,CAAC,EAAE,CAAC,OAAO;AAAE,QAAA,OAAO,IAAI;IAC5B,MAAM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N,MAAM,uBAAN,MAAM,CAAE,oCAAoC,CAAA;AAC7C,IAAA,CAAC,CAAC,SAAS;AACX,IAAA,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC;;ACJ5B,MAAM,iBAAiB,GAAG,CAAC,GAAgB,KAAU;AAC1D,IAAA,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,YAAY,CAAC;AAC3C,IAAA,GAAG,CAAC,SAAS,CAAC,WAAW,EAAE,SAAS,CAAC;AACrC,IAAA,GAAG,CAAC,SAAS,CAAC,aAAa,EAAE,WAAW,CAAC;AACzC,IAAA,GAAG,CAAC,SAAS,CAAC,qBAAqB,EAAE,mBAAmB,CAAC;AACzD,IAAA,GAAG,CAAC,SAAS,CAAC,wCAAwC,EAAE,sCAAsC,CAAC;AACjG;;;;"}
|
|
@@ -12,11 +12,41 @@ $supervision-package-accent-colour: govuk-colour("blue");
|
|
|
12
12
|
padding-left: govuk-spacing(4);
|
|
13
13
|
|
|
14
14
|
margin-bottom: govuk-spacing(6);
|
|
15
|
+
|
|
16
|
+
.govuk-warning-text {
|
|
17
|
+
padding-top: 0;
|
|
18
|
+
padding-bottom: 10px;
|
|
19
|
+
margin-bottom: 0;
|
|
20
|
+
}
|
|
15
21
|
}
|
|
16
22
|
|
|
17
23
|
.app-tier-header {
|
|
18
24
|
display: flex;
|
|
19
25
|
align-items: center;
|
|
20
26
|
gap: govuk-spacing(2);
|
|
27
|
+
flex-wrap: wrap;
|
|
21
28
|
margin-bottom: govuk-spacing(3);
|
|
22
|
-
|
|
29
|
+
|
|
30
|
+
> h2,
|
|
31
|
+
> h3 {
|
|
32
|
+
white-space: nowrap;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.appointment-progress {
|
|
37
|
+
background-color: govuk-colour("teal", $variant: "tint-80");
|
|
38
|
+
border-radius: 20px;
|
|
39
|
+
height: 19px;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
width: 100%;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.appointment-progress__bar {
|
|
45
|
+
background-color: govuk-colour("teal", $variant: "tint-25");
|
|
46
|
+
height: 100%;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.appointment-progress__bar-maximum {
|
|
50
|
+
background-color: govuk-colour("red");
|
|
51
|
+
height: 100%;
|
|
52
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{% if params.forename and (params.earlyEngagement.completed | int < params.earlyEngagement.weeks | int) %}
|
|
2
|
+
<p class='govuk-body'>You should see {{ params.forename }} every week for the first {{ params.earlyEngagement.weeks }} weeks of the sentence.</p>
|
|
3
|
+
{% endif %}
|
|
4
|
+
|
|
5
|
+
{% if params.forename and params.currentYear.appointments.allowance is defined and params.earlyEngagement.weeks is defined %}
|
|
6
|
+
<p class='govuk-body'>
|
|
7
|
+
Early engagement is expected to end on {{ params.phase.endDate | dateWithYear }}{% if params.forename and (params.earlyEngagement.completed | int < params.earlyEngagement.weeks | int) %} if {{ params.forename }} attends the required appointments by then{% endif %}.
|
|
8
|
+
</p>
|
|
9
|
+
{% endif %}
|
|
10
|
+
|
|
11
|
+
{% if params.currentYear.appointments.allowance is defined and params.earlyEngagement.weeks is defined %}
|
|
12
|
+
<p class='govuk-body'>{{ params.forename }} will then have a maximum of {{ (params.currentYear.appointments.allowance | int) - (params.earlyEngagement.weeks | int) }} supervision appointments for the rest of this sentence year.</p>
|
|
13
|
+
{% endif %}
|
|
14
|
+
|
|
15
|
+
{% include './_progress-bar.njk' %}
|
|
16
|
+
|
|
17
|
+
{% if params.inputs.integratedOffenderManagementRedRated %}
|
|
18
|
+
<p class='govuk-body'>{{ params.forename }} has an IOM red RAG status. The maximum number of appointments is the same as tier A.</p>
|
|
19
|
+
{% endif %}
|
|
20
|
+
|
|
21
|
+
{% if params.inputs | isEligibleForDiscretionaryAppointments(params.tierScore) %}
|
|
22
|
+
<p class='govuk-body'>As a woman in tier {{ params.tierScore }}, {{ params.forename }} can have up to 5 additional discretionary appointments.</p>
|
|
23
|
+
{% endif %}
|
|
24
|
+
|
|
25
|
+
{% if params.allAppointmentsHref %}
|
|
26
|
+
<p class='govuk-body'>
|
|
27
|
+
<a class='govuk-link govuk-link--no-visited-state' href='{{ params.allAppointmentsHref }}' >View all appointments</a>
|
|
28
|
+
</p>
|
|
29
|
+
{% endif %}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{% if params.phase.name.code == 'INIT' %}
|
|
2
|
+
{% set completed = params.earlyEngagement.completed | int %}
|
|
3
|
+
{% set allowance = params.earlyEngagement.weeks | int %}
|
|
4
|
+
{% else %}
|
|
5
|
+
{% set completed = params.currentYear.appointments.completed | int %}
|
|
6
|
+
{% set allowance = (params.currentYear.appointments.allowance | int) - (params.earlyEngagement.weeks | int) %}
|
|
7
|
+
{% endif %}
|
|
8
|
+
|
|
9
|
+
{% if allowance > 0 %}
|
|
10
|
+
{% set rawPercent = (completed / allowance * 100) | round %}
|
|
11
|
+
{% else %}
|
|
12
|
+
{% set rawPercent = 0 %}
|
|
13
|
+
{% endif %}
|
|
14
|
+
|
|
15
|
+
{% set widthPercent = 100 if rawPercent > 100 else (0 if rawPercent < 0 else rawPercent) %}
|
|
16
|
+
|
|
17
|
+
<p class='govuk-body'>{{ completed }} of {{ allowance }} appointments used</p>
|
|
18
|
+
|
|
19
|
+
<div class="appointment-progress" aria-hidden="true">
|
|
20
|
+
<div class="{{ 'appointment-progress__bar-maximum' if widthPercent == 100 else 'appointment-progress__bar' }}" style="width: {{ widthPercent }}%;"></div>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<div class='govuk-grid-row govuk-!-margin-top-4'>
|
|
24
|
+
<div class='govuk-grid-column-one-third'>
|
|
25
|
+
<p class='govuk-body govuk-!-margin-bottom-2'>{{ 'Required' if params.phase.name.code == 'INIT' else 'Maximum' }}</p>
|
|
26
|
+
<p class='govuk-body-l govuk-!-font-weight-bold'>{{ allowance }}</p>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<div class='govuk-grid-column-one-third'>
|
|
30
|
+
<p class='govuk-body govuk-!-margin-bottom-2'>Remaining</p>
|
|
31
|
+
<p class='govuk-body-l govuk-!-font-weight-bold'>{{ allowance - completed }}</p>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
<div class='govuk-grid-column-one-third'>
|
|
35
|
+
<p class='govuk-body govuk-!-margin-bottom-2'>Upcoming</p>
|
|
36
|
+
<p class='govuk-body-l govuk-!-font-weight-bold'>{{ params.currentYear.appointments.scheduled | int }}</p>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{% if params.currentYear.appointments.allowance is defined and params.currentYear.appointments.completed is defined and (params.currentYear.appointments.completed | int) >= (params.currentYear.appointments.allowance | int) and not params.inputs.offenderPersonalDisorderPathway %}
|
|
2
|
+
<strong class='app-status-badge govuk-tag govuk-tag--red'>No appointments remaining</strong>
|
|
3
|
+
{% endif %}
|
|
4
|
+
|
|
5
|
+
{% if params.inputs.sentences | hasBreachedSentence %}
|
|
6
|
+
<strong class='app-status-badge govuk-tag govuk-tag--yellow'>In breach</strong>
|
|
7
|
+
{% endif %}
|
|
8
|
+
|
|
9
|
+
{% if params.isCustody %}
|
|
10
|
+
<strong class='app-status-badge govuk-tag govuk-tag--yellow'>In custody</strong>
|
|
11
|
+
{% endif %}
|
|
12
|
+
|
|
13
|
+
{% if params.inputs.offenderPersonalDisorderPathway %}
|
|
14
|
+
<strong class='app-status-badge govuk-tag govuk-tag--purple'>Offender personality disorder</strong>
|
|
15
|
+
{% endif %}
|
|
16
|
+
|
|
17
|
+
{% if params.inputs.integratedOffenderManagementRedRated %}
|
|
18
|
+
<strong class='app-status-badge govuk-tag govuk-tag--red'>IOM (Integrated Offender Management): Red</strong>
|
|
19
|
+
{% endif %}
|
|
@@ -1,17 +1,41 @@
|
|
|
1
|
+
{% set standardAppointmentsComplete = params.currentYear.appointments.allowance is defined and params.currentYear.appointments.completed is defined and (params.currentYear.appointments.completed | int) >= (params.currentYear.appointments.allowance| int) %}
|
|
2
|
+
{% set hasSpecialStatus = params.inputs.offenderPersonalDisorderPathway or params.inputs.sentences | hasBreachedSentence or params.isCustody or params.inputs.integratedOffenderManagementRedRated %}
|
|
3
|
+
|
|
1
4
|
<div class='govuk-width-container supervision-package'>
|
|
2
|
-
|
|
5
|
+
{% if standardAppointmentsComplete or hasSpecialStatus %}
|
|
6
|
+
<div class='app-tier-header'>
|
|
7
|
+
<h2 class='govuk-heading-m govuk-!-margin-bottom-0'>{{ 'Supervision package: ' ~ params.sentenceType if params.sentenceType else 'Supervision package' }}</h2>
|
|
8
|
+
{% include './partials/_tags.njk' %}
|
|
9
|
+
</div>
|
|
10
|
+
{% else %}
|
|
11
|
+
<h2 class='govuk-heading-m'>{{ 'Supervision package: ' ~ params.sentenceType if params.sentenceType else 'Supervision package' }}</h2>
|
|
12
|
+
{% endif %}
|
|
13
|
+
|
|
3
14
|
<div class='govuk-grid-row'>
|
|
4
|
-
<div class='govuk-grid-column-two-thirds'>
|
|
15
|
+
<div class='{{ "govuk-grid-column-one-half" if params.phase.name.description else "govuk-grid-column-two-thirds" }}'>
|
|
16
|
+
{% if params.inputs.sentences | hasBreachedSentence %}
|
|
17
|
+
<div class='govuk-warning-text'>
|
|
18
|
+
<span class='govuk-warning-text__icon' aria-hidden='true'>!</span>
|
|
19
|
+
<strong class='govuk-warning-text__text'>
|
|
20
|
+
<span class='govuk-visually-hidden'>Warning</span>
|
|
21
|
+
{{ params.forename }} is in breach. You should continue to offer appointments.
|
|
22
|
+
</strong>
|
|
23
|
+
</div>
|
|
24
|
+
{% endif %}
|
|
25
|
+
|
|
5
26
|
<div class='app-tier-header'>
|
|
6
27
|
<h3 class='govuk-heading-s govuk-!-margin-bottom-0'>
|
|
7
28
|
Tier {{ '' if params.tierScore == 'MISSING' else params.tierScore }}
|
|
8
29
|
</h3>
|
|
9
|
-
|
|
10
30
|
{% if params.tag.text and params.tag.color %}
|
|
11
31
|
<strong class='govuk-tag govuk-tag--{{ params.tag.color }}'>{{ params.tag.text }}</strong>
|
|
12
32
|
{% endif %}
|
|
13
33
|
</div>
|
|
14
34
|
|
|
35
|
+
{% if params.createdOn %}
|
|
36
|
+
<p class='govuk-body'>The supervision package was created on {{ params.createdOn }}.</p>
|
|
37
|
+
{% endif %}
|
|
38
|
+
|
|
15
39
|
{% if params.tag.text == 'Provisional' %}
|
|
16
40
|
<p class='govuk-body'>
|
|
17
41
|
We will calculate the supervision package once the tier is confirmed.
|
|
@@ -31,6 +55,41 @@
|
|
|
31
55
|
</a>
|
|
32
56
|
</p>
|
|
33
57
|
{% endif %}
|
|
58
|
+
|
|
59
|
+
{% set nextAppointmentDate = (params.nextAppointment and params.nextAppointment.date) | dateWithYear(true) %}
|
|
60
|
+
{% if params.nextAppointment and nextAppointmentDate and params.nextAppointment.description and params.nextAppointment.href %}
|
|
61
|
+
<h3 class='govuk-heading-s'>Next appointment</h3>
|
|
62
|
+
<p class='govuk-body'>
|
|
63
|
+
<a href='{{ params.nextAppointment.href }}' class='govuk-link govuk-link--no-visited-state'>{{ params.nextAppointment.description | toTitleCase }}: {{ nextAppointmentDate }}</a>
|
|
64
|
+
</p>
|
|
65
|
+
{% else %}
|
|
66
|
+
<p class='govuk-body'>No appointments scheduled</p>
|
|
67
|
+
{% endif %}
|
|
34
68
|
</div>
|
|
69
|
+
|
|
70
|
+
{% if params.phase.name.description %}
|
|
71
|
+
<div class='govuk-grid-column-one-half'>
|
|
72
|
+
<h3 class='govuk-heading-s'>{{ params.phase.name.description | toTitleCase }} stage</h3>
|
|
73
|
+
{% if params.phase.name.code == 'INIT' %}
|
|
74
|
+
{% include './partials/_early-engagement.njk' %}
|
|
75
|
+
{% endif %}
|
|
76
|
+
</div>
|
|
77
|
+
{% endif %}
|
|
35
78
|
</div>
|
|
79
|
+
|
|
80
|
+
{% if params.arrangeAppointmentHref or (params.crn and params.deliusBaseURL) %}
|
|
81
|
+
<div class='govuk-button-group'>
|
|
82
|
+
{% if params.arrangeAppointmentHref %}
|
|
83
|
+
<a href='{{ params.arrangeAppointmentHref }}' role='button' draggable='false' class='govuk-button' data-module='govuk-button'>
|
|
84
|
+
Arrange an appointment
|
|
85
|
+
</a>
|
|
86
|
+
{% endif %}
|
|
87
|
+
|
|
88
|
+
{% if params.crn and params.deliusBaseURL %}
|
|
89
|
+
<a href='{{ params.deliusBaseURL }}/NDelius-war/delius/JSP/deeplink.xhtml?component=RegisterSummary&CRN={{params.crn}}' role='button' draggable='false' class='govuk-button govuk-button--secondary' data-module='govuk-button'>
|
|
90
|
+
Update NDelius risk flag
|
|
91
|
+
</a>
|
|
92
|
+
{% endif %}
|
|
93
|
+
</div>
|
|
94
|
+
{% endif %}
|
|
36
95
|
</div>
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
export type PersonSchedule = {
|
|
2
|
+
personSummary: {
|
|
3
|
+
name: {
|
|
4
|
+
forename: string;
|
|
5
|
+
middleName?: string;
|
|
6
|
+
surname: string;
|
|
7
|
+
username?: string;
|
|
8
|
+
};
|
|
9
|
+
crn: string;
|
|
10
|
+
offenderId?: number;
|
|
11
|
+
pnc?: string;
|
|
12
|
+
dateOfBirth: string;
|
|
13
|
+
preferredLanguage?: string;
|
|
14
|
+
};
|
|
15
|
+
personSchedule: {
|
|
16
|
+
size: number;
|
|
17
|
+
page: number;
|
|
18
|
+
totalResults: number;
|
|
19
|
+
totalPages: number;
|
|
20
|
+
appointments: Array<Activity>;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export type PersonScheduleResponse = {
|
|
24
|
+
personSchedule: PersonSchedule | null;
|
|
25
|
+
httpStatus: number;
|
|
26
|
+
error?: Error | null;
|
|
27
|
+
};
|
|
28
|
+
type Activity = {
|
|
29
|
+
id: string;
|
|
30
|
+
eventNumber?: string;
|
|
31
|
+
type: string;
|
|
32
|
+
displayName?: string;
|
|
33
|
+
startDateTime: string;
|
|
34
|
+
endDateTime?: string;
|
|
35
|
+
rarToolKit?: string;
|
|
36
|
+
appointmentNotes?: Array<Note>;
|
|
37
|
+
appointmentNote?: Note;
|
|
38
|
+
isSensitive?: boolean;
|
|
39
|
+
hasOutcome?: boolean;
|
|
40
|
+
wasAbsent?: boolean;
|
|
41
|
+
officer?: {
|
|
42
|
+
code?: string;
|
|
43
|
+
name?: {
|
|
44
|
+
forename: string;
|
|
45
|
+
middleName?: string;
|
|
46
|
+
surname: string;
|
|
47
|
+
username?: string;
|
|
48
|
+
};
|
|
49
|
+
teamCode?: string;
|
|
50
|
+
providerCode?: string;
|
|
51
|
+
username?: string;
|
|
52
|
+
};
|
|
53
|
+
isInitial?: boolean;
|
|
54
|
+
isNationalStandard?: boolean;
|
|
55
|
+
location?: {
|
|
56
|
+
code?: string;
|
|
57
|
+
providerCode?: string;
|
|
58
|
+
teamCode?: string;
|
|
59
|
+
officeName?: string;
|
|
60
|
+
buildingName?: string;
|
|
61
|
+
buildingNumber?: string;
|
|
62
|
+
streetName?: string;
|
|
63
|
+
district?: string;
|
|
64
|
+
town?: string;
|
|
65
|
+
county?: string;
|
|
66
|
+
postcode?: string;
|
|
67
|
+
ldu?: string;
|
|
68
|
+
telephoneNumber?: string;
|
|
69
|
+
};
|
|
70
|
+
rescheduled?: boolean;
|
|
71
|
+
rescheduledStaff?: boolean;
|
|
72
|
+
rescheduledPop?: boolean;
|
|
73
|
+
didTheyComply?: boolean;
|
|
74
|
+
absentWaitingEvidence?: boolean;
|
|
75
|
+
enforcementAction?: {
|
|
76
|
+
responseByDate: string;
|
|
77
|
+
};
|
|
78
|
+
rearrangeOrCancelReason?: string;
|
|
79
|
+
rescheduledBy?: {
|
|
80
|
+
forename: string;
|
|
81
|
+
middleName?: string;
|
|
82
|
+
surname: string;
|
|
83
|
+
username?: string;
|
|
84
|
+
};
|
|
85
|
+
repeating?: boolean;
|
|
86
|
+
nonComplianceReason?: string;
|
|
87
|
+
documents?: Array<Document>;
|
|
88
|
+
isRarRelated?: boolean;
|
|
89
|
+
rarCategory?: string;
|
|
90
|
+
acceptableAbsence?: boolean;
|
|
91
|
+
acceptableAbsenceReason?: string;
|
|
92
|
+
isAppointment?: boolean;
|
|
93
|
+
isCommunication?: boolean;
|
|
94
|
+
action?: string;
|
|
95
|
+
isSystemContact?: boolean;
|
|
96
|
+
isEmailOrTextFromPop?: boolean;
|
|
97
|
+
isPhoneCallFromPop?: boolean;
|
|
98
|
+
isEmailOrTextToPop?: boolean;
|
|
99
|
+
isPhoneCallToPop?: boolean;
|
|
100
|
+
isInPast?: boolean;
|
|
101
|
+
isPastAppointment?: boolean;
|
|
102
|
+
countsTowardsRAR?: boolean;
|
|
103
|
+
lastUpdated?: string;
|
|
104
|
+
lastUpdatedBy?: {
|
|
105
|
+
forename: string;
|
|
106
|
+
middleName?: string;
|
|
107
|
+
surname: string;
|
|
108
|
+
username?: string;
|
|
109
|
+
};
|
|
110
|
+
description?: string;
|
|
111
|
+
outcome?: string;
|
|
112
|
+
deliusManaged?: boolean;
|
|
113
|
+
isVisor?: boolean;
|
|
114
|
+
eventId?: number;
|
|
115
|
+
component?: {
|
|
116
|
+
id?: number;
|
|
117
|
+
description?: string;
|
|
118
|
+
type?: string;
|
|
119
|
+
};
|
|
120
|
+
nsiId?: number;
|
|
121
|
+
esupervisionId?: string;
|
|
122
|
+
externalReference?: string;
|
|
123
|
+
isUpdatableContact?: boolean;
|
|
124
|
+
};
|
|
125
|
+
type Note = {
|
|
126
|
+
id: number;
|
|
127
|
+
createdBy?: string;
|
|
128
|
+
createdByDate?: string;
|
|
129
|
+
note: string;
|
|
130
|
+
hasNoteBeenTruncated?: boolean;
|
|
131
|
+
};
|
|
132
|
+
type Document = {
|
|
133
|
+
id: string;
|
|
134
|
+
name: string;
|
|
135
|
+
lastUpdated?: string;
|
|
136
|
+
createdAt?: string;
|
|
137
|
+
};
|
|
138
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export type SupervisionPackage = {
|
|
2
|
+
phase: {
|
|
3
|
+
name: {
|
|
4
|
+
code: string;
|
|
5
|
+
description: string;
|
|
6
|
+
};
|
|
7
|
+
startDate: string;
|
|
8
|
+
endDate: string;
|
|
9
|
+
};
|
|
10
|
+
earlyEngagement: {
|
|
11
|
+
startDate: string;
|
|
12
|
+
endDate: string;
|
|
13
|
+
weeks: number;
|
|
14
|
+
completed: number;
|
|
15
|
+
};
|
|
16
|
+
currentYear: {
|
|
17
|
+
startDate: string;
|
|
18
|
+
endDate: string;
|
|
19
|
+
isFirstYear: boolean;
|
|
20
|
+
appointments: {
|
|
21
|
+
allowance: number;
|
|
22
|
+
scheduled: number;
|
|
23
|
+
completed: number;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
inputs: {
|
|
27
|
+
date: string;
|
|
28
|
+
gender: string;
|
|
29
|
+
integratedOffenderManagementRedRated: boolean;
|
|
30
|
+
offenderPersonalDisorderPathway: boolean;
|
|
31
|
+
intensiveSupervisionCourt: boolean;
|
|
32
|
+
nationalSecurityDivision: boolean;
|
|
33
|
+
contactSuspendedDate?: string;
|
|
34
|
+
finalThirdEligibility: {
|
|
35
|
+
eligible: boolean;
|
|
36
|
+
since: string;
|
|
37
|
+
};
|
|
38
|
+
sentences: Array<Sentence>;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
type Sentence = {
|
|
42
|
+
eventNumber: string;
|
|
43
|
+
startDate: string;
|
|
44
|
+
endDate: string;
|
|
45
|
+
supervisionPackage: {
|
|
46
|
+
code: string;
|
|
47
|
+
description: string;
|
|
48
|
+
};
|
|
49
|
+
type: {
|
|
50
|
+
code: string;
|
|
51
|
+
description: string;
|
|
52
|
+
isCustodial: boolean;
|
|
53
|
+
};
|
|
54
|
+
custody: {
|
|
55
|
+
status: {
|
|
56
|
+
code: string;
|
|
57
|
+
description: string;
|
|
58
|
+
};
|
|
59
|
+
finalThirdDate: string;
|
|
60
|
+
releases: Array<Release>;
|
|
61
|
+
};
|
|
62
|
+
inBreach: boolean;
|
|
63
|
+
};
|
|
64
|
+
type Release = {
|
|
65
|
+
releaseDate: string;
|
|
66
|
+
recallDate?: string;
|
|
67
|
+
};
|
|
68
|
+
export type SupervisionPackageResponse = {
|
|
69
|
+
supervisionPackage: SupervisionPackage | null;
|
|
70
|
+
httpStatus: number;
|
|
71
|
+
error?: Error | null;
|
|
72
|
+
};
|
|
73
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const toTitleCase: (value: string | null | undefined) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|