Skip to content

Commit 01172e3

Browse files
Make check-in work
1 parent ad066f6 commit 01172e3

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

app/routes/clinics.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,13 @@ module.exports = router => {
141141
// Save back to session
142142
req.session.data = data;
143143

144-
// Redirect back to the same filter view
145-
res.redirect(`/clinics/${clinicId}/${currentFilter}`);
144+
// If there's a returnTo path, use that, otherwise go back to the filter view
145+
const returnTo = req.query.returnTo;
146+
if (returnTo) {
147+
res.redirect(returnTo);
148+
} else {
149+
res.redirect(`/clinics/${clinicId}/${currentFilter}`);
150+
}
146151
});
147152

148153
function filterEvents(events, filter) {

app/views/participants/show.html

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88

99
{% set back = {
10-
href: "/clinics",
11-
text: "Clinics"
10+
href: "/clinics/" + clinicId,
11+
text: "Back to clinic"
1212
} %}
1313

1414
{% block pageContent %}
@@ -39,7 +39,10 @@ <h2 class="nhsuk-heading-m">Current appointment</h2>
3939
<div class="nhsuk-summary-list__row">
4040
<dt class="nhsuk-summary-list__key">Status</dt>
4141
<dd class="nhsuk-summary-list__value">
42-
{{ event.status | replace("_", " ") | capitalize }}
42+
{{ tag({
43+
text: event.status | formatWords | sentenceCase,
44+
classes: "nhsuk-tag--" + event.status | getStatusTagColour
45+
})}}
4346
</dd>
4447
</div>
4548
</dl>
@@ -136,13 +139,16 @@ <h2 class="nhsuk-heading-m">Medical information</h2>
136139
</dl>
137140

138141
{% if event.status === 'scheduled' %}
139-
<a href="/clinics/{{ clinicId }}/check-in/{{ event.id }}" class="nhsuk-button">
142+
{% set href %}
143+
/clinics/{{ clinicId }}/check-in/{{ event.id }}?returnTo=/clinics/{{ clinicId }}/participants/{{ participantId }}
144+
{% endset %}
145+
{{ button({
146+
text: "Check in participant",
147+
href: href | trim
148+
}) }}
149+
{# <a href="/clinics/{{ clinicId }}/check-in/{{ event.id }}" class="nhsuk-button">
140150
Check in participant
141-
</a>
151+
</a> #}
142152
{% endif %}
143153

144-
<p class="nhsuk-body">
145-
<a href="/clinics/{{ clinicId }}" class="nhsuk-back-link">Back to clinic list</a>
146-
</p>
147-
148154
{% endblock %}

0 commit comments

Comments
 (0)