Skip to content

Commit 340537d

Browse files
authored
Merge pull request #215 from NHSDigital/dtoss-9812-appointment-completed-page
DTOSS-9812 Appointment completed page
2 parents e0cdc6e + eefe7d5 commit 340537d

20 files changed

Lines changed: 374 additions & 100 deletions

File tree

manage_breast_screening/assets/sass/main.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ h3 {
3131
Highlight in red links that don't get anywhere yet
3232
*/
3333
a[href="#"] {
34-
color: #c80000;
34+
color: #c80000 !important;
3535
}
3636

3737
// Status tag positioning within headers

manage_breast_screening/clinics/jinja2/clinics/show.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
{% for presented_appointment in presented_appointment_list.appointments %}
4747
{% set details_html %}
4848
<p class="nhsuk-u-margin-bottom-1">
49-
<a href="{{ url('mammograms:start_screening', kwargs={"pk": presented_appointment.pk}) }}" class="nhsuk-link">
49+
<a href="{{ url('mammograms:show_appointment', kwargs={"pk": presented_appointment.pk}) }}" class="nhsuk-link">
5050
{{ presented_appointment.participant.full_name }}
5151
</a>
5252
</p>
@@ -111,4 +111,4 @@
111111
"classes": "nhsuk-table"
112112
}) }}
113113

114-
{% endblock %}
114+
{% endblock %}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
<p class="app-text-grey"><span>NHS Number: {{ participant.nhs_number }}</span></p>
55

6-
<p>{{ clinic_slot.slot_time_and_clinic_date }}<span class="nhsuk-u-margin-left-3"><a href="#">Reschedule appointment</a></span></p>
6+
<p>{{ clinic_slot.slot_time_and_clinic_date }}{% if not appointment.current_status.is_screened %}<span class="nhsuk-u-margin-left-3"><a href="#">Reschedule appointment</a></span>{% endif %}</p>
77

88
<p class="nhsuk-u-margin-bottom-4"><a href="{{ appointment.participant_url }}">View participant record</a></p>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{% extends 'layout-app.jinja' %}
2+
{% from 'card/macro.jinja' import card %}
3+
{% from 'warning-callout/macro.jinja' import warningCallout %}
4+
{% from 'back-link/macro.jinja' import backLink %}
5+
{% from 'components/appointment-status/macro.jinja' import appointment_status %}
6+
{% from 'components/appointment-header/macro.jinja' import appointment_header %}
7+
{% from 'components/participant-details/macro.jinja' import participant_details %}
8+
{% from 'components/secondary-navigation/macro.jinja' import app_secondary_navigation %}
9+
10+
{% block beforeContent %}
11+
{{ backLink({
12+
"href": presented_appointment.clinic_url,
13+
"text": "Back to clinic"
14+
}) }}
15+
{% endblock beforeContent %}
16+
17+
{% block page_content %}
18+
<div class="nhsuk-grid-row">
19+
<div class="nhsuk-grid-column-full">
20+
21+
<div class="app-header">
22+
<h1 class="nhsuk-heading-l">
23+
<span class="nhsuk-caption-l">
24+
{{ caption }}
25+
</span>
26+
{{ title }}
27+
</h1>
28+
29+
<div class="app-header__status-tag">
30+
{{ appointment_status(
31+
appointment=presented_appointment,
32+
csrf_input=csrf_input
33+
)}}
34+
</div>
35+
</div>
36+
37+
{{ appointment_header(presented_appointment) }}
38+
39+
{{ app_secondary_navigation({
40+
"visuallyHiddenTitle": "Secondary menu",
41+
"items": secondary_nav_items
42+
}) }}
43+
44+
{{ card({
45+
"headingHtml": " ",
46+
"headingLevel": "2",
47+
"descriptionHtml": participant_details(
48+
presented_participant=presented_participant,
49+
presented_mammograms=presented_mammograms,
50+
return_url=request.path,
51+
screening_protocol=presented_appointment.screening_protocol
52+
)
53+
}) }}
54+
</div>
55+
</div>
56+
{% endblock %}

manage_breast_screening/mammograms/jinja2/mammograms/start_screening.jinja

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,12 @@
2121
csrf_input=csrf_input
2222
)}}
2323
</div>
24+
</div>
2425
{% endblock %}
2526

2627
{% block step_content %}
2728
{{ appointment_header(presented_appointment) }}
2829

29-
{% if secondary_nav_items %}
30-
{{ app_secondary_navigation({
31-
"visuallyHiddenTitle": "Secondary menu",
32-
"items": secondary_nav_items
33-
}) }}
34-
{% endif %}
35-
3630
{% set special_appointment_html %}
3731
{% if presented_participant.extra_needs | length > 1 %}
3832
<ul>

manage_breast_screening/mammograms/presenters.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def present_secondary_nav(pk):
1515
{
1616
"id": "all",
1717
"text": "Appointment details",
18-
"href": reverse("mammograms:start_screening", kwargs={"pk": pk}),
18+
"href": reverse("mammograms:show_appointment", kwargs={"pk": pk}),
1919
"current": True,
2020
},
2121
{"id": "medical_information", "text": "Medical information", "href": "#"},
@@ -39,6 +39,10 @@ def __init__(self, appointment):
3939
def participant_url(self):
4040
return self.participant.url
4141

42+
@cached_property
43+
def clinic_url(self):
44+
return self.clinic_slot.clinic_url
45+
4246
@cached_property
4347
def start_time(self):
4448
return self.clinic_slot.starts_at
@@ -65,6 +69,7 @@ def current_status(self):
6569
"text": current_status.get_state_display(),
6670
"key": current_status.state,
6771
"is_confirmed": current_status.state == AppointmentStatus.CONFIRMED,
72+
"is_screened": current_status.state == AppointmentStatus.SCREENED,
6873
}
6974

7075

@@ -149,6 +154,10 @@ def __init__(self, clinic_slot):
149154
def clinic_type(self):
150155
return self._clinic.get_type_display().capitalize()
151156

157+
@cached_property
158+
def clinic_url(self):
159+
return reverse("clinics:show", kwargs={"pk": self._clinic.pk})
160+
152161
@cached_property
153162
def slot_time_and_clinic_date(self):
154163
clinic_slot = self._clinic_slot

manage_breast_screening/mammograms/tests/system/test_adding_previous_mammograms.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_adding_a_mammogram_at_the_same_provider(self):
2424
"""
2525
If a mammogram was taken at the same provider, but there is an error in the system, the participant can report that it was taken.
2626
"""
27-
self.given_i_am_on_the_start_screening_page()
27+
self.given_i_am_on_the_appointment_show_page()
2828
self.then_i_should_see_no_reported_mammograms()
2929

3030
self.when_i_click_on_add_mammogram()
@@ -43,7 +43,7 @@ def test_adding_a_mammogram_taken_elsewhere_with_a_different_name(self):
4343
If a mammogram was taken at another BSU, or elsewhere in the UK, the participant can report that it was taken
4444
If the mammogram was taken under a different name, the mammographer can record that name.
4545
"""
46-
self.given_i_am_on_the_start_screening_page()
46+
self.given_i_am_on_the_appointment_show_page()
4747
self.then_i_should_see_no_reported_mammograms()
4848

4949
self.when_i_click_on_add_mammogram()
@@ -61,11 +61,11 @@ def test_accessibility(self):
6161
self.given_i_am_on_the_add_previous_mammograms_page()
6262
self.then_the_accessibility_baseline_is_met()
6363

64-
def given_i_am_on_the_start_screening_page(self):
64+
def given_i_am_on_the_appointment_show_page(self):
6565
self.page.goto(
6666
self.live_server_url
6767
+ reverse(
68-
"mammograms:start_screening",
68+
"mammograms:show_appointment",
6969
kwargs={"pk": self.appointment.pk},
7070
)
7171
)
@@ -94,7 +94,7 @@ def then_i_should_be_on_the_add_previous_mammogram_form(self):
9494

9595
def then_i_should_be_back_on_the_appointment(self):
9696
path = reverse(
97-
"mammograms:start_screening",
97+
"mammograms:show_appointment",
9898
kwargs={"pk": self.appointment.pk},
9999
)
100100
expect(self.page).to_have_url(re.compile(path))

manage_breast_screening/mammograms/tests/system/test_recording_a_mammogram.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_recording_a_mammogram_without_capturing_medical_information(self):
2323
"""
2424
I can record a mammogram without entering any relevant medical information.
2525
"""
26-
self.given_i_am_on_the_start_screening_page()
26+
self.given_i_am_on_the_appointment_show_page()
2727
self.then_i_should_see_the_demographic_banner()
2828
self.and_i_should_see_the_participant_details()
2929

@@ -39,7 +39,7 @@ def test_filling_out_forms_incorrectly(self):
3939
At each step in the flow, when I fill out the forms incorrectly,
4040
then I should see the errors so I can fix them.
4141
"""
42-
self.given_i_am_on_the_start_screening_page()
42+
self.given_i_am_on_the_appointment_show_page()
4343
self.when_i_submit_the_form()
4444
self.then_i_am_prompted_to_answer_can_the_screening_go_ahead()
4545

@@ -56,7 +56,7 @@ def test_filling_out_forms_incorrectly(self):
5656
self.then_i_am_prompted_to_confirm_whether_imaging_can_go_ahead()
5757

5858
def test_accessibility(self):
59-
self.given_i_am_on_the_start_screening_page()
59+
self.given_i_am_on_the_appointment_show_page()
6060
self.then_the_accessibility_baseline_is_met()
6161

6262
self.when_i_check_the_participants_identity_and_confirm_the_last_mammogram_date()
@@ -68,11 +68,11 @@ def test_accessibility(self):
6868
self.when_i_mark_that_imaging_can_go_ahead()
6969
self.then_the_accessibility_baseline_is_met()
7070

71-
def given_i_am_on_the_start_screening_page(self):
71+
def given_i_am_on_the_appointment_show_page(self):
7272
self.page.goto(
7373
self.live_server_url
7474
+ reverse(
75-
"mammograms:start_screening",
75+
"mammograms:show_appointment",
7676
kwargs={"pk": self.appointment.pk},
7777
)
7878
)
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import pytest
2+
from django.urls import reverse
3+
from playwright.sync_api import expect
4+
5+
from manage_breast_screening.core.system_test_setup import SystemTestCase
6+
from manage_breast_screening.participants.models import AppointmentStatus
7+
from manage_breast_screening.participants.tests.factories import (
8+
AppointmentFactory,
9+
ParticipantFactory,
10+
ScreeningEpisodeFactory,
11+
)
12+
13+
14+
class TestViewingACompletedAppointment(SystemTestCase):
15+
@pytest.fixture(autouse=True)
16+
def before(self):
17+
self.participant = ParticipantFactory(first_name="Janet", last_name="Williams")
18+
self.screening_episode = ScreeningEpisodeFactory(participant=self.participant)
19+
self.appointment = AppointmentFactory(
20+
screening_episode=self.screening_episode,
21+
current_status=AppointmentStatus.SCREENED,
22+
)
23+
24+
def test_viewing_a_completed_appointment(self):
25+
"""
26+
The appointment page includes appointment details, medical information, and images tabs.
27+
Only the first one is implemented yet.
28+
"""
29+
self.given_i_am_on_the_appointment_show_page()
30+
self.then_i_should_see_the_demographic_banner()
31+
self.and_i_should_see_the_participant_details()
32+
self.and_i_should_not_see_a_form()
33+
34+
def test_accessibility(self):
35+
self.given_i_am_on_the_appointment_show_page()
36+
self.then_the_accessibility_baseline_is_met()
37+
38+
def given_i_am_on_the_appointment_show_page(self):
39+
self.page.goto(
40+
self.live_server_url
41+
+ reverse(
42+
"mammograms:show_appointment",
43+
kwargs={"pk": self.appointment.pk},
44+
)
45+
)
46+
47+
def then_i_should_see_the_demographic_banner(self):
48+
expect(self.page.get_by_text("NHS Number")).to_be_visible()
49+
50+
def and_i_should_see_the_participant_details(self):
51+
expect(
52+
self.page.locator(".nhsuk-summary-list__row", has_text="Full name")
53+
).to_contain_text("Janet Williams")
54+
55+
def and_i_should_not_see_a_form(self):
56+
expect(self.page.get_by_role("form")).not_to_be_attached()

0 commit comments

Comments
 (0)