Skip to content

Commit

Permalink
Make check-in work
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardhorsford committed Nov 18, 2024
1 parent ad066f6 commit 01172e3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
9 changes: 7 additions & 2 deletions app/routes/clinics.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
24 changes: 15 additions & 9 deletions app/views/participants/show.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@


{% set back = {
href: "/clinics",
text: "Clinics"
href: "/clinics/" + clinicId,
text: "Back to clinic"
} %}

{% block pageContent %}
Expand Down Expand Up @@ -39,7 +39,10 @@ <h2 class="nhsuk-heading-m">Current appointment</h2>
<div class="nhsuk-summary-list__row">
<dt class="nhsuk-summary-list__key">Status</dt>
<dd class="nhsuk-summary-list__value">
{{ event.status | replace("_", " ") | capitalize }}
{{ tag({
text: event.status | formatWords | sentenceCase,
classes: "nhsuk-tag--" + event.status | getStatusTagColour
})}}
</dd>
</div>
</dl>
Expand Down Expand Up @@ -136,13 +139,16 @@ <h2 class="nhsuk-heading-m">Medical information</h2>
</dl>

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

<p class="nhsuk-body">
<a href="/clinics/{{ clinicId }}" class="nhsuk-back-link">Back to clinic list</a>
</p>

{% endblock %}

0 comments on commit 01172e3

Please sign in to comment.