diff --git a/app/routes.js b/app/routes.js index 6e79bbf..814225d 100644 --- a/app/routes.js +++ b/app/routes.js @@ -3,7 +3,7 @@ const express = require('express') const router = express.Router() -const isWholeNumber = str => /^\d+$/.test(str) +//======= September test specific for now router.get('/september-iteration-2/clickthru/04a-example-search-result', function (req, res) { const query = (req.query['search-params'] || '').trim() @@ -33,7 +33,35 @@ router.get('/september-iteration-2/clickthru/04a-example-search-result', functio }) }) -router.post('/sessions/02-organise-slots', function (req, res) { +router.get('/action/stage/:participantId', function (req, res) { + const participants = (req.session.data.participants && req.session.data.participants.default) || [] + const participantIndex = participants.findIndex((participant) => participant.participantId === req.params.participantId) + + if (participantIndex !== -1) { + participants[participantIndex].status = 'staged' + req.session.data.stagedCount++ + } + + res.redirect(req.get('referer') || '/september-iteration-2/clickthru/04-choose-participants') +}); + +router.get('/action/unstage/:participantId', function (req, res) { + const participants = (req.session.data.participants && req.session.data.participants.default) || [] + const participantIndex = participants.findIndex((participant) => participant.participantId === req.params.participantId) + + if (participantIndex !== -1) { + participants[participantIndex].status = 'unstaged' + req.session.data.stagedCount-- + } + + res.redirect(req.get('referer') || '/september-iteration-2/clickthru/04-choose-participants') +}); + +// ====== session setup handlers + +const isWholeNumber = str => /^\d+$/.test(str) + +router.post('/sessions/01-set-timings', function (req, res) { const session = (req.body && req.body.newSession) || {} const startTime = session.startTime || {} const endTime = session.endTime || {} @@ -91,28 +119,12 @@ router.post('/sessions/02-organise-slots', function (req, res) { res.redirect('/sessions/02-organise-slots') }) -router.get('/action/stage/:participantId', function (req, res) { - const participants = (req.session.data.participants && req.session.data.participants.default) || [] - const participantIndex = participants.findIndex((participant) => participant.participantId === req.params.participantId) - - if (participantIndex !== -1) { - participants[participantIndex].status = 'staged' - req.session.data.stagedCount++ - } - - res.redirect(req.get('referer') || '/september-iteration-2/clickthru/04-choose-participants') -}); - -router.get('/action/unstage/:participantId', function (req, res) { - const participants = (req.session.data.participants && req.session.data.participants.default) || [] - const participantIndex = participants.findIndex((participant) => participant.participantId === req.params.participantId) - - if (participantIndex !== -1) { - participants[participantIndex].status = 'unstaged' - req.session.data.stagedCount-- +router.post('/sessions/02-organise-slots', function (req, res) { + if (req.session.data.sessionCreationType === 'new session template') { + res.redirect('/sessions/templating-03-name-and-description') + } else { + res.redirect('/sessions/03-prototype-end') } - - res.redirect(req.get('referer') || '/september-iteration-2/clickthru/04-choose-participants') -}); +}) module.exports = router diff --git a/app/views/_includes/clinics/clinic-listing-table.html b/app/views/_includes/clinics/clinic-listing-table.html index 74fb7a2..d2346b7 100644 --- a/app/views/_includes/clinics/clinic-listing-table.html +++ b/app/views/_includes/clinics/clinic-listing-table.html @@ -11,10 +11,7 @@ text: 'Unit' }, { - text: 'Timeframe' - }, - { - text: 'Capacity' + text: 'Current capacity' } ], rows: [ @@ -28,9 +25,6 @@ { html: 'Alpha van
HWO-mobile-1 ' }, - { - html: '1 May 2026 to 31 May 2026
21 days' - }, { html: '
10 slots available of 1360' } @@ -45,9 +39,6 @@ { html: 'Home base
HWO-static-1 ' }, - { - html: '7, 21 May 2026
2 days' - }, { html: '
40 slots available of 100' } diff --git a/app/views/clinics/index.html b/app/views/clinics/index.html index d82e1dc..a670700 100644 --- a/app/views/clinics/index.html +++ b/app/views/clinics/index.html @@ -7,44 +7,46 @@ {{ primaryNavigation("Clinics", serviceName) }} {% endblock %} -{% block beforeContent %} - -{{ breadcrumb({ - items: [ - { - href: "#", - text: "Home" - } - ] -}) }} - -{% endblock %} +{% block beforeContent %}{% endblock %} {% block content %} -
-

Clinics

- - {{ button({ - text: "Create a new clinic", - href: "00-create-day-clinic", - classes: "nhsuk-button--secondary" - }) }} -
+ + {% set secondaryNavItems = [] %} + + {% for item in [ + { href: '/clinics/', label: 'Active clinics', selected: 'true' }, + { href: '#', label: 'Archived clinics' }, + { href: '/sessions/templating-01-listing', label: 'Session templates' } + ] %} + {% set secondaryNavItems = secondaryNavItems | push({ + text: item.label | safe, + href: item.href | trim, + current: true if item.selected == 'true' + }) %} + {% endfor %} + + {{ appSecondaryNavigation({ + visuallyHiddenTitle: "Secondary menu", + items: secondaryNavItems + }) }}
- - {% include "_includes/clinics/clinic-listing-table.html"%} - +
+

Active clinics

+ {{ button({ + text: "Create a new clinic", + href: "00-create-day-clinic", + classes: "nhsuk-button--secondary" + }) }} +
-

Completed batches

-

- View completed clinics -

+ {% include "_includes/clinics/clinic-listing-table.html"%}
+ {% endblock %} diff --git a/app/views/index.html b/app/views/index.html index 77ea7fb..7a93f1e 100755 --- a/app/views/index.html +++ b/app/views/index.html @@ -37,7 +37,11 @@

{{ serviceName }}

-
+ {{ button({ + text: "Reset all session data", + classes: "nhsuk-button--secondary", + href: "/prototype-admin/reset?returnPage=" + (currentPage | urlencode) + }) }}

July 2026

Sessions: first run

@@ -46,6 +50,12 @@

July 2026

Set up session +

Session templates: iteration 1

+
    +
  1. + Template listing +
  2. +

May–June 2026

Clinics: first run

diff --git a/app/views/sessions/01-set-timings.html b/app/views/sessions/01-set-timings.html index 04324e9..a4bcebc 100644 --- a/app/views/sessions/01-set-timings.html +++ b/app/views/sessions/01-set-timings.html @@ -1,5 +1,6 @@ {% extends 'layout.html' %} +{% set workflow = "template" if data.sessionCreationType === "new session template" else "standard" %} {% set errorState = "true" if errors else "false" %} {% set pageName = "Create session: set timings" %} @@ -23,13 +24,19 @@
+ +
@@ -76,7 +116,7 @@

Set timings

-
+
diff --git a/app/views/sessions/02-organise-slots.html b/app/views/sessions/02-organise-slots.html index a783505..b90868a 100644 --- a/app/views/sessions/02-organise-slots.html +++ b/app/views/sessions/02-organise-slots.html @@ -1,5 +1,7 @@ {% extends 'layout.html' %} +{% set workflow = "template" if data.sessionCreationType === "new session template" else "standard" %} + {% set pageName = "Create session: organise slots" %} {% from "_includes/primary-navigation.html" import primaryNavigation %} @@ -79,8 +81,42 @@

Workflow steps - Create session + {% if workflow === "template" %} + New session template + {% else %} + Create session + {% endif %}

+ {% if workflow === "template" %} +
    +
  1. + + {{ tickSvg | safe }} + Set timings + +
  2. +
  3. + + 2 + Organise slots + +
  4. +
  5. + + 3 + Name and description + +
  6. +
  7. + + 4 + + Save session template + + +
  8. +
+ {% else %}
  1. @@ -97,10 +133,13 @@

  2. 3 - Publish + + Publish +
+ {% endif %}
@@ -115,7 +154,7 @@

- + diff --git a/app/views/sessions/templating-01-listing.html b/app/views/sessions/templating-01-listing.html new file mode 100644 index 0000000..f9d6ae8 --- /dev/null +++ b/app/views/sessions/templating-01-listing.html @@ -0,0 +1,122 @@ +{% extends 'layout.html' %} + +{% set pageName = "Session templates" %} + +{% from "_includes/primary-navigation.html" import primaryNavigation %} +{% block header %} + {{ primaryNavigation("Clinics", serviceName) }} +{% endblock %} + +{% block beforeContent %}{% endblock %} + +{% block content %} + +{% set secondaryNavItems = [] %} + +{% for item in [ + { href: '/clinics/', label: 'Active clinics' }, + { href: '#', label: 'Archived clinics' }, + { href: '/sessions/templating-01-listing', label: 'Session templates', selected: 'true' } +] %} + {% set secondaryNavItems = secondaryNavItems | push({ + text: item.label | safe, + href: item.href | trim, + current: true if item.selected == 'true' + }) %} +{% endfor %} + +{{ appSecondaryNavigation({ + visuallyHiddenTitle: "Secondary menu", + items: secondaryNavItems +}) }} + + +

Session templates

+ + + {{ button({ + text: "Create a new session template", + classes: "nhsuk-button--secondary" + }) }} + + +
+
+ + {{ table({ + firstCellIsHeader: false, + head: [ + { + text: 'Template' + }, + { + text: 'Start time' + }, + { + text: 'End time' + }, + { + text: 'Slot length' + }, + { + text: 'Capacity' + } + ], + rows: [ + [ + { + html: ' + Standard day session for static site
+ Standard day template for our static site at Worthing Hospital. 2 double-slot special appointments at the beginning of the day, and 4 held slots at the end. 1 hour break from 12:00 to 13:00. + ' + }, + { + text: '10:00' + }, + { + text: '16:00' + }, + { + text: '10 minutes' + }, + { + text: '30 slots' + } + ], + [ + { + html: ' + Special appointments day session for static site
+ Whole day of double-slot special appointments with a 1 hour break from 12:00 to 13:00. + ' + }, + { + text: '10:00' + }, + { + text: '17:00' + }, + { + text: '20 minutes' + }, + { + text: '30 slots' + } + ] + ] + }) }} + +
+
+ +
+
+

Archived session templates

+

+ View archived templates +

+
+
+{% endblock %} + +{% block pageScripts %}{% endblock %} \ No newline at end of file diff --git a/app/views/sessions/templating-03-name-and-description.html b/app/views/sessions/templating-03-name-and-description.html new file mode 100644 index 0000000..0eba11b --- /dev/null +++ b/app/views/sessions/templating-03-name-and-description.html @@ -0,0 +1,104 @@ +{% extends 'layout.html' %} + +{% set pageName = "Session templates" %} + +{% from "_includes/primary-navigation.html" import primaryNavigation %} +{% block header %} + {{ primaryNavigation("Clinics", serviceName) }} +{% endblock %} + +{% block beforeContent %}{% endblock %} + +{% block content %} + +{% set tickSvg %} + +{% endset %} + +
+
+ +
+ +
+ +
+
+
+ +

Template name and description

+ +
+ +
+ +
+ A memorable name for this template. This is the name you’ll see everywhere for it, as titles and links. +
+ {% if errorState === "true" %} + + Error: Template must be given a name + + {% endif %} + +
+ +
+ +
+ Put in a description so you can remember stuff +
+ +
+ + + +
+ +
+
+
+{% endblock %} + +{% block pageScripts %}{% endblock %} \ No newline at end of file diff --git a/app/views/sessions/templating-04-check-answers.html b/app/views/sessions/templating-04-check-answers.html new file mode 100644 index 0000000..ae91bca --- /dev/null +++ b/app/views/sessions/templating-04-check-answers.html @@ -0,0 +1,128 @@ +{% extends 'layout.html' %} + +{% set pageName = "Publish clinic" %} + +{% from "_includes/primary-navigation.html" import primaryNavigation %} +{% block header %} + {{ primaryNavigation("Clinics", serviceName) }} +{% endblock %} + +{% block beforeContent %}{% endblock %} + +{% block content %} + +{% set tickSvg %} + +{% endset %} + +
+
+ +
+ +
+ +
+
+
+ +

Save session template

+ + + +
+
+
+ Template name +
+
+ {{ data.sessionTemplateName }} +
+
+ Change template name +
+
+
+
+ Description +
+
+ {{ data.sessionTemplateDescription }} +
+
+ Change description +
+
+
+
+ Session timings +
+
+ {{ data.newSession.startTime.hour }}:{{ data.newSession.startTime.minute }} to {{ data.newSession.endTime.hour }}:{{ data.newSession.endTime.minute }}
+ {{ data.newSession.duration }} minute slots +
+
+ Change timings +
+
+
+
+ Slot organisation +
+
+ {{ data.slotsAvailableCount }} total session capacity (all slot count that's not cancelled or breaks?)
+ {{ data.slotsSpecialAvailableCount }} special apppointment{% if (data.slotsSpecialAvailableCount == 0) or (data.slotsSpecialAvailableCount > 1) %}s{% endif %}
+ {{ data.slotsHeldCount }} held (this could break into multiple "helds" for reasons we're getting in UR) +
+
+ Change slot organisation +
+
+
+ +

+ Save template +

+ +
+
+
+ +{% endblock %} \ No newline at end of file