From 01172e33de27163cf87b3dba48e5223980f5708a Mon Sep 17 00:00:00 2001 From: Ed Horsford Date: Mon, 18 Nov 2024 12:27:41 +0000 Subject: [PATCH] Make check-in work --- app/routes/clinics.js | 9 +++++++-- app/views/participants/show.html | 24 +++++++++++++++--------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/app/routes/clinics.js b/app/routes/clinics.js index 552b232..e61ef55 100644 --- a/app/routes/clinics.js +++ b/app/routes/clinics.js @@ -141,8 +141,13 @@ module.exports = router => { // Save back to session req.session.data = data; - // Redirect back to the same filter view - res.redirect(`/clinics/${clinicId}/${currentFilter}`); + // If there's a returnTo path, use that, otherwise go back to the filter view + const returnTo = req.query.returnTo; + if (returnTo) { + res.redirect(returnTo); + } else { + res.redirect(`/clinics/${clinicId}/${currentFilter}`); + } }); function filterEvents(events, filter) { diff --git a/app/views/participants/show.html b/app/views/participants/show.html index c11b823..fa9c93a 100644 --- a/app/views/participants/show.html +++ b/app/views/participants/show.html @@ -7,8 +7,8 @@ {% set back = { - href: "/clinics", - text: "Clinics" + href: "/clinics/" + clinicId, + text: "Back to clinic" } %} {% block pageContent %} @@ -39,7 +39,10 @@

Current appointment

Status
- {{ event.status | replace("_", " ") | capitalize }} + {{ tag({ + text: event.status | formatWords | sentenceCase, + classes: "nhsuk-tag--" + event.status | getStatusTagColour + })}}
@@ -136,13 +139,16 @@

Medical information

{% if event.status === 'scheduled' %} - + {% set href %} + /clinics/{{ clinicId }}/check-in/{{ event.id }}?returnTo=/clinics/{{ clinicId }}/participants/{{ participantId }} + {% endset %} + {{ button({ + text: "Check in participant", + href: href | trim + }) }} + {# Check in participant - + #} {% endif %} -

- Back to clinic list -

- {% endblock %}