Skip to content
Draft
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
25 changes: 25 additions & 0 deletions app/assets/sass/_overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,31 @@
}
}

.app-pre-footer-banner {
border-top: 1px solid #b1b4b6;
}

.app-pre-footer-banner .govuk-phase-banner__content {
display: flex;
flex-wrap: nowrap;
align-items: baseline;
@include nhsuk-font(16);
margin-top: 24px;
margin-bottom: 24px;
}

.app-pre-footer-banner .govuk-phase-banner__content__tag {
@include nhsuk-font(16);
margin-right: 18px;
margin-bottom: 0;
}

.app-pre-footer-banner .govuk-phase-banner__text {
@include nhsuk-font(16);
display: inline;
margin-bottom: 0;
}

.app-custom-config-progress-card__details {
.nhsuk-details {
margin-bottom: 0;
Expand Down
22 changes: 21 additions & 1 deletion app/routes/appointments.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
module.exports = (router) => {

const getDefaultLandingPath = (organisation) => {
if (!organisation) {
return '/home'
}

if (organisation.type === 'Region') {
return '/regions'
}

if (organisation.type !== 'Pharmacy HQ' && organisation.appointmentsInterfaceEnabled !== false) {
return '/appointments'
}

if (organisation.type !== 'Pharmacy HQ') {
return '/record-vaccinations'
}

return '/home'
}

router.get('/appointments', (req, res) => {
if (res.locals.currentOrganisation && res.locals.currentOrganisation.appointmentsInterfaceEnabled === false) {
return res.redirect('/home')
return res.redirect(getDefaultLandingPath(res.locals.currentOrganisation))
}

const data = req.session.data
Expand Down
26 changes: 24 additions & 2 deletions app/routes/auth.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
module.exports = router => {

const getDefaultLandingPath = (data, organisationId) => {
const organisation = (data.organisations || []).find((item) => item.id === organisationId)

if (!organisation) {
return '/home'
}

if (organisation.type === 'Region') {
return '/regions'
}

if (organisation.type !== 'Pharmacy HQ' && organisation.appointmentsInterfaceEnabled !== false) {
return '/appointments'
}

if (organisation.type !== 'Pharmacy HQ') {
return '/record-vaccinations'
}

return '/home'
}

router.post('/auth/sign-in', (req, res) => {

const data = req.session.data
Expand Down Expand Up @@ -36,7 +58,7 @@ module.exports = router => {
req.session.data.currentUserId = user.id;
req.session.data.currentOrganisationId = userOrganisationIds[0]

res.redirect('/home')
res.redirect(getDefaultLandingPath(data, userOrganisationIds[0]))

} else if (userRegionIds.length === 1) {

Expand Down Expand Up @@ -90,7 +112,7 @@ module.exports = router => {
req.session.data.currentUserId = user.id
req.session.data.currentOrganisationId = selectedOrganisationId;

res.redirect('/home')
res.redirect(getDefaultLandingPath(data, selectedOrganisationId))
} else {

res.redirect('/auth/select-organisation')
Expand Down
2 changes: 1 addition & 1 deletion app/routes/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ module.exports = router => {
}
}

res.render('home/index', {
res.render('dashboard/index', {
sites,
pharmacies,
totalVaccinationsRecorded,
Expand Down
90 changes: 61 additions & 29 deletions app/routes/prototype-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,6 @@ const SIGN_IN_USERS = [
orgId: 'FT81513',
role: 'Lead administrator',
orgDescription: 'Holborn Pharmacy (FT81513) — MMR and London flu only'
},
{
id: '5500000001',
name: 'Riley Carter',
email: 'riley.carter@nhs.net',
orgId: 'FR4V56',
role: 'Recorder',
orgDescription: 'pharmacy (FR4V56), no appointments interface',
appointmentsInterfaceEnabled: false
}
]

Expand Down Expand Up @@ -424,6 +415,40 @@ module.exports = (router) => {
})
}

function setAppointmentsInterfaceForUserOrganisations(data, userId, isEnabled) {
const user = data.users.find(item => item.id === userId)
if (!user || !Array.isArray(user.organisations)) return

for (const userOrganisation of user.organisations) {
const organisation = data.organisations.find(item => item.id === userOrganisation.id)
if (!organisation) continue

organisation.appointmentsInterfaceEnabled = isEnabled
}
}

function getDefaultLandingPath(data, organisationId) {
const organisation = (data.organisations || []).find(item => item.id === organisationId)

if (!organisation) {
return '/home'
}

if (organisation.type === 'Region') {
return '/regions'
}

if (organisation.type !== 'Pharmacy HQ' && organisation.appointmentsInterfaceEnabled !== false) {
return '/appointments'
}

if (organisation.type !== 'Pharmacy HQ') {
return '/record-vaccinations'
}

return '/home'
}

// ----------------------------------------------------------------
// Reset data
// ----------------------------------------------------------------
Expand Down Expand Up @@ -476,10 +501,11 @@ module.exports = (router) => {
const data = req.session.data
data.currentUserId = '2387441662601'
data.currentOrganisationId = 'RW3'
setAppointmentsInterfaceForUserOrganisations(data, data.currentUserId, false)
setupBatchesForOrg(data, 'RW3')
addRandomUsers(data, 'RW3', 2)
addRandomVaccinations(data, 'RW3', 2)
res.redirect('/home')
res.redirect(getDefaultLandingPath(data, data.currentOrganisationId))
})

// ----------------------------------------------------------------
Expand All @@ -491,10 +517,11 @@ module.exports = (router) => {
const data = req.session.data
data.currentUserId = '46436346'
data.currentOrganisationId = 'FA424'
setAppointmentsInterfaceForUserOrganisations(data, data.currentUserId, false)
setupBatchesForOrg(data, 'FA424')
addRandomUsers(data, 'FA424', 10)
addRandomVaccinations(data, 'FA424', 30)
res.redirect('/home')
res.redirect(getDefaultLandingPath(data, data.currentOrganisationId))
})

// ----------------------------------------------------------------
Expand All @@ -506,8 +533,9 @@ module.exports = (router) => {
const data = req.session.data
data.currentUserId = '9847489647892'
data.currentOrganisationId = 'P0191N'
setAppointmentsInterfaceForUserOrganisations(data, data.currentUserId, false)
setupBatchesForOrg(data, 'P0191N')
res.redirect('/home')
res.redirect(getDefaultLandingPath(data, data.currentOrganisationId))
})

// ----------------------------------------------------------------
Expand All @@ -519,6 +547,7 @@ module.exports = (router) => {
const data = req.session.data
data.currentUserId = '3283602393037'
data.email = 'graham.wallace@nhs.net'
setAppointmentsInterfaceForUserOrganisations(data, data.currentUserId, false)
setupBatchesForOrg(data, 'RWP')
addRandomVaccinations(data, 'RWP', 20)
res.redirect('/auth/select-organisation')
Expand All @@ -533,7 +562,8 @@ module.exports = (router) => {
const data = req.session.data
data.currentUserId = '16346346361'
data.currentOrganisationId = 'RV3'
res.redirect('/home')
setAppointmentsInterfaceForUserOrganisations(data, data.currentUserId, false)
res.redirect(getDefaultLandingPath(data, data.currentOrganisationId))
})

// ----------------------------------------------------------------
Expand All @@ -545,6 +575,7 @@ module.exports = (router) => {
const data = req.session.data
data.currentUserId = '2058253531'
data.email = 'phoebe.black@nhs.net'
setAppointmentsInterfaceForUserOrganisations(data, data.currentUserId, false)
setupBatchesForOrg(data, 'RWP')
addRandomUsers(data, 'RWP', 10)
addRandomVaccinations(data, 'RWP', 20)
Expand All @@ -560,8 +591,9 @@ module.exports = (router) => {
const data = req.session.data
data.currentUserId = '6424325235325'
data.currentOrganisationId = 'P15951'
setAppointmentsInterfaceForUserOrganisations(data, data.currentUserId, false)
setupBatchesForOrg(data, 'P15951')
res.redirect('/home')
res.redirect(getDefaultLandingPath(data, data.currentOrganisationId))
})

// ----------------------------------------------------------------
Expand All @@ -573,9 +605,10 @@ module.exports = (router) => {
const data = req.session.data
data.currentUserId = '6424325235325'
data.currentOrganisationId = 'P15951'
setAppointmentsInterfaceForUserOrganisations(data, data.currentUserId, false)
// 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')
res.redirect(getDefaultLandingPath(data, data.currentOrganisationId))
})

// ----------------------------------------------------------------
Expand All @@ -587,7 +620,8 @@ module.exports = (router) => {
const data = req.session.data
data.currentUserId = '1394978032564'
data.currentOrganisationId = 'FS2847'
res.redirect('/home')
setAppointmentsInterfaceForUserOrganisations(data, data.currentUserId, false)
res.redirect(getDefaultLandingPath(data, data.currentOrganisationId))
})

// ----------------------------------------------------------------
Expand All @@ -599,10 +633,11 @@ module.exports = (router) => {
const data = req.session.data
data.currentUserId = '5960938237423'
data.currentOrganisationId = 'RFF'
setAppointmentsInterfaceForUserOrganisations(data, data.currentUserId, false)
setupBatchesForOrg(data, 'RFF')
addRandomUsers(data, 'RFF', 10)
addRandomVaccinations(data, 'RFF', 30)
res.redirect('/home')
res.redirect(getDefaultLandingPath(data, data.currentOrganisationId))
})

// ----------------------------------------------------------------
Expand Down Expand Up @@ -638,33 +673,30 @@ module.exports = (router) => {
const data = req.session.data
data.currentUserId = '633464144'
data.currentOrganisationId = 'FT81513'
setAppointmentsInterfaceForUserOrganisations(data, data.currentUserId, false)
setupBatchesForOrgVaccines(data, 'FT81513', ['MMR', 'flu (London service)'])
addRandomVaccinations(data, 'FT81513', 10)
res.redirect('/home')
res.redirect(getDefaultLandingPath(data, data.currentOrganisationId))
})

// ----------------------------------------------------------------
// Preset: Recorder at pharmacy with no appointments interface
// Preset: Recorder at pharmacy with appointments interface enabled
// ----------------------------------------------------------------

router.get('/prototype-setup/preset/recorder-pharmacy-no-appointments', (req, res) => {
router.get('/prototype-setup/preset/recorder-pharmacy-with-appointments', (req, res) => {
resetSession(req)
const data = req.session.data

const scenarioUser = SIGN_IN_USERS.find(user => user.id === '5500000001')
const scenarioUser = SIGN_IN_USERS.find(user => user.id === '1394978032564')
ensureUserExistsForScenario(data, scenarioUser)

data.currentUserId = '5500000001'
data.currentUserId = '1394978032564'
data.currentOrganisationId = 'FR4V56'

const org = data.organisations.find(organisation => organisation.id === 'FR4V56')
if (org) {
org.appointmentsInterfaceEnabled = false
}
setAppointmentsInterfaceForUserOrganisations(data, data.currentUserId, true)

setupBatchesForOrg(data, 'FR4V56')
addRandomVaccinations(data, 'FR4V56', 10)
res.redirect('/home')
res.redirect(getDefaultLandingPath(data, data.currentOrganisationId))
})

// ----------------------------------------------------------------
Expand Down Expand Up @@ -1087,7 +1119,7 @@ module.exports = (router) => {
}

delete data.customConfig
res.redirect('/home')
res.redirect(getDefaultLandingPath(data, data.currentOrganisationId))
})

}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
27 changes: 8 additions & 19 deletions app/views/home/index.html → app/views/dashboard/index.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{% extends 'layout.html' %}

{% if currentOrganisation %}
{% set pageName = currentOrganisation.name + " - Home" %}
{% set pageName = currentOrganisation.name + " - Dashboard" %}
{% else %}
{% set pageName = "Home" %}
{% set pageName = "Dashboard" %}
{% endif %}
{% set currentSection = "home" %}

Expand All @@ -17,20 +17,9 @@ <h1 class="nhsuk-heading-l nhsuk-u-margin-bottom-6">{% if currentOrganisation %}


{% if currentOrganisation and totalVaccinationsRecorded == 0 %}
{% include "home/_no-vaccinations-recorded.html" %}
{% include "dashboard/_no-vaccinations-recorded.html" %}
{% endif %}

{% from 'inset-text/macro.njk' import insetText %}

{% set insetTextHtml %}
<p>Find out about the latest updates to the service:
<br><a href="https://guide.ravs.england.nhs.uk/whats-new/" title="External website">What's new (opens in new tab)</a></p>
{% endset %}

{{ insetText({
html: insetTextHtml
}) }}

<h2 class="nhsuk-heading-m nhsuk-u-margin-bottom-1">All vaccinations</h2>
<p class="nhsuk-caption-m nhsuk-u-margin-top-0">Last updated: {{ dashboardLastUpdated }}</p>
{% if not currentOrganisation %}
Expand All @@ -41,24 +30,24 @@ <h2 class="nhsuk-heading-m nhsuk-u-margin-bottom-1">All vaccinations</h2>
</div>
</div>

{% include "home/_vaccination-totals.html" %}
{% include "dashboard/_vaccination-totals.html" %}

{% if totalVaccinationsRecorded > 0 %}

{% set byDayHtml %}
{% include "home/_by-day.html" %}
{% include "dashboard/_by-day.html" %}
{% endset %}

{% set byVaccinationHtml %}
{% include "home/_by-vaccine.html" %}
{% include "dashboard/_by-vaccine.html" %}
{% endset %}

{% set bySiteHtml %}
{% include "home/_by-site.html" %}
{% include "dashboard/_by-site.html" %}
{% endset %}

{% set byPharmacyHtml %}
{% include "home/_by-pharmacy.html" %}
{% include "dashboard/_by-pharmacy.html" %}
{% endset %}


Expand Down
Loading