Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions app/controllers/parent.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ export const parentController = {
[`/${session_id}/${consent_uuid}/new/refusal-reason`]: {
[`/${session_id}/${consent_uuid}/new/refusal-reason-details`]: {
data: 'consent.refusalReason',
values: [
ReplyRefusal.AlreadyVaccinated,
ReplyRefusal.GettingElsewhere,
ReplyRefusal.Medical
]
values: [ReplyRefusal.GettingElsewhere, ReplyRefusal.Medical]
},
[`/${session_id}/${consent_uuid}/new/previous-dose`]: {
data: 'consent.refusalReason',
value: ReplyRefusal.AlreadyVaccinated
},
[`/${session_id}/${consent_uuid}/new/first-dose-country`]: {
data: 'consent.refusalReason',
Expand All @@ -194,7 +194,11 @@ export const parentController = {
[`/${session_id}/${consent_uuid}/new/consultation`]: {
[`/${session_id}/${consent_uuid}/new/check-answers`]: true
},
// First and second dose journey
// Previous single dose journey
[`/${session_id}/${consent_uuid}/new/previous-dose`]: {
[`/${session_id}/${consent_uuid}/new/check-answers`]: true
},
// Previous multi-dose journey
[`/${session_id}/${consent_uuid}/new/first-dose-country`]: {},
[`/${session_id}/${consent_uuid}/new/first-dose-date`]: {},
[`/${session_id}/${consent_uuid}/new/second-dose-country`]: {},
Expand Down Expand Up @@ -322,7 +326,7 @@ export const parentController = {
showForm(request, response) {
let { view } = request.params
const { consent } = response.locals
let key
let key = kebabToCamelCase(view)

// All health questions use the same view
if (view.startsWith('health-question-')) {
Expand Down
4 changes: 4 additions & 0 deletions app/locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -895,8 +895,11 @@ export const en = {
}
},
previousDose: {
label: 'Details of %s vaccination',
title: 'When and where did your child get their %s vaccination?',
country: {
label: 'Country',
title: 'Which country was the vaccination given in?',
england: 'England',
scotland: 'Scotland',
wales: 'Wales',
Expand All @@ -908,6 +911,7 @@ export const en = {
},
createdAt: {
label: 'Date',
title: 'When was the vaccination given?',
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'
},
scheduled: {
Expand Down
6 changes: 5 additions & 1 deletion app/models/reply.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ export class Reply {
: stringToBoolean(options?.invalid) || false
}

if (this.decision === ReplyDecision.AlreadyVaccinated) {
if (
[ReplyDecision.AlreadyVaccinated, ReplyDecision.Refused].includes(
this.decision
)
) {
this.firstDose = options?.firstDose && new Vaccination(options.firstDose)

if (options?.firstDose?.scheduled) {
Expand Down
93 changes: 57 additions & 36 deletions app/views/parent/form/check-answers.njk
Original file line number Diff line number Diff line change
Expand Up @@ -179,41 +179,62 @@
)
}) if consent.given }}

{{ summaryList({
card: {
heading: __("consent.firstDose.label"),
headingSize: "m"
},
rows: summaryRows(consent, {
createdAt: {
label: __("consent.previousDose.createdAt.label"),
value: consent.firstDose.formatted.createdAt_date,
href: editPath("first-dose-date")
},
country: {
label: __("consent.previousDose.country.label"),
value: consent.firstDose.formatted.country,
href: editPath("first-dose-country")
}
})
}) if consent.decision == ReplyDecision.AlreadyVaccinated }}
{% if SessionPresetName.MMR in session.presetNames and consent.decision == ReplyDecision.AlreadyVaccinated %}
{{ summaryList({
card: {
heading: __("consent.firstDose.label"),
headingSize: "m"
},
rows: summaryRows(consent, {
createdAt: {
label: __("consent.previousDose.createdAt.label"),
value: consent.firstDose.formatted.createdAt_date,
href: editPath("first-dose-date")
},
country: {
label: __("consent.previousDose.country.label"),
value: consent.firstDose.formatted.country,
href: editPath("first-dose-country")
}
})
}) }}

{{ summaryList({
card: {
heading: __("consent.secondDose.label"),
headingSize: "m"
},
rows: summaryRows(consent, {
createdAt: {
label: __("consent.previousDose.createdAt.label"),
value: consent.secondDose.formatted.createdAt_date,
href: editPath("second-dose-date")
},
country: {
label: __("consent.previousDose.country.label"),
value: consent.secondDose.formatted.country,
href: editPath("second-dose-country")
}
})
}) if consent.decision == ReplyDecision.AlreadyVaccinated }}
{{ summaryList({
card: {
heading: __("consent.secondDose.label"),
headingSize: "m"
},
rows: summaryRows(consent, {
createdAt: {
label: __("consent.previousDose.createdAt.label"),
value: consent.secondDose.formatted.createdAt_date,
href: editPath("second-dose-date")
},
country: {
label: __("consent.previousDose.country.label"),
value: consent.secondDose.formatted.country,
href: editPath("second-dose-country")
}
})
}) }}
{% elif consent.refusalReason == ReplyRefusal.AlreadyVaccinated %}
{{ summaryList({
card: {
heading: __("consent.previousDose.label", session.programmes[0].nameSentenceCase),
headingSize: "m"
},
rows: summaryRows(consent, {
createdAt: {
label: __("consent.previousDose.createdAt.label"),
value: consent.firstDose.formatted.createdAt_date,
href: editPath("previous-dose")
},
country: {
label: __("consent.previousDose.country.label"),
value: consent.firstDose.formatted.country,
href: editPath("previous-dose")
}
})
}) }}
{% endif %}
{% endblock %}
73 changes: 73 additions & 0 deletions app/views/parent/form/previous-dose.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{% extends "_layouts/form.njk" %}

{% set title = __("consent.previousDose.title", session.programmes[0].nameSentenceCase) %}

{% block form %}
{{ appHeading({
title: title
}) }}

{{ dateInput({
fieldset: {
legend: {
text: __("consent.previousDose.createdAt.title"),
size: "m"
}
},
hint: { text: __("consent.previousDose.createdAt.hint") },
decorate: "consent.firstDose.createdAt_"
}) }}

{{ radios({
fieldset: {
legend: {
text: __("consent.previousDose.country.title"),
size: "m"
}
},
items: [
{
text: __("consent.previousDose.country.england")
},
{
text: __("consent.previousDose.country.scotland")
},
{
text: __("consent.previousDose.country.wales")
},
{
text: __("consent.previousDose.country.ni")
},
{
divider: "or"
},
{
text: __("consent.previousDose.country.other"),
value: "Other",
conditional: {
html: select({
label: { text: __("consent.previousDose.countryOther.title") },
items: otherCountryItems(Country, consent.previousDose.countryOther),
decorate: "consent.firstDose.countryOther",
attributes: {
"data-module": "app-autocomplete"
}
})
}
}
],
decorate: "consent.firstDose.country"
}) }}

{{ input({
type: "hidden",
value: VaccinationOutcome.AlreadyVaccinated,
decorate: "consent.firstDose.outcome"
}) }}

{{ input({
type: "hidden",
value: session.programmes[0].sequenceDefault,
decorate: "consent.firstDose.sequence"
}) }}
{% endblock %}