diff --git a/app/data/session-data-defaults.js b/app/data/session-data-defaults.js index 9e89485..812305b 100644 --- a/app/data/session-data-defaults.js +++ b/app/data/session-data-defaults.js @@ -13,6 +13,6 @@ module.exports = { clinicTimespan: "1 September 2026", clinicLength: "1 day", clinicCapacityPercentBooked: "0", - clinicCapacityAvailable: "48", - clinicCapacityTotal: "48" + clinicCapacityAvailable: "10", + clinicCapacityTotal: "10" } \ No newline at end of file diff --git a/app/routes.js b/app/routes.js index c580e8d..378f7c5 100644 --- a/app/routes.js +++ b/app/routes.js @@ -332,58 +332,6 @@ router.get('/clinics-schedules/06-apply-session', function (req, res) { res.render('clinics-schedules/06-apply-session') }) -router.get('/september-iteration-2/clickthru/04a-example-search-result', function (req, res) { - const query = (req.query['search-params'] || '').trim() - const allParticipants = (req.session.data.participants && req.session.data.participants.default) || [] - const normalizedQuery = query.toLowerCase().replace(/\s+/g, ' ') - const nhsQuery = normalizedQuery.replace(/\s+/g, '') - - const searchResults = (normalizedQuery ? allParticipants.map((participant, index) => { - const nhs = participant.nhs_number.toLowerCase().replace(/\s+/g, '') - const name = participant.full_name.toLowerCase() - const dob = participant.date_of_birth.toLowerCase() - - if ( - nhs.includes(nhsQuery) || - name.includes(normalizedQuery) || - dob.includes(normalizedQuery) - ) { - return Object.assign({}, participant, { participantIndex: index }) - } - - return null - }).filter(Boolean) : allParticipants.map((participant, index) => Object.assign({}, participant, { participantIndex: index }))) - - res.render('september-iteration-2/clickthru/04a-example-search-result', { - participants: searchResults, - searchQuery: query - }) -}) - -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) @@ -752,28 +700,6 @@ router.get('/clinics-schedules/09-prototype-end', function (req, res) { res.render('clinics-schedules/09-prototype-end') }) -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') @@ -782,4 +708,8 @@ router.post('/sessions/02-organise-slots', function (req, res) { } }) + +// Isolated September Test (Mission 1) routes +router.use(require('./routes/mission-1')); + module.exports = router diff --git a/app/routes/mission-1.js b/app/routes/mission-1.js new file mode 100644 index 0000000..c0ea97c --- /dev/null +++ b/app/routes/mission-1.js @@ -0,0 +1,79 @@ +const express = require('express') +const router = express.Router() + +// Routes and functions specific to Mission 1 prototypes +/* + +/appviews/september-iteration-2/ + +*/ + +// simple search +router.get('/september-iteration-2/clickthru/04a-example-search-result', function (req, res) { + const query = (req.query['search-params'] || '').trim() + const allParticipants = (req.session.data.participants && req.session.data.participants.default) || [] + const normalizedQuery = query.toLowerCase().replace(/\s+/g, ' ') + const nhsQuery = normalizedQuery.replace(/\s+/g, '') + + const searchResults = (normalizedQuery ? allParticipants.map((participant, index) => { + const nhs = participant.nhs_number.toLowerCase().replace(/\s+/g, '') + const name = participant.full_name.toLowerCase() + const dob = participant.date_of_birth.toLowerCase() + + if ( + nhs.includes(nhsQuery) || + name.includes(normalizedQuery) || + dob.includes(normalizedQuery) + ) { + return Object.assign({}, participant, { participantIndex: index }) + } + + return null + }).filter(Boolean) : allParticipants.map((participant, index) => Object.assign({}, participant, { participantIndex: index }))) + + res.render('september-iteration-2/clickthru/04a-example-search-result', { + participants: searchResults, + searchQuery: query + }) +}) + +// adding and removing participants from the "group" +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') +}); + +// creating and passing Total Slots through for 1 day clinic creation +router.post('/september-iteration-2/create-clinic-rev-1-publish-check', function (req, res) { + const newSession = req.session.data.newSession || {} + const startTime = newSession.startTime || {} + const endTime = newSession.endTime || {} + + const startMinutes = (parseInt(startTime.hour, 10) || 0) * 60 + (parseInt(startTime.minute, 10) || 0) + const endMinutes = (parseInt(endTime.hour, 10) || 0) * 60 + (parseInt(endTime.minute, 10) || 0) + const duration = parseInt(newSession.duration, 10) || 0 + + newSession.totalSlots = duration > 0 ? Math.floor((endMinutes - startMinutes) / duration) : 0 + + res.render('september-iteration-2/create-clinic-rev-1-publish-check') +}) + +module.exports = router \ No newline at end of file diff --git a/app/views/index.html b/app/views/index.html index c03bb3c..e9f6254 100755 --- a/app/views/index.html +++ b/app/views/index.html @@ -138,6 +138,11 @@
+ Mural: 0000-01 C2C September Test +
+Enable test BSO to creat a clinic lasting one day
Users upload a csv containing the participants they wish to book into a prearranged single day clinic.
- Click-thru journey (all hard coded as an example) + Click-thru journey
-Users upload a csv containing the participants they wish to book into a prearranged single day clinic.
- -Defunct work on finding and grouping participants. Components to be reused elsewhere.
-Users upload a csv containing the participants they wish to book into a prearranged single day clinic.
+Defunct work on finding and grouping participants. Components to be reused elsewhere.
+| + | NHS Number |
@@ -53,7 +52,7 @@
{% for participant in data.participants.default %}
{% if participant.status === "staged" %}
{{ participant.nhs_number }} |
+ {{ participant.nhs_number }} |
{{ participant.full_name }} |
{{ participant.date_of_birth }} |
+
+
+
+
+
+ + 2 slots remaining ++
+
+ + You are booking 8 participants into Test Clinic which has 10 slots available. + +Do you want to go back and add participants? + +
-
+
+ |
|---|
diff --git a/app/views/september-iteration-2/includes/day-list-hard-coded.html b/app/views/september-iteration-2/includes/day-list-hard-coded.html index c56161c..d83192b 100644 --- a/app/views/september-iteration-2/includes/day-list-hard-coded.html +++ b/app/views/september-iteration-2/includes/day-list-hard-coded.html @@ -1,365 +1,84 @@
| + Time + | ++ NHS Number + | ++ Full name + | ++ Date of birth + | +
|---|---|---|---|
| 09:00 | +999 054 3666 | +Billie Joanne Marquardt | +15 March 1960 | +
| 09:10 | +999 582 7164 | +Alice Marie Gregory | +8 November 1964 | +
| 09:20 | +999 374 0952 | +Daphne Hart | +22 July 1958 | +
| 09:30 | +999 195 4836 | +Marta O'Neill | +3 May 1971 | +
| 09:40 | +999 287 9305 | +Susan Carter | +19 September 1967 | +
| 09:50 | +999 463 1129 | +Olivia Barnes | +12 January 1975 | +
| 10:00 | +999 774 2201 | +Rachel Price | +27 April 1962 | +
| 10:10 | +999 546 8870 | +Hannah Wallace | +6 October 1959 | +
| 10:20 | +999 559 3322 | +Fiona Lambert | +14 December 1973 | +
| 10:30 | +999 804 7753 | +Georgia Mills | +30 June 1968 | +
{{ data.stagedCount }} participant{% if data.stagedCount > 1 %}s{% endif %} ready to book
+ + + + Proceed to book participants + + {% endif %}| + | NHS Number | @@ -30,7 +31,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| {{ participant.nhs_number }} | +{{ participant.nhs_number }} | {{ participant.full_name }} | {{ participant.date_of_birth }} | @@ -40,12 +41,15 @@ Ready to book + {% endif %} |
{% set participantId = participant.participantId or loop.index0 %}
{% if participant.status == "unstaged" %}
- Add
+ Add
{% else %}
Remove
{% endif %}
diff --git a/app/views/september-iteration-2/pre-appoint-confirm.html b/app/views/september-iteration-2/pre-appoint-confirm.html
deleted file mode 100644
index 7cd74ff..0000000
--- a/app/views/september-iteration-2/pre-appoint-confirm.html
+++ /dev/null
@@ -1,269 +0,0 @@
-{% extends 'layout.html' %}
-
-{% set pageName = "Assign slots to participants" %}
-
-{% from "z-september-transactional-journey/_includes/min-primary-navigation.html" import primaryNavigation %}
-{% block header %}
- {{ primaryNavigation() }}
-{% endblock %}
-
-{% block beforeContent %}{% endblock %}
-
-{% block content %}
-
-
-
-
-
-
- - Book participants --
-
-
-
-
-
- You are booking 48 participants- -
-
-
- - - Show chosen participants - --
-
-
into Chichester - standard slots May 2026-
-
-
- - - Show clinic details - --
-
-
-
-
- Participants will be booked in random order. -
-
-
-
-{% endblock %}
-
-{% block footer %}
- {{ footer() }}
-{% endblock %}
diff --git a/app/views/september-iteration-2/search-and-results.html b/app/views/september-iteration-2/search-and-results.html
deleted file mode 100644
index 0bc24af..0000000
--- a/app/views/september-iteration-2/search-and-results.html
+++ /dev/null
@@ -1,305 +0,0 @@
-{% extends 'layout.html' %}
-
-{% set pageName = "" %}
-
-{% from "z-september-transactional-journey/_includes/min-primary-navigation.html" import primaryNavigation %}
-{% block header %}
- {{ primaryNavigation() }}
-{% endblock %}
-
-{% block beforeContent %}{% endblock %}
-
-{% block content %}
-
-
-
-
-- Choose participants to book --
-
-
-
-
-
-
-
-
- Search by NHS number, first name, or last name
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-{% endblock %}
-
-{% block footer %}
- {{ footer() }}
-{% endblock %}
diff --git a/app/views/september-iteration-2/select-clinic.html b/app/views/september-iteration-2/select-clinic.html
deleted file mode 100644
index 53e98c5..0000000
--- a/app/views/september-iteration-2/select-clinic.html
+++ /dev/null
@@ -1,111 +0,0 @@
-{% extends 'layout.html' %}
-
-{% set pageName = "Batch detail" %}
-
-{% from "z-september-transactional-journey/_includes/min-primary-navigation.html" import primaryNavigation %}
-{% block header %}
- {{ primaryNavigation() }}
-{% endblock %}
-
-{% block beforeContent %}{% endblock %}
-
-{% block content %}
-
-
-
-
- Information:
-
-
- 0 participants ready to book -
-
-
-
-
-- Select clinic --
-
-
-{% endblock %}
-
-{% block footer %}
- {{ footer() }}
-{% endblock %}
diff --git a/app/views/september-iteration-2/upload-a-batch.html b/app/views/september-iteration-2/upload-a-batch.html
deleted file mode 100644
index 001e93e..0000000
--- a/app/views/september-iteration-2/upload-a-batch.html
+++ /dev/null
@@ -1,36 +0,0 @@
-{% extends 'layout.html' %}
-
-{% set pageName = "Upload a batch" %}
-
-{% from "z-september-transactional-journey/_includes/min-primary-navigation.html" import primaryNavigation %}
-{% block header %}
- {{ primaryNavigation() }}
-{% endblock %}
-
-{% block content %}
-
-
-
-
-
-
-{% endblock %}
-
-{% block footer %}
- {{ footer() }}
-{% endblock %}
-
-
-
-
- - -- -
-
- Upload file
-
-
-
- |