Skip to content

Commit 94a5f97

Browse files
Update design of record vaccination form on patient session page
1 parent 2216712 commit 94a5f97

19 files changed

Lines changed: 287 additions & 224 deletions

app/components/app_vaccinate_form_component.html.erb

Lines changed: 94 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -2,137 +2,128 @@
22
model: form,
33
url:,
44
method: :post,
5-
class: "nhsuk-card",
65
builder: MavisFormBuilder,
76
) do |f| %>
87
<%= f.mavis_error_summary %>
98

109
<%= render AppCardComponent.new() do |card| %>
11-
<section>
12-
<h4 class="nhsuk-card__heading nhsuk-heading-s">
13-
Pre-screening checks
14-
</h4>
10+
<%= f.govuk_radio_buttons_fieldset :identity_check_confirmed_by_patient,
11+
legend: { text: "Has #{patient.given_name} confirmed their identity?", class: "nhsuk-u-font-size-22" } do %>
1512

16-
<%= f.govuk_radio_buttons_fieldset :identity_check_confirmed_by_patient,
17-
legend: { text: "Has #{patient.given_name} confirmed their identity?", size: nil } do %>
13+
<%= f.govuk_radio_button :identity_check_confirmed_by_patient, true, label: { text: "Yes" }, checked: true, link_errors: true %>
1814

19-
<%= f.govuk_radio_button :identity_check_confirmed_by_patient, true, label: { text: "Yes" }, checked: true, link_errors: true %>
15+
<%= f.govuk_radio_button :identity_check_confirmed_by_patient, false,
16+
label: { text: "No, it was confirmed by somebody else" } do %>
2017

21-
<%= f.govuk_radio_button :identity_check_confirmed_by_patient, false,
22-
label: { text: "No, it was confirmed by somebody else" } do %>
18+
<%= f.govuk_text_field :identity_check_confirmed_by_other_name,
19+
label: { text: "What is the person’s name?" } %>
2320

24-
<%= f.govuk_text_field :identity_check_confirmed_by_other_name,
25-
label: { text: "What is the person’s name?" } %>
26-
27-
<%= f.govuk_text_field :identity_check_confirmed_by_other_relationship,
28-
label: { text: "What is their relationship to the child?" },
29-
hint: { text: "For example, parent, teacher or teaching assistant" } %>
30-
<% end %>
21+
<%= f.govuk_text_field :identity_check_confirmed_by_other_relationship,
22+
label: { text: "What is their relationship to the child?" },
23+
hint: { text: "For example, parent, teacher or teaching assistant" } %>
3124
<% end %>
25+
<% end %>
3226

33-
<p>Have you checked that <%= patient.given_name %>:</p>
27+
<hr class="nhsuk-section-break nhsuk-section-break--visible nhsuk-section-break--m">
3428

35-
<ul class="nhsuk-list nhsuk-list--bullet">
36-
<li>is not acutely unwell</li>
37-
<% if ask_not_pregnant? %>
38-
<li>is not pregnant</li>
39-
<% end %>
40-
<li>knows what the vaccination is for, and agrees to have it</li>
41-
<% if ask_not_taking_medication? %>
42-
<li>is not taking any medication which prevents vaccination</li>
43-
<% end %>
44-
<% if ask_asthma_flare_up? %>
45-
<li>if they have asthma, has not had a flare-up of symptoms in the past 72 hours, including wheezing or needing to use a reliever inhaler more than usual</li>
46-
<% end %>
47-
<li>has no other contraindications which prevent vaccination</li>
48-
</ul>
29+
<h4 class="nhsuk-heading-s nhsuk-u-margin-bottom-2">
30+
Pre-screening checks
31+
</h4>
4932

50-
<%= f.govuk_check_boxes_fieldset :pre_screening_confirmed, multiple: false, legend: nil do %>
51-
<%= f.govuk_check_box :pre_screening_confirmed, 1, 0, multiple: false, link_errors: true,
52-
label: { text: "I have checked that the above statements are true" } %>
53-
<% end %>
33+
<p class="nhsuk-body nhsuk-u-margin-bottom-2">Have you checked that <%= patient.given_name %>:</p>
5434

55-
<%= f.govuk_text_area :pre_screening_notes, label: { text: "Pre-screening notes (optional)" }, rows: 3 %>
56-
57-
<% if show_supplied_by_user_id_outside_vaccine_method? %>
58-
<%= f.govuk_select :supplied_by_user_id,
59-
label: { text: "Which nurse identified and pre-screened the child and supplied the vaccine?" },
60-
data: { module: "app-autocomplete" } do %>
61-
<%= tag.option "", value: "" %>
62-
<% form.supplied_by_users.each do |user| %>
63-
<%= tag.option user.full_name,
64-
value: user.id,
65-
selected: user.id == form.supplied_by_user_id,
66-
data: { hint: user.email } %>
67-
<% end %>
35+
<ul class="nhsuk-list nhsuk-list--bullet">
36+
<li>is not acutely unwell</li>
37+
<% if ask_not_pregnant? %>
38+
<li>is not pregnant</li>
39+
<% end %>
40+
<li>knows what the vaccination is for, and agrees to have it</li>
41+
<% if ask_not_taking_medication? %>
42+
<li>is not taking any medication which prevents vaccination</li>
43+
<% end %>
44+
<% if ask_asthma_flare_up? %>
45+
<li>if they have asthma, has not had a flare-up of symptoms in the past 72 hours, including wheezing or needing to use a reliever inhaler more than usual</li>
46+
<% end %>
47+
<li>has no other contraindications which prevent vaccination</li>
48+
</ul>
49+
50+
<%= f.govuk_check_boxes_fieldset :pre_screening_confirmed, multiple: false, legend: nil do %>
51+
<%= f.govuk_check_box :pre_screening_confirmed, 1, 0, multiple: false, link_errors: true,
52+
label: { text: "I have checked that the above statements are true" } %>
53+
<% end %>
54+
55+
<%= f.govuk_text_area :pre_screening_notes, label: { text: "Pre-screening notes (optional)" }, rows: 2 %>
56+
57+
<% if show_supplied_by_user_id_outside_vaccine_method? %>
58+
<%= f.govuk_select :supplied_by_user_id,
59+
label: { text: "Which nurse identified and pre-screened the child and supplied the vaccine?" },
60+
data: { module: "app-autocomplete" } do %>
61+
<%= tag.option "", value: "" %>
62+
<% form.supplied_by_users.each do |user| %>
63+
<%= tag.option user.full_name,
64+
value: user.id,
65+
selected: user.id == form.supplied_by_user_id,
66+
data: { hint: user.email } %>
6867
<% end %>
6968
<% end %>
70-
</section>
71-
72-
<hr class="nhsuk-section-break nhsuk-section-break--visible nhsuk-section-break--l">
73-
74-
<section>
75-
<h4 class="nhsuk-card__heading nhsuk-heading-s">
76-
Is <%= patient.given_name %> ready for their <%= vaccination_name %>?
77-
</h4>
69+
<% end %>
7870

79-
<% hint = "Pre-screening checks must be completed for vaccination to go ahead" %>
71+
<hr class="nhsuk-section-break nhsuk-section-break--visible nhsuk-section-break--m">
8072

81-
<%= f.govuk_radio_buttons_fieldset :vaccine_method, legend: nil do %>
82-
<% vaccine_methods.each_with_index do |vaccine_method, index| %>
83-
<% if index == 1 %>
84-
<%= f.govuk_radio_divider %>
85-
<% end %>
73+
<%= f.govuk_radio_buttons_fieldset :vaccine_method, legend: { text: "Is #{patient.given_name} ready for their #{vaccination_name}?", class: "nhsuk-u-font-size-22" } do %>
74+
<% vaccine_methods.each_with_index do |vaccine_method, index| %>
75+
<% if index == 1 %>
76+
<%= f.govuk_radio_divider %>
77+
<% end %>
8678

87-
<% label = if index.zero?
88-
"Yes"
89-
else
90-
"No — but they can have the #{Vaccine.human_enum_name(:method_prefix, vaccine_method)} #{programme.name_in_sentence} instead"
91-
end %>
92-
93-
<% options = common_delivery_site_options(vaccine_method) %>
94-
95-
<% if options.length > 1 || show_supplied_by_user_id_inside_vaccine_method?(vaccine_method) %>
96-
<%= f.govuk_radio_button :vaccine_method, vaccine_method, label: { text: label }, hint: { text: hint }, link_errors: index.zero? do %>
97-
<% if show_supplied_by_user_id_inside_vaccine_method?(vaccine_method) %>
98-
<%= f.govuk_select :supplied_by_user_id,
99-
label: { text: "Which nurse identified and pre-screened the child and supplied the vaccine?" },
100-
data: { module: "app-autocomplete" } do %>
101-
<%= tag.option "", value: "" %>
102-
<% form.supplied_by_users.each do |user| %>
103-
<%= tag.option user.full_name,
104-
value: user.id,
105-
selected: user.id == form.supplied_by_user_id,
106-
data: { hint: user.email } %>
107-
<% end %>
79+
<% label = if index.zero?
80+
"Yes"
81+
else
82+
"No — but they can have the #{Vaccine.human_enum_name(:method_prefix, vaccine_method)} #{programme.name_in_sentence} instead"
83+
end %>
84+
85+
<% options = common_delivery_site_options(vaccine_method) %>
86+
87+
<% if options.length > 1 || show_supplied_by_user_id_inside_vaccine_method?(vaccine_method) %>
88+
<%= f.govuk_radio_button :vaccine_method, vaccine_method, label: { text: label }, link_errors: index.zero? do %>
89+
<% if show_supplied_by_user_id_inside_vaccine_method?(vaccine_method) %>
90+
<%= f.govuk_select :supplied_by_user_id,
91+
label: { text: "Which nurse identified and pre-screened the child and supplied the vaccine?" },
92+
data: { module: "app-autocomplete" } do %>
93+
<%= tag.option "", value: "" %>
94+
<% form.supplied_by_users.each do |user| %>
95+
<%= tag.option user.full_name,
96+
value: user.id,
97+
selected: user.id == form.supplied_by_user_id,
98+
data: { hint: user.email } %>
10899
<% end %>
109100
<% end %>
101+
<% end %>
110102

111-
<% if options.length > 1 %>
112-
<%= f.govuk_collection_radio_buttons :delivery_site,
113-
options,
114-
:value,
115-
:label,
116-
legend: {
117-
text: "Where will the #{Vaccine.human_enum_name(:method, vaccine_method).downcase} be given?",
118-
size: "s",
119-
} %>
120-
<% end %>
103+
<% if options.length > 1 %>
104+
<%= f.govuk_collection_radio_buttons :delivery_site,
105+
options,
106+
:value,
107+
:label,
108+
legend: {
109+
text: "Where will the #{Vaccine.human_enum_name(:method, vaccine_method).downcase} be given?",
110+
size: "s",
111+
} %>
121112
<% end %>
122-
<% else %>
123-
<%= f.govuk_radio_button :vaccine_method, vaccine_method, label: { text: label }, hint: { text: hint }, link_errors: index.zero? %>
124113
<% end %>
114+
<% else %>
115+
<%= f.govuk_radio_button :vaccine_method, vaccine_method, label: { text: label }, link_errors: index.zero? %>
116+
<% end %>
125117

126-
<% if index.zero? %>
127-
<%= f.govuk_radio_button :vaccine_method, "none", label: { text: "No" } %>
128-
<% end %>
118+
<% if index.zero? %>
119+
<%= f.govuk_radio_button :vaccine_method, "none", label: { text: "No" } %>
129120
<% end %>
130121
<% end %>
122+
<% end %>
131123

132-
<%= f.hidden_field :dose_sequence, value: dose_sequence %>
133-
<%= f.hidden_field :programme_type, value: programme.type %>
124+
<%= f.hidden_field :dose_sequence, value: dose_sequence %>
125+
<%= f.hidden_field :programme_type, value: programme.type %>
134126

135-
<%= f.govuk_submit "Continue", class: "nhsuk-u-margin-bottom-0" %>
136-
</section>
127+
<%= f.govuk_submit "Continue", class: "nhsuk-u-margin-bottom-0" %>
137128
<% end %>
138129
<% end %>

spec/components/app_vaccinate_form_component_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
it { should have_content("Has Hari confirmed their identity?") }
4646
it { should have_field("No, it was confirmed by somebody else") }
4747

48-
it { should have_heading("Is Hari ready for their flu injection?") }
48+
it { should have_text("Is Hari ready for their flu injection?") }
4949

5050
it { should have_field("Yes") }
5151
it { should have_field("No") }
@@ -73,7 +73,7 @@
7373
it { should have_content("Has Hari confirmed their identity?") }
7474
it { should have_field("No, it was confirmed by somebody else") }
7575

76-
it { should have_heading("Is Hari ready for their flu nasal spray?") }
76+
it { should have_text("Is Hari ready for their flu nasal spray?") }
7777

7878
it { should have_field("Yes") }
7979
it { should have_field("No") }
@@ -98,7 +98,7 @@
9898
)
9999
end
100100

101-
it { should have_heading("Is Hari ready for their flu injection?") }
101+
it { should have_text("Is Hari ready for their flu injection?") }
102102

103103
it { should have_field("Yes") }
104104
it { should have_field("No") }
@@ -115,7 +115,7 @@
115115
it { should have_content("Has Hari confirmed their identity?") }
116116
it { should have_field("No, it was confirmed by somebody else") }
117117

118-
it { should have_heading("Is Hari ready for their HPV vaccination?") }
118+
it { should have_text("Is Hari ready for their HPV vaccination?") }
119119

120120
it { should have_field("Yes") }
121121
it { should have_field("No") }

spec/features/community_clinic_vaccination_session_spec.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ def when_i_record_a_non_administered_vaccination_with_reason
3737
visit session_record_path(@session)
3838
click_link @patient.full_name
3939

40-
within all("section")[1] do
41-
choose "No"
40+
within all("form")[3] do
41+
within all("fieldset")[2] do
42+
choose "No"
43+
end
4244
click_button "Continue"
4345
end
4446

spec/features/doubles_vaccination_administered_spec.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,11 @@ def and_i_fill_out_pre_screening_questions
7777
end
7878

7979
def and_i_record_the_vaccination(batch)
80-
within all("section")[1] do
81-
choose "Yes"
82-
choose "Left arm (upper position)"
80+
within all("form")[3] do
81+
within all("fieldset")[2] do
82+
choose "Yes"
83+
choose "Left arm (upper position)"
84+
end
8385
click_button "Continue"
8486
end
8587

spec/features/e2e_journey_spec.rb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,15 @@ def and_i_record_the_successful_vaccination
265265

266266
expect(page).to have_content("Update attendance")
267267

268-
within all("section")[0] do
269-
check "I have checked that the above statements are true"
270-
end
271-
272-
within all("section")[1] do
273-
choose "Yes"
274-
choose "Left arm (upper position)"
268+
within all("form")[3] do
269+
within all("fieldset")[1] do
270+
check "I have checked that the above statements are true"
271+
end
272+
273+
within all("fieldset")[2] do
274+
choose "Yes"
275+
choose "Left arm (upper position)"
276+
end
275277
click_button "Continue"
276278
end
277279

0 commit comments

Comments
 (0)