Batches
{% endif %}
- {% if batch.deactivatedDate %}
+ {% if batch.deactivationReason == "site" %}
+ Site deactivated
+ {% elif batch.deactivatedDate %}
Deactivated by user
{% elif (batch.expiryDate | daysAgo) > 0 %}
Expired
From f77d988975c42f66c0c72e1a4b38f6021a1a053b Mon Sep 17 00:00:00 2001
From: Benjy Stanton <2545065+benjystanton@users.noreply.github.com>
Date: Thu, 24 Sep 2026 11:31:59 +0100
Subject: [PATCH 13/22] Deactivate batches if parent site is deactivated
---
app/routes/vaccines.js | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/app/routes/vaccines.js b/app/routes/vaccines.js
index a799cb13..66eeb18e 100644
--- a/app/routes/vaccines.js
+++ b/app/routes/vaccines.js
@@ -224,11 +224,24 @@ module.exports = (router) => {
// Mark site as closed
router.post('/vaccines/sites/:siteId/deactivated', (req, res) => {
const currentOrganisationSites = res.locals.currentOrganisation.sites || []
+ const data = req.session.data
const site = currentOrganisationSites.find((item) => item.id === req.params.siteId)
if (!site) { res.redirect('/vaccines'); return }
site.status = 'closed'
+ const today = new Date().toISOString().substring(0, 10)
+ data.vaccineStock
+ .filter((vaccine) => vaccine.organisationId === res.locals.currentOrganisation.id && vaccine.siteId === site.id)
+ .forEach((vaccine) => {
+ vaccine.batches.forEach((batch) => {
+ if (!batch.deactivatedDate && batch.expiryDate >= today) {
+ batch.deactivatedDate = today
+ batch.deactivationReason = 'site'
+ }
+ })
+ })
+
res.redirect(`/vaccines?siteTab=deactivated&deactivatedSite=true&siteName=${encodeURIComponent(site.name)}`)
})
@@ -246,11 +259,23 @@ module.exports = (router) => {
// Mark site as active
router.post('/vaccines/sites/:siteId/reactivated', (req, res) => {
const currentOrganisationSites = res.locals.currentOrganisation.sites || []
+ const data = req.session.data
const site = currentOrganisationSites.find((item) => item.id === req.params.siteId)
if (!site) { res.redirect('/vaccines'); return }
delete site.status
+ data.vaccineStock
+ .filter((vaccine) => vaccine.organisationId === res.locals.currentOrganisation.id && vaccine.siteId === site.id)
+ .forEach((vaccine) => {
+ vaccine.batches.forEach((batch) => {
+ if (batch.deactivationReason === 'site') {
+ batch.deactivatedDate = null
+ delete batch.deactivationReason
+ }
+ })
+ })
+
res.redirect(`/vaccines?siteTab=active&reactivatedSite=true&siteName=${encodeURIComponent(site.name)}`)
})
@@ -496,6 +521,7 @@ module.exports = (router) => {
let deactivatedDate = new Date()
batch.deactivatedDate = deactivatedDate.toISOString().substring(0,10)
+ batch.deactivationReason = 'manual'
res.redirect(`/vaccines/${vaccine.id}?tab=inactive&deactivated=true&batchNumber=${encodeURIComponent(batch.batchNumber)}`)
})
From eac857ffe7f28d4b8092b93c3a5d475bb52a74ee Mon Sep 17 00:00:00 2001
From: Benjy Stanton <2545065+benjystanton@users.noreply.github.com>
Date: Thu, 24 Sep 2026 11:34:57 +0100
Subject: [PATCH 14/22] If no active batches are available and user clicks on
vaccine product page, go straight to deactivated tab
---
app/routes/vaccines.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/app/routes/vaccines.js b/app/routes/vaccines.js
index 66eeb18e..00783010 100644
--- a/app/routes/vaccines.js
+++ b/app/routes/vaccines.js
@@ -370,7 +370,9 @@ module.exports = (router) => {
const currentTab = requestedTab === 'inactive' && batchesByStatus.inactive.length === 0
? 'active'
- : requestedTab
+ : requestedTab === 'active' && batchesByStatus.active.length === 0 && batchesByStatus.inactive.length > 0
+ ? 'inactive'
+ : requestedTab
const filteredBatches = batchesByStatus[currentTab]
const totalBatches = filteredBatches.length
From bfed4e899c2041054bc93ce1b1b024f0c3e92bc2 Mon Sep 17 00:00:00 2001
From: Benjy Stanton <2545065+benjystanton@users.noreply.github.com>
Date: Thu, 24 Sep 2026 11:43:33 +0100
Subject: [PATCH 15/22] Filter site list to only show selected one (only
possible when 5 or more)
---
app/assets/javascript/main.js | 1 +
app/assets/javascript/vaccine-site-filter.js | 16 ++++++++++++++++
app/views/vaccines/index.html | 2 ++
3 files changed, 19 insertions(+)
create mode 100644 app/assets/javascript/vaccine-site-filter.js
diff --git a/app/assets/javascript/main.js b/app/assets/javascript/main.js
index c7464192..dabe5ee9 100644
--- a/app/assets/javascript/main.js
+++ b/app/assets/javascript/main.js
@@ -9,6 +9,7 @@ import { CheckboxFilter } from './checkbox-filter.js'
import { CheckboxSelectAll } from './checkbox-select-all.js'
import { CheckboxSelectedCount } from './checkbox-selected-count.js'
import { RadiosFilter } from './radios-filter.js'
+import './vaccine-site-filter.js'
// Initiate NHS.UK frontend components on page load
document.addEventListener('DOMContentLoaded', () => {
diff --git a/app/assets/javascript/vaccine-site-filter.js b/app/assets/javascript/vaccine-site-filter.js
new file mode 100644
index 00000000..048a5324
--- /dev/null
+++ b/app/assets/javascript/vaccine-site-filter.js
@@ -0,0 +1,16 @@
+// Filter vaccine site sections from the site select menu
+
+document.addEventListener('DOMContentLoaded', () => {
+ const select = document.getElementById('select-1')
+ const siteSections = document.querySelectorAll('[data-vaccine-site]')
+
+ if (!select || siteSections.length === 0) return
+
+ select.addEventListener('change', () => {
+ const selectedSite = select.value
+
+ siteSections.forEach((siteSection) => {
+ siteSection.hidden = selectedSite !== '' && siteSection.dataset.vaccineSite !== selectedSite
+ })
+ })
+})
diff --git a/app/views/vaccines/index.html b/app/views/vaccines/index.html
index 1c3d52ea..e4fb06b6 100644
--- a/app/views/vaccines/index.html
+++ b/app/views/vaccines/index.html
@@ -163,6 +163,7 @@ Vaccines
{% set site = currentOrganisation.sites | findById(siteId) %}
+
{{ site.name }}
@@ -243,6 +244,7 @@ Vaccines
Using this site again? Reactivate {{ site.name }}
{% endif %}
+
{% endfor %}
From 0f4bbd1f0b39a1fc714a29b710c4728f7e0e4953 Mon Sep 17 00:00:00 2001
From: Anna-Sutton
Date: Thu, 24 Sep 2026 17:28:09 +0100
Subject: [PATCH 16/22] Delete app/views/errors/problem-deactivating-site.html
Deleting this error page as no longer needed.
---
app/views/errors/problem-deactivating-site.html | 16 ----------------
1 file changed, 16 deletions(-)
delete mode 100644 app/views/errors/problem-deactivating-site.html
diff --git a/app/views/errors/problem-deactivating-site.html b/app/views/errors/problem-deactivating-site.html
deleted file mode 100644
index df2ab7a3..00000000
--- a/app/views/errors/problem-deactivating-site.html
+++ /dev/null
@@ -1,16 +0,0 @@
-{% extends 'layout.html' %}
-
-{% set pageName = "There is a problem deactivating this site" %}
-{% set currentSection = "vaccines" %}
-
-
-{% block content %}
-
-{% endblock %}
From 2ef822fa6b916d7505afcf5f3143756389bd871f Mon Sep 17 00:00:00 2001
From: Anna-Sutton
Date: Thu, 24 Sep 2026 17:30:32 +0100
Subject: [PATCH 17/22] Removed one of the error msg for when deactivating a
site doesn't work.
Updated error message to clarify deactivation issues.
---
app/views/index.html | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/app/views/index.html b/app/views/index.html
index c836403b..afc339cf 100755
--- a/app/views/index.html
+++ b/app/views/index.html
@@ -310,14 +310,7 @@ Error pages
html: "There is a problem deactivating this site"
},
{
- text: "When there is a generic problem deactivating a site ('Try again' takes user back to the 'Confirm site deactivation' page)."
- }
- ],[
- {
- html: "There is a problem deactivating this site"
- },
- {
- text: "When there is a problem deactivating a site because 2 users are trying to do this at the same time."
+ text: "When there is a problem deactivating a site because 2 users are trying to do this at the same time or because of another issue such as API failure."
}
]
]
From 0e58419fa0ca695b61a69198c942c0f91fb725bc Mon Sep 17 00:00:00 2001
From: Anna-Sutton
Date: Thu, 24 Sep 2026 17:32:58 +0100
Subject: [PATCH 18/22] Update link text for navigation on deactivated site
page
---
app/views/errors/site-deactivated.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/errors/site-deactivated.html b/app/views/errors/site-deactivated.html
index 017df91b..6d292206 100644
--- a/app/views/errors/site-deactivated.html
+++ b/app/views/errors/site-deactivated.html
@@ -14,7 +14,7 @@ {{ pageName }}
If no one is available to reactivate the site, record it on paper.
Download our paper form (opens in new tab)
- Go back to the Check and confirm page to see details of the vaccination.
+ Go back to Record vaccinations
From 6bd847e4ec985d4da01b618ef7f99d2c743e02d0 Mon Sep 17 00:00:00 2001
From: Anna-Sutton
Date: Thu, 24 Sep 2026 20:13:11 +0100
Subject: [PATCH 19/22] Update error link for site deactivation issue
---
app/views/index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/index.html b/app/views/index.html
index afc339cf..caeeac19 100755
--- a/app/views/index.html
+++ b/app/views/index.html
@@ -307,7 +307,7 @@ Error pages
],
[
{
- html: "There is a problem deactivating this site"
+ html: "There is a problem deactivating this site"
},
{
text: "When there is a problem deactivating a site because 2 users are trying to do this at the same time or because of another issue such as API failure."
From df8402a2895c19870f237ab4a7894aaf9f08ce72 Mon Sep 17 00:00:00 2001
From: Benjy Stanton <2545065+benjystanton@users.noreply.github.com>
Date: Fri, 25 Sep 2026 08:53:02 +0100
Subject: [PATCH 20/22] Pointed link at /vaccines
---
app/views/errors/problem-deactivating-site-2-users-trying.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/errors/problem-deactivating-site-2-users-trying.html b/app/views/errors/problem-deactivating-site-2-users-trying.html
index c10b0698..87c74104 100644
--- a/app/views/errors/problem-deactivating-site-2-users-trying.html
+++ b/app/views/errors/problem-deactivating-site-2-users-trying.html
@@ -9,7 +9,7 @@
{{ pageName }}
- Go back to the Vaccines section and check the site's status before trying again.
+ Go back to the Vaccines section and check the site's status before trying again.
From 057f4624a3ccfb1c863fd33dab5ef8d0b63afeb1 Mon Sep 17 00:00:00 2001
From: Benjy Stanton <2545065+benjystanton@users.noreply.github.com>
Date: Fri, 25 Sep 2026 08:56:25 +0100
Subject: [PATCH 21/22] Add missing p tag and missing link destination
---
app/views/errors/site-deactivated.html | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/app/views/errors/site-deactivated.html b/app/views/errors/site-deactivated.html
index 6d292206..b43e6fa6 100644
--- a/app/views/errors/site-deactivated.html
+++ b/app/views/errors/site-deactivated.html
@@ -3,22 +3,23 @@
{% set pageName = "There is a problem saving this vaccination" %}
{% block content %}
+
+
{{ pageName }}
You cannot save this vaccination because [site name] has been deactivated.
- An administrator can reactivate the site in the Vaccines setion. Once the site is reactivated, you will be able to record this vaccination but you will have to start again.
+ An administrator can reactivate the site in the Vaccines setion. Once the site is reactivated, you will be able to record this vaccination but you will have to start again.
If no one is available to reactivate the site, record it on paper.
Download our paper form (opens in new tab)
- Go back to Record vaccinations
-
+
+ Go back to Record vaccinations
-
{% endblock %}
From 7a32994fd565d54b2f947c448ad24f9203c450b9 Mon Sep 17 00:00:00 2001
From: Benjy Stanton <2545065+benjystanton@users.noreply.github.com>
Date: Fri, 25 Sep 2026 08:59:11 +0100
Subject: [PATCH 22/22] Pointed link at page so link works
---
app/views/errors/vaccine-disabled.html | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/app/views/errors/vaccine-disabled.html b/app/views/errors/vaccine-disabled.html
index 1077330b..1adc96d2 100644
--- a/app/views/errors/vaccine-disabled.html
+++ b/app/views/errors/vaccine-disabled.html
@@ -3,8 +3,10 @@
{% set pageName = "There is a problem saving this vaccination" %}
{% block content %}
+
-
{% endblock %}
|