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
4 changes: 2 additions & 2 deletions app/data/session-data-defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ module.exports = {
clinicTimespan: "1 September 2026",
clinicLength: "1 day",
clinicCapacityPercentBooked: "0",
clinicCapacityAvailable: "48",
clinicCapacityTotal: "48"
clinicCapacityAvailable: "10",
clinicCapacityTotal: "10"
}
78 changes: 4 additions & 74 deletions app/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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')
Expand All @@ -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
79 changes: 79 additions & 0 deletions app/routes/mission-1.js
Original file line number Diff line number Diff line change
@@ -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
81 changes: 37 additions & 44 deletions app/views/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,58 +138,49 @@ <h2 class="nhsuk-heading-m">March 2026</h2>
<hr>

<h3 class="nhsuk-heading-l">Mission 1</h3>
<div class="nhsuk-inset-text">
<p>
<b>Mural:</b> <a href="https://app.mural.co/t/nhsdigital8118/m/nhsdigital8118/1779182652812/0015966bbee6d6a0182a2afb7fc482a45756e20d?wid=0-1787749959118">0000-01 C2C September Test</a>
</p>
</div>
<h4 class="nhsuk-heading-s">Create clinic module: live test #2</h4>
<p>Enable test BSO to creat a clinic lasting one day</p>
<ol>
<li>
<a href="/september-iteration-2/create-clinic">Create a new clinic from listing page</a>
</li>
</ol>
<h4 class="nhsuk-heading-s">Iteration 2</h4>
<h4 class="nhsuk-heading-s">Live test #1</h4>
<p>Users upload a csv containing the participants they wish to book into a prearranged single day clinic.</p>
<p>
<a href="/september-iteration-2/clickthru/01-upload">Click-thru journey (all hard coded as an example)</a>
<a href="/september-iteration-2/clickthru/01-upload">Click-thru journey</a>
</p>
<ol>
<li>
<a href="/september-iteration-2/upload-a-batch">Upload a batch</a>
</li>
<li>
<a href="/september-iteration-2/batch-detail">Batch detail</a>
</li>
<li>
<a href="/september-iteration-2/select-clinic">Selecting the clinic to be used</a>
</li>
<li>
<a href="/september-iteration-2/search-and-results">Adding participants to a staging group</a>
</li>
<li>
<a href="/september-iteration-2/pre-appoint-confirm">Review and book</a>
</li>
<li>
<a href="/september-iteration-2/appointing-complete">Single day of appointments</a>
</li>
</ol>
<h4 class="nhsuk-heading-s">Iteration 1</h4>
<p>Users upload a csv containing the participants they wish to book into a prearranged single day clinic.</p>
<!-- <p>
<a href="/z-september-transactional-journey/upload-a-batch">Simple click through journey</a>
</p> -->
<ol>
<li>
<a href="/z-september-transactional-journey/upload-a-batch">Upload a batch</a>
</li>
<li>
<a href="/z-september-transactional-journey/batch-detail-trimmed-csv">Batch detail for trimmed csv</a>
</li>
<li>
<a href="/z-september-transactional-journey/pre-appoint-confirm">Pre-appointment confirmation</a>
</li>
<li>
<a href="/z-september-transactional-journey/appointing-complete">Single day of appointments</a>
</li>
</ol>
<p>Defunct work on finding and grouping participants. Components to be reused elsewhere.</p>
<ol>

<details class="nhsuk-details">
<summary class="nhsuk-details__summary">
<span class="nhsuk-details__summary-text">
Older work (may be broken)
</span>
</summary>
<div class="nhsuk-details__text">
<h4 class="nhsuk-heading-s">Iteration 1</h4>
<p>Users upload a csv containing the participants they wish to book into a prearranged single day clinic.</p>
<ol>
<li>
<a href="/z-september-transactional-journey/upload-a-batch">Upload a batch</a>
</li>
<li>
<a href="/z-september-transactional-journey/batch-detail-trimmed-csv">Batch detail for trimmed csv</a>
</li>
<li>
<a href="/z-september-transactional-journey/pre-appoint-confirm">Pre-appointment confirmation</a>
</li>
<li>
<a href="/z-september-transactional-journey/appointing-complete">Single day of appointments</a>
</li>
</ol>
<p>Defunct work on finding and grouping participants. Components to be reused elsewhere.</p>
<ol>
<li>
<a href="/z-september-transactional-journey/batch-detail">Batch detail</a>
</li>
Expand All @@ -205,7 +196,9 @@ <h4 class="nhsuk-heading-s">Iteration 1</h4>
<li>
<a href="/z-september-transactional-journey/spinner">[Utility] "appointing" spinner</a>
</li>
</ol>
</ol>
</div>
</details>

<hr>

Expand Down
Loading