Skip to content

Commit 4084496

Browse files
Allow parents to say when and where a previous vaccination was given
1 parent 4ef1723 commit 4084496

5 files changed

Lines changed: 150 additions & 44 deletions

File tree

app/controllers/parent.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,11 @@ export const parentController = {
175175
[`/${session_id}/${consent_uuid}/new/refusal-reason`]: {
176176
[`/${session_id}/${consent_uuid}/new/refusal-reason-details`]: {
177177
data: 'consent.refusalReason',
178-
values: [
179-
ReplyRefusal.AlreadyVaccinated,
180-
ReplyRefusal.GettingElsewhere,
181-
ReplyRefusal.Medical
182-
]
178+
values: [ReplyRefusal.GettingElsewhere, ReplyRefusal.Medical]
179+
},
180+
[`/${session_id}/${consent_uuid}/new/previous-dose`]: {
181+
data: 'consent.refusalReason',
182+
value: ReplyRefusal.AlreadyVaccinated
183183
},
184184
[`/${session_id}/${consent_uuid}/new/first-dose-country`]: {
185185
data: 'consent.refusalReason',
@@ -194,7 +194,11 @@ export const parentController = {
194194
[`/${session_id}/${consent_uuid}/new/consultation`]: {
195195
[`/${session_id}/${consent_uuid}/new/check-answers`]: true
196196
},
197-
// First and second dose journey
197+
// Previous single dose journey
198+
[`/${session_id}/${consent_uuid}/new/previous-dose`]: {
199+
[`/${session_id}/${consent_uuid}/new/check-answers`]: true
200+
},
201+
// Previous multi-dose journey
198202
[`/${session_id}/${consent_uuid}/new/first-dose-country`]: {},
199203
[`/${session_id}/${consent_uuid}/new/first-dose-date`]: {},
200204
[`/${session_id}/${consent_uuid}/new/second-dose-country`]: {},
@@ -322,7 +326,7 @@ export const parentController = {
322326
showForm(request, response) {
323327
let { view } = request.params
324328
const { consent } = response.locals
325-
let key
329+
let key = kebabToCamelCase(view)
326330

327331
// All health questions use the same view
328332
if (view.startsWith('health-question-')) {

app/locales/en.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,8 +895,11 @@ export const en = {
895895
}
896896
},
897897
previousDose: {
898+
label: 'Details of %s vaccination',
899+
title: 'When and where did your child get their %s vaccination?',
898900
country: {
899901
label: 'Country',
902+
title: 'Which country was the vaccination given in?',
900903
england: 'England',
901904
scotland: 'Scotland',
902905
wales: 'Wales',
@@ -908,6 +911,7 @@ export const en = {
908911
},
909912
createdAt: {
910913
label: 'Date',
914+
title: 'When was the vaccination given?',
911915
hint: 'If you do not know the exact date of the vaccination, leave the day field empty and enter your best guess for the month'
912916
},
913917
scheduled: {

app/models/reply.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,11 @@ export class Reply {
112112
: stringToBoolean(options?.invalid) || false
113113
}
114114

115-
if (this.decision === ReplyDecision.AlreadyVaccinated) {
115+
if (
116+
[ReplyDecision.AlreadyVaccinated, ReplyDecision.Refused].includes(
117+
this.decision
118+
)
119+
) {
116120
this.firstDose = options?.firstDose && new Vaccination(options.firstDose)
117121

118122
if (options?.firstDose?.scheduled) {

app/views/parent/form/check-answers.njk

Lines changed: 57 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -179,41 +179,62 @@
179179
)
180180
}) if consent.given }}
181181

182-
{{ summaryList({
183-
card: {
184-
heading: __("consent.firstDose.label"),
185-
headingSize: "m"
186-
},
187-
rows: summaryRows(consent, {
188-
createdAt: {
189-
label: __("consent.previousDose.createdAt.label"),
190-
value: consent.firstDose.formatted.createdAt_date,
191-
href: editPath("first-dose-date")
192-
},
193-
country: {
194-
label: __("consent.previousDose.country.label"),
195-
value: consent.firstDose.formatted.country,
196-
href: editPath("first-dose-country")
197-
}
198-
})
199-
}) if consent.decision == ReplyDecision.AlreadyVaccinated }}
182+
{% if SessionPresetName.MMR in session.presetNames and consent.decision == ReplyDecision.AlreadyVaccinated %}
183+
{{ summaryList({
184+
card: {
185+
heading: __("consent.firstDose.label"),
186+
headingSize: "m"
187+
},
188+
rows: summaryRows(consent, {
189+
createdAt: {
190+
label: __("consent.previousDose.createdAt.label"),
191+
value: consent.firstDose.formatted.createdAt_date,
192+
href: editPath("first-dose-date")
193+
},
194+
country: {
195+
label: __("consent.previousDose.country.label"),
196+
value: consent.firstDose.formatted.country,
197+
href: editPath("first-dose-country")
198+
}
199+
})
200+
}) }}
200201

201-
{{ summaryList({
202-
card: {
203-
heading: __("consent.secondDose.label"),
204-
headingSize: "m"
205-
},
206-
rows: summaryRows(consent, {
207-
createdAt: {
208-
label: __("consent.previousDose.createdAt.label"),
209-
value: consent.secondDose.formatted.createdAt_date,
210-
href: editPath("second-dose-date")
211-
},
212-
country: {
213-
label: __("consent.previousDose.country.label"),
214-
value: consent.secondDose.formatted.country,
215-
href: editPath("second-dose-country")
216-
}
217-
})
218-
}) if consent.decision == ReplyDecision.AlreadyVaccinated }}
202+
{{ summaryList({
203+
card: {
204+
heading: __("consent.secondDose.label"),
205+
headingSize: "m"
206+
},
207+
rows: summaryRows(consent, {
208+
createdAt: {
209+
label: __("consent.previousDose.createdAt.label"),
210+
value: consent.secondDose.formatted.createdAt_date,
211+
href: editPath("second-dose-date")
212+
},
213+
country: {
214+
label: __("consent.previousDose.country.label"),
215+
value: consent.secondDose.formatted.country,
216+
href: editPath("second-dose-country")
217+
}
218+
})
219+
}) }}
220+
{% elif consent.refusalReason == ReplyRefusal.AlreadyVaccinated %}
221+
{{ summaryList({
222+
card: {
223+
heading: __("consent.previousDose.label", session.programmes[0].nameSentenceCase),
224+
headingSize: "m"
225+
},
226+
rows: summaryRows(consent, {
227+
createdAt: {
228+
label: __("consent.previousDose.createdAt.label"),
229+
value: consent.firstDose.formatted.createdAt_date,
230+
href: editPath("previous-dose")
231+
},
232+
country: {
233+
label: __("consent.previousDose.country.label"),
234+
value: consent.firstDose.formatted.country,
235+
href: editPath("previous-dose")
236+
}
237+
})
238+
}) }}
239+
{% endif %}
219240
{% endblock %}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{% extends "_layouts/form.njk" %}
2+
3+
{% set title = __("consent.previousDose.title", session.programmes[0].nameSentenceCase) %}
4+
5+
{% block form %}
6+
{{ appHeading({
7+
title: title
8+
}) }}
9+
10+
{{ dateInput({
11+
fieldset: {
12+
legend: {
13+
text: __("consent.previousDose.createdAt.title"),
14+
size: "m"
15+
}
16+
},
17+
hint: { text: __("consent.previousDose.createdAt.hint") },
18+
decorate: "consent.firstDose.createdAt_"
19+
}) }}
20+
21+
{{ radios({
22+
fieldset: {
23+
legend: {
24+
text: __("consent.previousDose.country.title"),
25+
size: "m"
26+
}
27+
},
28+
items: [
29+
{
30+
text: __("consent.previousDose.country.england")
31+
},
32+
{
33+
text: __("consent.previousDose.country.scotland")
34+
},
35+
{
36+
text: __("consent.previousDose.country.wales")
37+
},
38+
{
39+
text: __("consent.previousDose.country.ni")
40+
},
41+
{
42+
divider: "or"
43+
},
44+
{
45+
text: __("consent.previousDose.country.other"),
46+
value: "Other",
47+
conditional: {
48+
html: select({
49+
label: { text: __("consent.previousDose.countryOther.title") },
50+
items: otherCountryItems(Country, consent.previousDose.countryOther),
51+
decorate: "consent.firstDose.countryOther",
52+
attributes: {
53+
"data-module": "app-autocomplete"
54+
}
55+
})
56+
}
57+
}
58+
],
59+
decorate: "consent.firstDose.country"
60+
}) }}
61+
62+
{{ input({
63+
type: "hidden",
64+
value: VaccinationOutcome.AlreadyVaccinated,
65+
decorate: "consent.firstDose.outcome"
66+
}) }}
67+
68+
{{ input({
69+
type: "hidden",
70+
value: session.programmes[0].sequenceDefault,
71+
decorate: "consent.firstDose.sequence"
72+
}) }}
73+
{% endblock %}

0 commit comments

Comments
 (0)