Skip to content

Commit 17f33a4

Browse files
Add resume button to appointment details page
- add conditional var to resume button - add button to appointment details page
1 parent 8cb690a commit 17f33a4

5 files changed

Lines changed: 41 additions & 3 deletions

File tree

manage_breast_screening/clinics/jinja2/clinics/list_clinic_appointments.jinja

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@
116116
'pk': presented_appointment.pk,
117117
}
118118
),
119-
csrf_input=csrf_input
119+
csrf_input=csrf_input,
120+
is_button=False
120121
) }}
121122
{% endif %}
122123
{% endset %}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
{% macro app_resume_appointment(user, presented_appointment, resume_appointment_url, csrf_input) %}
1+
{% macro app_resume_appointment(user, presented_appointment, resume_appointment_url, csrf_input, is_button) %}
22
{%- include 'components/resume-appointment/template.jinja' -%}
33
{% endmacro %}

manage_breast_screening/core/jinja2/components/resume-appointment/template.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<div data-module="app-resume-appointment" data-appointment-id="{{ presented_appointment.pk }}">
66
<form action="{{ resume_appointment_url }}" method="post" novalidate>
77
<p>
8-
<button class="app-button app-button--link">Resume appointment<span class="nhsuk-u-visually-hidden"> for {{ presented_appointment.participant.full_name }}</span></button>
8+
<button class="app-button {% if is_button %}nhsuk-button{% else %} app-button--link{% endif %}">Resume appointment<span class="nhsuk-u-visually-hidden"> for {{ presented_appointment.participant.full_name }}</span></button>
99
</p>
1010
{{ csrf_input }}
1111
</form>

manage_breast_screening/core/jinja2/layout-appointment.jinja

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
{% from 'nhsuk/components/back-link/macro.jinja' import backLink %}
33
{% from 'components/appointment-status/macro.jinja' import app_appointment_status %}
44
{% from 'components/appointment-header/macro.jinja' import app_appointment_header %}
5+
{% from 'components/resume-appointment/macro.jinja' import app_resume_appointment %}
56
{% from 'components/check-in/macro.jinja' import app_check_in %}
67
{% from 'components/secondary-navigation/macro.jinja' import app_secondary_navigation %}
78
{% from 'django_form_helpers.jinja' import form_error_summary %}
@@ -58,6 +59,21 @@
5859

5960
{{ app_appointment_header(request.user, presented_appointment, csrf_input=csrf_input) }}
6061

62+
{% if presented_appointment.can_be_resumed_by(request.user) %}
63+
{{ app_resume_appointment(
64+
request.user,
65+
presented_appointment,
66+
resume_appointment_url=url(
67+
"mammograms:resume_appointment",
68+
kwargs={
69+
'pk': presented_appointment.pk,
70+
}
71+
),
72+
csrf_input=csrf_input,
73+
is_button=True
74+
) }}
75+
{% endif %}
76+
6177
{{ app_secondary_navigation({
6278
"visuallyHiddenTitle": "Secondary menu",
6379
"items": secondary_nav_items

manage_breast_screening/tests/system/clinical/test_recording_medical_history.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ def test_adding_medical_history(self):
4848
self.when_i_click_confirm()
4949
self.then_i_should_be_on_the_clinic_page()
5050

51+
self.when_i_select_view_appointment()
52+
53+
self.then_i_see_the_resume_appointment_button()
54+
self.when_i_click_resume_appointment()
55+
self.then_i_should_be_on_the_confirm_identity_page()
56+
5157
def test_changing_medical_history(self):
5258
self.given_i_am_logged_in_as_a_clinical_user()
5359
self.and_there_is_an_appointment()
@@ -150,6 +156,14 @@ def then_i_see_the_add_a_implanted_medical_device_form(self):
150156
).to_be_visible()
151157
self.assert_page_title_contains("Add details of implanted medical device")
152158

159+
def then_i_see_the_resume_appointment_button(self):
160+
expect(
161+
self.page.get_by_role("button").filter(has_text="Resume appointment")
162+
).to_be_visible()
163+
164+
def when_i_click_resume_appointment(self):
165+
self.page.get_by_role("button").filter(has_text="Resume appointment").click()
166+
153167
def then_i_see_validation_errors_for_missing_implanted_medical_device_details(self):
154168
self.expect_validation_error(
155169
error_text="Select the device type",
@@ -370,6 +384,9 @@ def and_there_is_no_medical_history(self):
370384
def when_i_select_pause_appointment(self):
371385
self.page.get_by_text("Pause appointment").click()
372386

387+
def when_i_select_view_appointment(self):
388+
self.page.get_by_text("View appointment").click()
389+
373390
def then_i_should_be_on_the_pause_appointment_page(self):
374391
path = reverse(
375392
"mammograms:pause_appointment",
@@ -387,3 +404,7 @@ def then_i_should_be_on_the_clinic_page(self):
387404
kwargs={"pk": self.appointment.clinic_slot.clinic.pk},
388405
)
389406
expect(self.page).to_have_url(re.compile(path))
407+
408+
def then_i_should_be_on_the_confirm_identity_page(self):
409+
self.expect_url("mammograms:confirm_identity", pk=self.appointment.pk)
410+
self.assert_page_title_contains("Confirm identity")

0 commit comments

Comments
 (0)