diff --git a/app/routes/record-vaccinations.js b/app/routes/record-vaccinations.js index 80dec065..c7105840 100644 --- a/app/routes/record-vaccinations.js +++ b/app/routes/record-vaccinations.js @@ -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 = [] diff --git a/app/views/record-vaccinations/dose.html b/app/views/record-vaccinations/dose.html new file mode 100644 index 00000000..97be14a5 --- /dev/null +++ b/app/views/record-vaccinations/dose.html @@ -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 %} + +
+
+ + {% if (errors | length) > 0 %} + {{ errorSummary({ + titleText: "There is a problem", + errorList: errors + }) }} + {% endif %} + +
+ + {% 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?", + classes: "nhsuk-fieldset__legend--l", + isPageHeading: true + } + }, + items: items + }) }} + + {{ button({ + text: "Continue" + })}} +
+ +
+ +
+ +{% endblock %} \ No newline at end of file diff --git a/app/views/record-vaccinations/eligibility.html b/app/views/record-vaccinations/eligibility.html index 7f8de9aa..4ceded95 100644 --- a/app/views/record-vaccinations/eligibility.html +++ b/app/views/record-vaccinations/eligibility.html @@ -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 %} @@ -75,7 +79,13 @@ "In an at-risk group" ] %} +{% set 6in1EligibilityOptions = [ + "In an at-risk group", + "Age-based eligibility 0 to 5 years" +] %} + {% block content %} +
@@ -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 %}