diff --git a/app/assets/sass/_overrides.scss b/app/assets/sass/_overrides.scss index cf51f41f..546b6b08 100644 --- a/app/assets/sass/_overrides.scss +++ b/app/assets/sass/_overrides.scss @@ -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; diff --git a/app/routes/appointments.js b/app/routes/appointments.js index 6ac25b97..22f2c1cf 100644 --- a/app/routes/appointments.js +++ b/app/routes/appointments.js @@ -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 diff --git a/app/routes/auth.js b/app/routes/auth.js index 0ebf2be1..cb3fb725 100644 --- a/app/routes/auth.js +++ b/app/routes/auth.js @@ -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 @@ -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) { @@ -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') diff --git a/app/routes/home.js b/app/routes/home.js index 7bee500f..a70f4c6d4 100644 --- a/app/routes/home.js +++ b/app/routes/home.js @@ -217,7 +217,7 @@ module.exports = router => { } } - res.render('home/index', { + res.render('dashboard/index', { sites, pharmacies, totalVaccinationsRecorded, diff --git a/app/routes/prototype-admin.js b/app/routes/prototype-admin.js index 2bd6777f..7dcfc20f 100644 --- a/app/routes/prototype-admin.js +++ b/app/routes/prototype-admin.js @@ -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 } ] @@ -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 // ---------------------------------------------------------------- @@ -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)) }) // ---------------------------------------------------------------- @@ -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)) }) // ---------------------------------------------------------------- @@ -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)) }) // ---------------------------------------------------------------- @@ -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') @@ -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)) }) // ---------------------------------------------------------------- @@ -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) @@ -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)) }) // ---------------------------------------------------------------- @@ -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)) }) // ---------------------------------------------------------------- @@ -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)) }) // ---------------------------------------------------------------- @@ -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)) }) // ---------------------------------------------------------------- @@ -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)) }) // ---------------------------------------------------------------- @@ -1087,7 +1119,7 @@ module.exports = (router) => { } delete data.customConfig - res.redirect('/home') + res.redirect(getDefaultLandingPath(data, data.currentOrganisationId)) }) } diff --git a/app/views/home/_by-day.html b/app/views/dashboard/_by-day.html similarity index 100% rename from app/views/home/_by-day.html rename to app/views/dashboard/_by-day.html diff --git a/app/views/home/_by-pharmacy.html b/app/views/dashboard/_by-pharmacy.html similarity index 100% rename from app/views/home/_by-pharmacy.html rename to app/views/dashboard/_by-pharmacy.html diff --git a/app/views/home/_by-site.html b/app/views/dashboard/_by-site.html similarity index 100% rename from app/views/home/_by-site.html rename to app/views/dashboard/_by-site.html diff --git a/app/views/home/_by-vaccine.html b/app/views/dashboard/_by-vaccine.html similarity index 100% rename from app/views/home/_by-vaccine.html rename to app/views/dashboard/_by-vaccine.html diff --git a/app/views/home/_no-vaccinations-recorded.html b/app/views/dashboard/_no-vaccinations-recorded.html similarity index 100% rename from app/views/home/_no-vaccinations-recorded.html rename to app/views/dashboard/_no-vaccinations-recorded.html diff --git a/app/views/home/_vaccination-totals.html b/app/views/dashboard/_vaccination-totals.html similarity index 100% rename from app/views/home/_vaccination-totals.html rename to app/views/dashboard/_vaccination-totals.html diff --git a/app/views/home/index.html b/app/views/dashboard/index.html similarity index 73% rename from app/views/home/index.html rename to app/views/dashboard/index.html index e79c5f45..5d90a5e1 100644 --- a/app/views/home/index.html +++ b/app/views/dashboard/index.html @@ -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" %} @@ -17,20 +17,9 @@
Find out about the latest updates to the service:
-
What's new (opens in new tab)
Last updated: {{ dashboardLastUpdated }}
{% if not currentOrganisation %} @@ -41,24 +30,24 @@Quick access links below apply the Pharmacy lead admin preset first, so you can open these pages without manually signing in.