From 2a8c48a18445588dcfbbdaa02ab2b52cebc2a658 Mon Sep 17 00:00:00 2001 From: Caitlin Roach Date: Tue, 16 Jun 2026 16:14:41 +0100 Subject: [PATCH 1/2] Add empty state for no pharmacies --- app/routes/prototype-admin.js | 14 +++ .../includes/_preset-scenarios-table.html | 8 ++ app/views/pharmacies/index.html | 116 +++++++++--------- 3 files changed, 81 insertions(+), 57 deletions(-) diff --git a/app/routes/prototype-admin.js b/app/routes/prototype-admin.js index b2401748..2bd6777f 100644 --- a/app/routes/prototype-admin.js +++ b/app/routes/prototype-admin.js @@ -564,6 +564,20 @@ module.exports = (router) => { res.redirect('/home') }) + // ---------------------------------------------------------------- + // Preset: Pharmacy HQ, no data (Amanda White, P15951) + // ---------------------------------------------------------------- + + router.get('/prototype-setup/preset/pharmacy-hq-no-data', (req, res) => { + resetSession(req) + const data = req.session.data + data.currentUserId = '6424325235325' + data.currentOrganisationId = 'P15951' + // Remove all pharmacies belonging to P15951 to start with a clean slate + data.organisations = data.organisations.filter(org => org.companyId !== 'P15951' || org.type === 'Pharmacy HQ') + res.redirect('/home') + }) + // ---------------------------------------------------------------- // Preset: Recorder, single organisation (Ocean Merritt, FR4V56) // ---------------------------------------------------------------- diff --git a/app/views/includes/_preset-scenarios-table.html b/app/views/includes/_preset-scenarios-table.html index 3d9bd63b..05a98cf7 100644 --- a/app/views/includes/_preset-scenarios-table.html +++ b/app/views/includes/_preset-scenarios-table.html @@ -71,6 +71,14 @@ role: "Group administrator", scenarioDetails: "Group admin for a large pharmacy chain (same-name pharmacies)." }, + { + presetLabel: "Group admin, pharmacy HQ (no data)", + presetPath: "/prototype-setup/preset/pharmacy-hq-no-data", + userName: "Amanda White", + userEmail: "amanda.white@nhs.net", + role: "Group administrator", + scenarioDetails: "Group admin for a pharmacy HQ with no pre-loaded data, pharmacies or users." + }, { presetLabel: "Regional lead", presetPath: "/prototype-setup/preset/regions", diff --git a/app/views/pharmacies/index.html b/app/views/pharmacies/index.html index b033a9bf..ac9ab6ff 100644 --- a/app/views/pharmacies/index.html +++ b/app/views/pharmacies/index.html @@ -43,65 +43,67 @@

Pharmacies

href: "/pharmacies/select" }) }} - - -
Pharmacies added ({{ organisations | length }})
- {% if (organisations | length) > 10 %} -
- - -
- {% endif %} - - - - - - - - - - - - {% for organisation in organisations %} - - - - - - + {% if (organisations | length) > 0 %} +
- Name - - Vaccines - - Users - - Status - - Actions -
- {{ organisation.name }} ({{ organisation.id}}) - - {% set vaccinesEnabled = [] %} - {% for vaccine in organisation.vaccines %} - {% if vaccine.status == "enabled" %} - {% set vaccinesEnabled = (vaccinesEnabled.push(vaccine.name), vaccinesEnabled) %} - {% endif %} - {% endfor %} - - {{ (vaccinesEnabled | sort | join(", ")) | capitaliseFirstLetter }} - - {{ organisationUserCounts[organisation.id] }} - - {{ organisation.status }} - - Manage -
+ +
Pharmacies added ({{ organisations | length }})
+ {% if (organisations | length) > 10 %} +
+ + +
+ {% endif %} + + + + + + + + - {% endfor %} + + + {% for organisation in organisations %} + + + + + + + + {% endfor %} - -
+ Name + + Vaccines + + Users + + Status + + Actions +
+ {{ organisation.name }} ({{ organisation.id}}) + + {% set vaccinesEnabled = [] %} + {% for vaccine in organisation.vaccines %} + {% if vaccine.status == "enabled" %} + {% set vaccinesEnabled = (vaccinesEnabled.push(vaccine.name), vaccinesEnabled) %} + {% endif %} + {% endfor %} + + {{ (vaccinesEnabled | sort | join(", ")) | capitaliseFirstLetter }} + + {{ organisationUserCounts[organisation.id] }} + + {{ organisation.status }} + + Manage +
+ + + {% endif %} {% if closedOrganisations.length > 0 %}
From a17cc7124b3148f6534321d9a20ca3daa898797c Mon Sep 17 00:00:00 2001 From: Caitlin Roach Date: Wed, 12 Aug 2026 17:09:53 +0100 Subject: [PATCH 2/2] Fix capitalisation issue and add user h1 --- app/filters.js | 2 ++ app/routes/regions.js | 4 +++- app/views/regions/add-email.html | 4 ++-- app/views/regions/vaccines.html | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/filters.js b/app/filters.js index 31f90c6e..62339447 100644 --- a/app/filters.js +++ b/app/filters.js @@ -122,6 +122,8 @@ module.exports = function () { return Math.floor((today - inviteDay) / millisecondsPerDay) } + filters.ucFirst = (str) => str ? str.charAt(0).toUpperCase() + str.slice(1) : str + /* keep the following line to return your filters to the app */ return filters } diff --git a/app/routes/regions.js b/app/routes/regions.js index 98410604..860bb207 100644 --- a/app/routes/regions.js +++ b/app/routes/regions.js @@ -111,9 +111,11 @@ module.exports = router => { const data = req.session.data const organisationId = data.organisationId const organisation = data.allOrganisations.find((organisation) => organisation.id === organisationId) + const isFirstUser = !data.users.some(user => user.organisations && user.organisations.some(org => org.id === organisationId)) res.render('regions/add-email', { - organisation + organisation, + isFirstUser }) }) diff --git a/app/views/regions/add-email.html b/app/views/regions/add-email.html index 4c0ee1f6..ca6f708d 100644 --- a/app/views/regions/add-email.html +++ b/app/views/regions/add-email.html @@ -1,6 +1,6 @@ {% extends 'layout.html' %} -{% set pageName = "Add another user" %} +{% set pageName = "Add a user" if isFirstUser else "Add another user" %} {% set currentSection = "organisations" %} {% block beforeContent %} @@ -16,7 +16,7 @@
{{ organisation.name }} ({{ organisation.id }})
-

Add another user

+

{{ pageName }}

Choose a user at {{ organisation.name }}.

diff --git a/app/views/regions/vaccines.html b/app/views/regions/vaccines.html index 63adc954..989b29f0 100644 --- a/app/views/regions/vaccines.html +++ b/app/views/regions/vaccines.html @@ -21,7 +21,7 @@ {% for vaccine in (data.vaccines | sort(false, false, "name")) %} {% set items = (items.push({ value: vaccine.name, - text: (vaccine.name ) + text: vaccine.name | ucFirst }), items) %} {% endfor %}