Skip to content
Open
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
27 changes: 27 additions & 0 deletions app/data/organisations.js
Original file line number Diff line number Diff line change
Expand Up @@ -9050,5 +9050,32 @@ module.exports = [
}
}
]
},
{
id: "FT81513",
name: "Holborn Pharmacy",
address: {
line1: "131 Old Street",
town: "London",
postcode: "WC1 7RP"
},
type: "Community Pharmacy",
status: "Active",
region: "Y56",
vaccines: [
{name: "MMR", status: "enabled"},
{name: "flu (London service)", status: "enabled"}
],
sites: [
{
id: "FX252",
name: "Holborn Pharmacy",
address: {
line1: "131 Old Street",
town: "London",
postcode: "WC1 7RP"
}
}
]
}
]
16 changes: 16 additions & 0 deletions app/data/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -13988,5 +13988,21 @@ module.exports = [
"firstName": "Sally",
"lastName": "Green",
admin: true
},
// Jeremy is the lead pharmacist at a Holborn Pharmacy
// pharmacy onboarded for MMR and London flu only
{
"id": "633464144",
"email": "jeremy13.blue@nhs.net",
"firstName": "Jeremy",
"lastName": "Blue",
"organisations": [
{
"id": "FT81513",
"permissionLevel": "Lead administrator",
"status": "Active",
"vaccinator": true
}
]
}
]
28 changes: 28 additions & 0 deletions app/data/vaccine-stock.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,5 +408,33 @@ module.exports = [
expiryDate: "2027-11-23"
}
]
},
{
id: "2514771",
vaccine: "flu (London service)",
vaccineProduct: "Adjuvanted Trivalent Influenza Vaccine (aTIV)",
organisationId: "FT81513", // Holborn Pharmacy
siteId: "FX252", // Holborn Pharmacy
batches: [
{
id: "46436436",
batchNumber: "LDJE-24",
expiryDate: "2026-12-04"
}
]
},
{
id: "463646",
vaccine: "MMR",
vaccineProduct: "MMRVaXPro",
organisationId: "FT81513", // Holborn Pharmacy
siteId: "FX252", // Holborn Pharmacy
batches: [
{
id: "346436342",
batchNumber: "14-251",
expiryDate: "2027-01-13"
}
]
}
]
2 changes: 2 additions & 0 deletions app/data/vaccines.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = [
{
name: "COVID-19",
availableToAllSites: true,
products: [
{
name: "Comirnaty 3 LP.8.1",
Expand All @@ -18,6 +19,7 @@ module.exports = [
},
{
name: "flu",
availableToAllSites: true,
products: [
{
name: "Adjuvanted Trivalent Influenza Vaccine (aTIV)",
Expand Down
14 changes: 12 additions & 2 deletions app/routes/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,33 @@ module.exports = router => {
const currentUser = res.locals.currentUser

const data = req.session.data
const vaccinationsRecorded = data.vaccinationsRecorded
const allVaccinationsRecorded = data.vaccinationsRecorded
const dateToday = new Date()
const monthToday = (dateToday.getMonth() + 1) // JavaScript dates are 0-indexed

// Vaccinations to count
let vaccinationsRecorded = []

let sites = []
let organisations = []

if (currentOrganisation) {
// Showing all sites for now, for demo purposes
sites = currentOrganisation.sites

if (sites === []) {
// Filter vaccinations to only those recorded by the current
// organisation
vaccinationsRecorded = allVaccinationsRecorded.filter((vaccination)=> vaccination.organisationId === currentOrganisation.id)

if (sites.length === 0) {
sites = [currentOrganisation]
}

} else {

// Include all organisations for now
vaccinationsRecorded = allVaccinationsRecorded

const userOrganisationIds = currentUser.organisations.map((organisation) => organisation.id)
organisations = data.organisations.filter((organisation) => userOrganisationIds.includes(organisation.id) )
}
Expand Down
59 changes: 38 additions & 21 deletions app/routes/vaccines.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,24 @@ module.exports = (router) => {
const currentOrganisation = res.locals.currentOrganisation
const data = req.session.data

const organisationVaccines = res.locals.currentOrganisation.vaccines || []

const vaccinesEnabledNames = organisationVaccines
.filter((vaccine) => vaccine.status === "enabled")
.map((vaccine) => vaccine.name)

const allVaccines = data.vaccines

const vaccinesThatCanBeRequested = allVaccines
.filter((vaccine) => vaccine.availableToAllSites)
.filter((vaccine) => !vaccinesEnabledNames.includes(vaccine.name))
.map((vaccine) => vaccine.name)

const vaccineStock = data.vaccineStock.filter((vaccine) => vaccine.organisationId === currentOrganisation.id)

res.render('vaccines/index', {
vaccineStock
vaccineStock,
vaccinesThatCanBeRequested
})
})

Expand Down Expand Up @@ -69,40 +83,43 @@ module.exports = (router) => {

const vaccinesEnabled = allVaccines.filter((vaccine) => vaccinesEnabledNames.includes(vaccine.name))

const vaccinesDisabled = allVaccines.filter((vaccine) => !vaccinesEnabledNames.includes(vaccine.name))
const vaccinesThatCanBeRequested = allVaccines
.filter((vaccine) => vaccine.availableToAllSites)
.filter((vaccine) => !vaccinesEnabledNames.includes(vaccine.name))
.map((vaccine) => vaccine.name)


res.render('vaccines/choose-vaccine', {
vaccinesEnabled,
vaccinesDisabled
vaccinesThatCanBeRequested
})
})

// Confirmation of a vaccine being requested
router.post('/vaccines/request', (req, res) => {
// Enabling a new vaccine type
router.post('/vaccines/enable', (req, res) => {

const data = req.session.data
const currentOrganisation = res.locals.currentOrganisation

const vaccinesRequested = currentOrganisation.vaccines
.filter((vaccine) => data.vaccinesRequested.includes(vaccine.name))
const vaccinesAdded = data.vaccinesAdded

for (let vaccineRequested of vaccinesRequested) {
vaccineRequested.status = "requested"
}
for (const vaccine of vaccinesAdded) {

const region = data.regions.find((region) => region.id === currentOrganisation.region)
let vaccineToEnable = currentOrganisation.vaccines.find((vaccine) => vaccine.name === vaccine)

const currentDate = new Date().toISOString()
const generatedId = "AB" + Math.floor(Math.random() * 10000000).toString()
if (vaccineToEnable) {
vaccineToEnable.status = "enabled"

region.inbox ||= []
region.inbox.push({
id: generatedId,
fromOrganisationId: currentOrganisation.id,
vaccinesRequested: data.vaccinesRequested,
sentOn: currentDate
})
res.redirect('/vaccines/requested')
} else {

currentOrganisation.vaccines.push({
name: vaccine,
status: "enabled"
})
}
}

res.redirect('/vaccines/choose-vaccine')
})


Expand Down
1 change: 1 addition & 0 deletions app/views/auth/okta-sign-in.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ <h2 class="nhsuk-heading-s">Testing area</h2>
<li><a href="#" data-email="jason.white@nhs.net" data-module="prefill-email">Regional lead</a></li>
<li><a href="#" data-email="sally.green@nhs.net" data-module="prefill-email">Support user</a></li>
<li><a href="#" data-email="kaisley.wells@nhs.net" data-module="prefill-email">Lead admin at a trust with all vaccines enabled</a></li>
<li><a href="#" data-email="jeremy13.blue@nhs.net" data-module="prefill-email">Lead admin at a London pharmacy with local vaccination programme enabled only</a></li>
</ul>
</div>

Expand Down
35 changes: 23 additions & 12 deletions app/views/vaccines/choose-vaccine.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,29 @@
}) }}
</form>

{% if (vaccinesDisabled | length) > 0 %}
{% call details({ summaryText: "Need to add more vaccine types?"}) %}
<p>Select the vaccines you need.</p>
{% if (vaccinesThatCanBeRequested | length) > 0 %}

{% set detailsHtml %}
{% set requestableItems = [] %}
{% for vaccine in (vaccinesDisabled | sort(false, false, "name")) %}
{% for vaccine in (vaccinesThatCanBeRequested | sort) %}

{% set requestableItems = (requestableItems.push({
value: vaccine.name,
text: (vaccine.name | capitaliseFirstLetter)
value: vaccine,
text: (vaccine | capitaliseFirstLetter)
}), requestableItems) %}
{% endfor %}

<form action="/vaccines/request" method="post">
<form action="/vaccines/enable" method="post">

<p>You can now use RAVS to record national {{ vaccinesThatCanBeRequested | join(" and ") }} vaccinations.</p>

<p>Any vaccinations you record will be sent to Manage your service (MYS) for payments.</p>

<p>You will still have access to your previous system for at least 6 months so you can download reports.</p>

{{ checkboxes({
name: "vaccinesRequested",
idPrefix: "vaccines-requested",
name: "vaccinesAdded",
idPrefix: "vaccines-added",
fieldset: {
legend: {
text: "Vaccine",
Expand All @@ -101,12 +107,17 @@
}) }}

{{ button({
text: "Send request",
classes: "nhsuk-button--secondary"
text: "Add",
classes: "nhsuk-button--secondary nhsuk-u-margin-bottom-0"
}) }}
</form>
{% endset %}

{{ details({
summaryText: "Add other vaccines",
html: detailsHtml
}) }}

{% endcall %}
{% endif %}

</div>
Expand Down
14 changes: 14 additions & 0 deletions app/views/vaccines/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@ <h1 class="nhsuk-heading-l">Vaccines</h1>

<p class="nhsuk-body-l">Add and edit vaccines for your organisation.</p>

{% if (vaccinesThatCanBeRequested | length) > 0 %}

{% set insetTextHtml %}
<p>{{ tag({ text: "New", classes: "nhsuk-tag--blue"}) }}</p>
<p>You can now use RAVS to record national {{ vaccinesThatCanBeRequested | join(" and ") }} vaccinations. It’s free to use.</p>
{% endset %}

{{ insetText({
html: insetTextHtml,
classes: "nhsuk-u-padding-top-1 nhsuk-u-padding-bottom-1 nhsuk-u-margin-top-1 nhsuk-u-margin-bottom-6"
}) }}

{% endif %}

{{ button({
"text": "Add vaccine",
"href": "/vaccines/choose-site"
Expand Down