Skip to content
Merged
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
60 changes: 36 additions & 24 deletions app/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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 || {}
Expand Down Expand Up @@ -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
11 changes: 1 addition & 10 deletions app/views/_includes/clinics/clinic-listing-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
text: 'Unit'
},
{
text: 'Timeframe'
},
{
text: 'Capacity'
text: 'Current capacity'
}
],
rows: [
Expand All @@ -28,9 +25,6 @@
{
html: 'Alpha van<br><span class="nhsuk-u-font-size-16 nhsuk-u-secondary-text-colour">HWO-mobile-1</span> '
},
{
html: '1 May 2026 to 31 May 2026<br><span class="nhsuk-u-font-size-16 nhsuk-u-secondary-text-colour">21 days</span>'
},
{
html: '<div class="app-simple-progress-bar --generic --thin nhsuk-u-padding-1 nhsuk-u-margin-bottom-1" style="--percentage: 99%;"></div><span class="nhsuk-u-font-size-16 nhsuk-u-secondary-text-colour">10 slots available of 1360</div>'
}
Expand All @@ -45,9 +39,6 @@
{
html: 'Home base<br><span class="nhsuk-u-font-size-16 nhsuk-u-secondary-text-colour">HWO-static-1</span> '
},
{
html: '7, 21 May 2026<br><span class="nhsuk-u-font-size-16 nhsuk-u-secondary-text-colour">2 days</span>'
},
{
html: '<div class="app-simple-progress-bar --generic --thin nhsuk-u-padding-1 nhsuk-u-margin-bottom-1" style="--percentage: 60%;"></div><span class="nhsuk-u-font-size-16 nhsuk-u-secondary-text-colour">40 slots available of 100</div>'
}
Expand Down
58 changes: 30 additions & 28 deletions app/views/clinics/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,46 @@
{{ primaryNavigation("Clinics", serviceName) }}
{% endblock %}

{% block beforeContent %}

{{ breadcrumb({
items: [
{
href: "#",
text: "Home"
}
]
}) }}

{% endblock %}
{% block beforeContent %}{% endblock %}

{% block content %}
<div class="app-card-editable">
<h1 class="nhsuk-heading-l">Clinics</h1>

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

{% 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
}) }}

<div class="nhsuk-grid-row">
<div class="nhsuk-grid-column-full">

{% include "_includes/clinics/clinic-listing-table.html"%}

<div class="app-card-editable">
<h1 class="nhsuk-heading-l">Active clinics</h1>
{{ button({
text: "Create a new clinic",
href: "00-create-day-clinic",
classes: "nhsuk-button--secondary"
}) }}
</div>
</div>
</div>

<div class="nhsuk-grid-row">
<div class="nhsuk-grid-column-full">
<h2 class="nhsuk-u-visually-hidden">Completed batches</h2>
<p>
<a href="#">View completed clinics</a>
</p>
{% include "_includes/clinics/clinic-listing-table.html"%}
</div>
</div>

{% endblock %}
12 changes: 11 additions & 1 deletion app/views/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ <h1 class="nhsuk-heading-xl">
{{ serviceName }}
</h1>

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

<h2 class="nhsuk-heading-m">July 2026</h2>
<p>Sessions: first run</p>
Expand All @@ -46,6 +50,12 @@ <h2 class="nhsuk-heading-m">July 2026</h2>
<a href="/sessions/01-set-timings">Set up session</a>
</li>
</ol>
<p>Session templates: iteration 1</p>
<ol>
<li>
<a href="sessions/templating-01-listing">Template listing</a>
</li>
</ol>

<h2 class="nhsuk-heading-m">May–June 2026</h2>
<p>Clinics: first run</p>
Expand Down
46 changes: 43 additions & 3 deletions app/views/sessions/01-set-timings.html
Original file line number Diff line number Diff line change
@@ -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" %}
Expand All @@ -23,13 +24,19 @@
<div class="nhsuk-grid-column-one-quarter">

<div class="app-workflow-side-nav-wrapper">

<nav class="app-workflow-side-nav">
<h2 class="nhsuk-heading-m app-workflow-side-nav__heading">
<span class="nhsuk-caption-m">
Workflow steps
</span>
Create session
{% if workflow === "template" %}
New session template
{% else %}
Create session
{% endif %}
</h2>
{% if workflow === "template" %}
<ol class="app-workflow-side-nav__list">
<li class="app-workflow-side-nav__item app-workflow-side-nav__item--current">
<span class="app-workflow-side-nav__link" aria-current="page">
Expand All @@ -46,11 +53,44 @@ <h2 class="nhsuk-heading-m app-workflow-side-nav__heading">
<li class="app-workflow-side-nav__item app-workflow-side-nav__item--disabled">
<span class="app-workflow-side-nav__link app-workflow-side-nav__link--disabled">
<span class="app-workflow-side-nav__number">3</span>
<span class="app-workflow-side-nav__label">Publish</span>
<span class="app-workflow-side-nav__label">Name and description</span>
</span>
</li>
<li class="app-workflow-side-nav__item app-workflow-side-nav__item--disabled">
<span class="app-workflow-side-nav__link app-workflow-side-nav__link--disabled">
<span class="app-workflow-side-nav__number">4</span>
<span class="app-workflow-side-nav__label">
Save session template
</span>
</span>
</li>
</ol>
{% else %}
<ol class="app-workflow-side-nav__list">
<li class="app-workflow-side-nav__item app-workflow-side-nav__item--current">
<span class="app-workflow-side-nav__link" aria-current="page">
<span class="app-workflow-side-nav__number">1</span>
<span class="app-workflow-side-nav__label">Set timings</span>
</span>
</li>
<li class="app-workflow-side-nav__item app-workflow-side-nav__item--disabled">
<span class="app-workflow-side-nav__link app-workflow-side-nav__link--disabled">
<span class="app-workflow-side-nav__number">2</span>
<span class="app-workflow-side-nav__label">Organise slots</span>
</span>
</li>
<li class="app-workflow-side-nav__item app-workflow-side-nav__item--disabled">
<span class="app-workflow-side-nav__link app-workflow-side-nav__link--disabled">
<span class="app-workflow-side-nav__number">3</span>
<span class="app-workflow-side-nav__label">
Publish
</span>
</span>
</li>
</ol>
{% endif %}
</nav>

</div>

</div>
Expand All @@ -76,7 +116,7 @@ <h2 class="nhsuk-heading-m app-workflow-side-nav__heading">

<h1 class="nhsuk-heading-l">Set timings</h1>

<form action="02-organise-slots" method="post">
<form method="post">

<div class="nhsuk-form-group {% if errors and errors.startTime %}nhsuk-form-group--error{% endif %}">
<fieldset class="nhsuk-fieldset" role="group" aria-describedby="start-time-hint">
Expand Down
45 changes: 42 additions & 3 deletions app/views/sessions/02-organise-slots.html
Original file line number Diff line number Diff line change
@@ -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 %}
Expand Down Expand Up @@ -79,8 +81,42 @@ <h2 class="nhsuk-heading-m app-workflow-side-nav__heading">
<span class="nhsuk-caption-m">
Workflow steps
</span>
Create session
{% if workflow === "template" %}
New session template
{% else %}
Create session
{% endif %}
</h2>
{% if workflow === "template" %}
<ol class="app-workflow-side-nav__list">
<li class="app-workflow-side-nav__item app-workflow-side-nav__item--completed">
<a class="app-workflow-side-nav__link app-workflow-side-nav__link--clickable" href="01-set-timings">
<span class="app-workflow-side-nav__number">{{ tickSvg | safe }}</span>
<span class="app-workflow-side-nav__label">Set timings</span>
</a>
</li>
<li class="app-workflow-side-nav__item app-workflow-side-nav__item--current">
<span class="app-workflow-side-nav__link" aria-current="page">
<span class="app-workflow-side-nav__number">2</span>
<span class="app-workflow-side-nav__label">Organise slots</span>
</span>
</li>
<li class="app-workflow-side-nav__item app-workflow-side-nav__item--disabled">
<span class="app-workflow-side-nav__link app-workflow-side-nav__link--disabled">
<span class="app-workflow-side-nav__number">3</span>
<span class="app-workflow-side-nav__label">Name and description</span>
</span>
</li>
<li class="app-workflow-side-nav__item app-workflow-side-nav__item--disabled">
<span class="app-workflow-side-nav__link app-workflow-side-nav__link--disabled">
<span class="app-workflow-side-nav__number">4</span>
<span class="app-workflow-side-nav__label">
Save session template
</span>
</span>
</li>
</ol>
{% else %}
<ol class="app-workflow-side-nav__list">
<li class="app-workflow-side-nav__item app-workflow-side-nav__item--completed">
<a class="app-workflow-side-nav__link app-workflow-side-nav__link--clickable" href="01-set-timings">
Expand All @@ -97,10 +133,13 @@ <h2 class="nhsuk-heading-m app-workflow-side-nav__heading">
<li class="app-workflow-side-nav__item app-workflow-side-nav__item--disabled">
<span class="app-workflow-side-nav__link app-workflow-side-nav__link--disabled">
<span class="app-workflow-side-nav__number">3</span>
<span class="app-workflow-side-nav__label">Publish</span>
<span class="app-workflow-side-nav__label">
Publish
</span>
</span>
</li>
</ol>
{% endif %}
</nav>
</div>

Expand All @@ -115,7 +154,7 @@ <h2 class="nhsuk-heading-m">
</h2>
</div>

<form action="03-prototype-end" method="post">
<form method="post">

<input type="hidden" name="slotsAvailableCount">
<input type="hidden" name="slotsSpecialAvailableCount">
Expand Down
Loading