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
26 changes: 24 additions & 2 deletions app/routes/record-vaccinations.js
Original file line number Diff line number Diff line change
Expand Up @@ -861,17 +861,39 @@ module.exports = router => {
redirectPath = "/record-vaccinations/add-batch"
} else if (!vaccineBatch) {
redirectPath = "/record-vaccinations/batch?showError=yes"
} else if (["COVID-19", "flu", "flu (London service)", "RSV", "pneumococcal", "3-in-1 teenage booster", "HPV", "MenACWY", "MenB", "shingles"].includes(data.vaccine)) {
//} else if (["COVID-19", "flu", "flu (London service)", "RSV", "pneumococcal", "3-in-1 teenage booster", "HPV", "MenACWY", "MenB", "shingles"].includes(data.vaccine)) {
} else if (["COVID-19", "RSV", "pneumococcal", "3-in-1 teenage booster", "HPV", "MenACWY", "shingles"].includes(data.vaccine)) {
redirectPath = "/record-vaccinations/eligibility"
} else if (data.vaccine === "pertussis") {
redirectPath = "/record-vaccinations/patient-estimated-due-date"
} else if (["6-in-1", "flu", "flu (London service)", "MenB", "MMRV", "pneumococcal"].includes(data.vaccine)) {
data.showError = "no"
redirectPath = "/record-vaccinations/dose"
} else {
// MMR, MMRV, 4-in-1, 6-in-1, rotavirus, BCG, hepatitis B
redirectPath = "/record-vaccinations/consent"
}
res.redirect(redirectPath)
})

// START: answer-dose

router.post('/record-vaccinations/answer-dose', (req, res) => {

const data = req.session.data
const vaccineDose = data.vaccineDose

let redirectPath

if (!vaccineDose) {
redirectPath = "/record-vaccinations/dose?showError=yes"
} else {
redirectPath = "/record-vaccinations/eligibility"
}
res.redirect(redirectPath)
})

// END: answer-dose

router.get('/record-vaccinations/add-batch', (req, res) => {
const data = req.session.data
let errors = []
Expand Down
116 changes: 116 additions & 0 deletions app/views/record-vaccinations/dose.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{% extends 'layout.html' %}

{% set pageName = "Which dose of " + data.vaccine + " are you giving?" %}

{% set currentSection = "vaccinate" %}
{% set organisationSetting = currentUser.organisations | findById(data.currentOrganisationId) %}

{% set previousPage = "/record-vaccinations/batch" %}

{% block beforeContent %}
{{ backLink({ href: previousPage }) }}
{% endblock %}

{% block content %}

{% set errors = [] %}

{% if data.showError == "yes" %}
{% set errors = [{
text: "Select which dose of " + data.vaccine + " are you giving",
href: "#vaccineDose"
}] %}
{% endif %}

<div class="nhsuk-grid-row">
<div class="nhsuk-grid-column-two-thirds">

{% if (errors | length) > 0 %}
{{ errorSummary({
titleText: "There is a problem",
errorList: errors
}) }}
{% endif %}

<form action="/record-vaccinations/answer-dose" method="post" novalidate>

{% if data.vaccine == "6-in-1" %}
{% set doseOptions = [
"1st dose",
"2nd dose",
"3rd dose",
"4th dose"
] %}
{% elif data.vaccine == "flu" %}
{% set doseOptions = [
"1st dose",
"2nd dose"
] %}
{% elif data.vaccine == "MenB" %}
{% set doseOptions = [
"1st dose",
"2nd dose",
"Booster"
] %}
{% elif data.vaccine == "MMRV" %}
{% set doseOptions = [
"1st dose",
"2nd dose",
"3rd dose"
] %}
{% elif data.vaccine == "pneumococcal" %}
{% set doseOptions = [
"1st dose",
"2nd dose",
"Booster"
] %}
{% else %}
{% set doseOptions = [] %}
{% endif %}

{% set items = [] %}

{% for option in doseOptions %}
{% set items = (items.push({
text: option,
value: option,
checked: (data.vaccineDose == option)
}), items) %}
{% endfor %}

{% set items = (items.push({
divider: "or"
}), items) %}

{% set items = (items.push({
text: "Not relevant",
value: "Not relevant",
checked: (data.vaccineDose == "Not relevant")
}), items) %}

{{ radios({
idPrefix: "vaccineDose",
name: "vaccineDose",
errorMessage: {
text: (errors | first).text
} if (errors | length) > 0,
fieldset: {
legend: {
text: "Which dose of " + data.vaccine + " are you giving?",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we include the word "vaccine" in the question? 🤔

"Which dose of MMR are you giving?"

...makes sense but this reads a bit oddly:

"Which dose of flu are you giving?"

Suggested change
text: "Which dose of " + data.vaccine + " are you giving?",
text: "Which dose of the " + data.vaccine + " vaccine are you giving?",

classes: "nhsuk-fieldset__legend--l",
isPageHeading: true
}
},
items: items
}) }}

{{ button({
text: "Continue"
})}}
</form>

</div>

</div>

{% endblock %}
14 changes: 13 additions & 1 deletion app/views/record-vaccinations/eligibility.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
{% set currentSection = "vaccinate" %}

{% block beforeContent %}
{% set backHref = from if from else "/record-vaccinations/batch" %}
{% if ["6-in-1", "flu", "flu (London service)", "MenB", "MMRV", "pneumococcal"].includes(data.vaccine) %}
{% set backHref = "/record-vaccinations/dose" %}
{% else %}
{% set backHref = from if from else "/record-vaccinations/batch" %}
{% endif %}

{{ backLink({ href: backHref }) }}
{% endblock %}
Expand Down Expand Up @@ -75,7 +79,13 @@
"In an at-risk group"
] %}

{% set 6in1EligibilityOptions = [
"In an at-risk group",
"Age-based eligibility 0 to 5 years"
Comment on lines +83 to +84
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we used "Based on age" rather than "Age-based eligibility 0 to 5 years", for consistency with the others?

Could also go in alphabetical order?

Suggested change
"In an at-risk group",
"Age-based eligibility 0 to 5 years"
"Based on age",
"In an at-risk group"

I also wasn't aware that this was additionally given to at-risk groups!

] %}

{% block content %}

<div class="nhsuk-grid-row">
<div class="nhsuk-grid-column-two-thirds">

Expand Down Expand Up @@ -108,6 +118,8 @@
{% set eligibilityOptions = MenBEligibilityOptions %}
{% elif data.vaccine == "shingles" %}
{% set eligibilityOptions = shinglesEligibilityOptions %}
{% elif data.vaccine == "6-in-1" %}
{% set eligibilityOptions = 6in1EligibilityOptions %}
{% else %}
{% set eligibilityOptions = [] %}
{% endif %}
Expand Down