Skip to content

Commit 97b2470

Browse files
Allow regions to only add vaccines to orgs, not remove (#385)
This updates the design done in #365 to make a small change in that we’ve decided to only allow regions to _add_ the ability for organisations to record individual vaccine types, but not to _remove_ access. This is because: * an organisation might need to edit (or correct by deleting and re-adding) a record for a vaccine even if they're no longer giving it * organisations are able to add records retrospectively if needed * we don’t want to encourage regions to unnecessarily remove access to vaccines 'out of season' (ie in the summer) when an organisation is likely to need access again in the winter ## Screenshots | Before | After | | -------|-------| | ![Screenshot 2025-07-03 at 14 47 46](https://github.com/user-attachments/assets/3c972b1a-155d-4131-99b0-417552f79c1d) | ![Screenshot 2025-07-03 at 14 47 27](https://github.com/user-attachments/assets/8274ef39-8348-46c2-951f-d135469496e3) | | ![Screenshot 2025-07-03 at 14 48 21](https://github.com/user-attachments/assets/18e1ea51-63a9-4737-848f-b4d323514a68) | ![Screenshot 2025-07-03 at 14 48 39](https://github.com/user-attachments/assets/1104400b-a5dd-4aec-8917-41f70390ed8c) | | ![Screenshot 2025-07-03 at 14 49 27](https://github.com/user-attachments/assets/8d06025a-c360-44ee-8a22-ab4d6287ef8b) | ![Screenshot 2025-07-03 at 16 18 00](https://github.com/user-attachments/assets/54a01ef2-c287-4149-ab03-a0cd36726092) |
1 parent 2445b56 commit 97b2470

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

app/routes/regions.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -267,18 +267,18 @@ module.exports = router => {
267267
})
268268

269269
// Viewing the page to set vaccines per organisation
270-
router.get('/regions/organisations/:id/change-vaccines', (req, res) => {
270+
router.get('/regions/organisations/:id/add-vaccines', (req, res) => {
271271
const data = req.session.data
272272
const id = req.params.id
273273
const organisation = data.organisations.find((org) => org.id === id)
274274
if (!organisation) { res.redirect('/regions/'); return }
275275

276276
const vaccines = organisation.vaccines || []
277-
const vaccinesEnabled = vaccines.filter((vaccine) => vaccine.status === "enabled")
277+
const vaccinesNotYetAdded = vaccines.filter((vaccine) => vaccine.status !== "enabled")
278278

279-
res.render('regions/change-vaccines', {
279+
res.render('regions/add-vaccines', {
280280
organisation,
281-
vaccinesEnabled
281+
vaccinesNotYetAdded
282282
})
283283
})
284284

@@ -289,12 +289,14 @@ module.exports = router => {
289289
const organisation = data.organisations.find((org) => org.id === id)
290290
if (!organisation) { res.redirect('/regions/'); return }
291291

292-
const vaccinesEnabled = data.vaccinesEnabled
292+
const vaccinesToAdd = data.vaccinesToAdd
293293

294294
const vaccines = organisation.vaccines || []
295295

296296
for (vaccine of vaccines) {
297-
vaccine.status = (vaccinesEnabled.includes(vaccine.name) ? "enabled" : "disabled")
297+
if (vaccinesToAdd.includes(vaccine.name)) {
298+
vaccine.status = "enabled"
299+
}
298300
}
299301

300302
res.redirect(`/regions/organisations/${id}`)
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,28 @@
2424

2525
{% set items = [] %}
2626

27-
{% for vaccine in (organisation.vaccines | sort(false, false, "name")) %}
27+
{% for vaccine in (vaccinesNotYetAdded) %}
2828
{% set items = (items.push({
2929
value: vaccine.name,
3030
text: (vaccine.name | capitaliseFirstLetter)
3131
}), items) %}
3232
{% endfor %}
3333

3434
{{ checkboxes({
35-
name: "vaccinesEnabled",
35+
name: "vaccinesToAdd",
3636
classes: "nhsuk-radios--inline",
3737
fieldset: {
3838
legend: {
39-
text: "Which vaccinations can they record?",
39+
text: "Which vaccines do you want to add?",
4040
classes: "nhsuk-fieldset__legend--l",
4141
isPageHeading: true
4242
}
4343
},
44-
values: (vaccinesEnabled | pluck("name")),
4544
items: items
4645
}) }}
4746

4847
{{ button({
49-
text: "Save"
48+
text: "Confirm"
5049
}) }}
5150
</form>
5251

app/views/regions/organisation.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ <h1 class="nhsuk-heading-l">{{ organisation.name }}</h1>
3737
{{ vaccinesEnabled | sort(false, false, "name") | pluck("name") | formatList }}
3838
{% endif %}
3939
vaccinations.
40-
<a href="/regions/organisations/{{organisation.id}}/change-vaccines">Change <span class="nhsuk-u-visually-hidden">vaccines available</span></a>
40+
41+
{% if (vaccinesEnabled | length) < 4 %}
42+
<a href="/regions/organisations/{{organisation.id}}/add-vaccines">Add vaccines<span class="nhsuk-u-visually-hidden"></span></a>
43+
{% endif %}
4144
</p>
4245

4346
{% if (messages | length) > 0 %}

0 commit comments

Comments
 (0)