Skip to content

Commit c880bcf

Browse files
authored
Merge pull request #3797 from nhsuk/next
Version 2.3.0
2 parents 067a694 + 56df2b6 commit c880bcf

107 files changed

Lines changed: 1409 additions & 1791 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Gemfile.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
GIT
22
remote: https://github.com/citizensadvice/capybara_accessible_selectors
3-
revision: a55fca198e43a3c81981ae46412c678a57f4f2f5
3+
revision: b60eebb9673b20dd472afb3d724340a6f6132bcb
44
branch: main
55
specs:
66
capybara_accessible_selectors (0.11.0)
@@ -111,8 +111,8 @@ GEM
111111
ast (2.4.3)
112112
attr_required (1.0.2)
113113
aws-eventstream (1.4.0)
114-
aws-partitions (1.1117.0)
115-
aws-sdk-accessanalyzer (1.72.0)
114+
aws-partitions (1.1118.0)
115+
aws-sdk-accessanalyzer (1.73.0)
116116
aws-sdk-core (~> 3, >= 3.225.0)
117117
aws-sigv4 (~> 1.5)
118118
aws-sdk-core (3.226.0)
@@ -137,7 +137,7 @@ GEM
137137
aws-sdk-rds (1.280.0)
138138
aws-sdk-core (~> 3, >= 3.225.0)
139139
aws-sigv4 (~> 1.5)
140-
aws-sdk-s3 (1.189.1)
140+
aws-sdk-s3 (1.190.0)
141141
aws-sdk-core (~> 3, >= 3.225.0)
142142
aws-sdk-kms (~> 1)
143143
aws-sigv4 (~> 1.5)
@@ -193,7 +193,7 @@ GEM
193193
capybara (~> 3.0)
194194
ferrum (~> 0.17.0)
195195
date (3.4.1)
196-
debug (1.10.0)
196+
debug (1.11.0)
197197
irb (~> 1.10)
198198
reline (>= 0.3.8)
199199
deep_merge (1.2.2)
@@ -342,7 +342,7 @@ GEM
342342
net-pop
343343
net-smtp
344344
marcel (1.0.4)
345-
matrix (0.4.2)
345+
matrix (0.4.3)
346346
mechanize (2.14.0)
347347
addressable (~> 2.8)
348348
base64
@@ -504,7 +504,7 @@ GEM
504504
ffi (~> 1.0)
505505
rbs (3.9.4)
506506
logger
507-
rdoc (6.14.0)
507+
rdoc (6.14.1)
508508
erb
509509
psych (>= 4.0.0)
510510
redcarpet (3.6.1)
@@ -652,8 +652,8 @@ GEM
652652
syntax_tree (>= 2.0.1)
653653
temple (0.10.0)
654654
thor (1.3.2)
655-
thruster (0.1.13-arm64-darwin)
656-
thruster (0.1.13-x86_64-linux)
655+
thruster (0.1.14-arm64-darwin)
656+
thruster (0.1.14-x86_64-linux)
657657
tilt (2.6.0)
658658
timeout (0.4.3)
659659
turbo-rails (2.0.16)

app/assets/stylesheets/_grid.scss

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
1-
// Search filters and results
2-
.app-grid-column-filters .nhsuk-card--feature.app-filters,
3-
.app-grid-column-results > .nhsuk-card--feature,
4-
.app-grid-column-results > .nhsuk-warning-callout {
5-
margin-top: nhsuk-spacing(3);
1+
// Patient session and record
2+
.app-grid-column-patient-session {
3+
@include nhsuk-grid-column(
4+
three-quarters,
5+
$float: right,
6+
$at: large-desktop,
7+
$class: false
8+
);
9+
}
10+
11+
.app-grid-column-patient-record {
12+
@include nhsuk-grid-column(
13+
one-quarter,
14+
$float: right,
15+
$at: large-desktop,
16+
$class: false
17+
);
618
}
719

20+
// Search filters and results
821
.app-grid-column-filters {
922
@include nhsuk-grid-column(filters, $at: large-desktop, $class: false);
1023
}
@@ -13,6 +26,12 @@
1326
@include nhsuk-grid-column(results, $at: large-desktop, $class: false);
1427
}
1528

29+
.app-grid-column-filters .nhsuk-card--feature.app-filters,
30+
.app-grid-column-results > .nhsuk-card--feature,
31+
.app-grid-column-results > .nhsuk-warning-callout {
32+
margin-top: nhsuk-spacing(3);
33+
}
34+
1635
// Sticky column
1736
.app-grid-column--sticky {
1837
@include nhsuk-media-query($from: desktop) {

app/assets/stylesheets/_table.scss

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,9 @@
2020
}
2121
}
2222

23-
.app-table__cell-status {
24-
&--aqua-green:first-of-type {
25-
border-left: nhsuk-spacing(2) solid $color_nhsuk-aqua-green;
26-
padding-left: nhsuk-spacing(3);
27-
}
28-
29-
&--grey {
30-
background-color: $color_nhsuk-grey-5;
31-
color: $nhsuk-secondary-text-color;
32-
33-
&:first-of-type {
34-
border-left: nhsuk-spacing(2) solid $color_nhsuk-grey-3;
35-
padding-left: nhsuk-spacing(3);
36-
}
37-
}
38-
39-
&--red:first-of-type {
40-
border-left: nhsuk-spacing(2) solid $color_nhsuk-red;
41-
padding-left: nhsuk-spacing(3);
42-
}
23+
.app-table__cell--muted {
24+
background-color: $color_nhsuk-grey-5;
25+
color: $nhsuk-secondary-text-color;
4326
}
4427

4528
// Don't show a grey background when hovering over table rows.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<%= render AppCardComponent.new(colour:) do |card| %>
2+
<% card.with_heading { heading } %>
3+
4+
<% unless vaccination_status.vaccinated? %>
5+
<% if consent_status.no_response? %>
6+
<% if latest_consent_request %>
7+
<p>No-one responded to our requests for consent.</p>
8+
<p>A request was sent on <%= latest_consent_request.sent_at.to_fs(:long) %>.</p>
9+
<% else %>
10+
<p>No requests have been sent.</p>
11+
<% end %>
12+
<% elsif consent_status.conflicts? %>
13+
<p>You can only vaccinate if all respondents give consent.</p>
14+
<% elsif consent_status.refused? %>
15+
<p><%= who_refused %> refused to give consent.</p>
16+
<% elsif consent_status.given? %>
17+
<p><%= patient.full_name %> is ready for the vaccinator.</p>
18+
<% end %>
19+
20+
<div class="app-button-group nhsuk-u-margin-bottom-4">
21+
<% if can_send_consent_request? %>
22+
<%= govuk_button_to "Send consent request",
23+
send_request_session_patient_programme_consents_path(
24+
session, patient, programme
25+
),
26+
secondary: true %>
27+
<% end %>
28+
29+
<%= govuk_button_to "Get verbal consent",
30+
session_patient_programme_consents_path(
31+
session, patient, programme
32+
),
33+
secondary: true %>
34+
</div>
35+
36+
<%= render AppGillickAssessmentComponent.new(patient_session:, programme:) %>
37+
<% end %>
38+
39+
<%= render AppConsentTableComponent.new(patient_session:, programme:) %>
40+
<% end %>
Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
class AppConsentComponent < ViewComponent::Base
3+
class AppConsentCardComponent < ViewComponent::Base
44
def initialize(patient_session:, programme:)
55
super
66

@@ -12,13 +12,12 @@ def initialize(patient_session:, programme:)
1212

1313
delegate :patient, :session, to: :patient_session
1414

15-
def consents
16-
@consents ||=
17-
patient
18-
.consents
19-
.where(programme:)
20-
.includes(:consent_form, :parent)
21-
.order(created_at: :desc)
15+
def colour
16+
I18n.t(status, scope: %i[status consent colour])
17+
end
18+
19+
def heading
20+
"#{programme.name}: #{I18n.t(status, scope: %i[status consent label])}"
2221
end
2322

2423
def latest_consent_request
@@ -35,20 +34,24 @@ def consent_status
3534
@consent_status ||= patient.consent_status(programme:)
3635
end
3736

37+
def vaccination_status
38+
@vaccination_status ||= patient.vaccination_status(programme:)
39+
end
40+
3841
def can_send_consent_request?
3942
consent_status.no_response? && patient.send_notifications? &&
4043
session.open_for_consent? && patient.parents.any?
4144
end
4245

43-
def status_colour(consent)
44-
if consent.invalidated? || consent.withdrawn?
45-
"grey"
46-
elsif consent.response_given?
47-
"aqua-green"
48-
elsif consent.response_refused?
49-
"red"
50-
else
51-
"grey"
52-
end
46+
def who_refused
47+
consents =
48+
patient.consents.where(programme:).not_invalidated.includes(:parent)
49+
50+
ConsentGrouper
51+
.call(consents, programme:)
52+
.find(&:response_refused?)
53+
&.who_responded
5354
end
55+
56+
delegate :status, to: :consent_status
5457
end

app/components/app_consent_component.html.erb

Lines changed: 0 additions & 64 deletions
This file was deleted.

app/components/app_consent_status_component.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ def initialize(patient_session:, programme:)
99
end
1010

1111
def call
12-
consent_status = patient.consent_status(programme:)
1312
if consent_status.given?
1413
icon_tick "Consent given", "aqua-green"
1514
elsif consent_status.refused?
@@ -25,6 +24,11 @@ def call
2524

2625
delegate :patient, to: :patient_session
2726

27+
def consent_status
28+
@consent_status ||=
29+
patient.consent_statuses.find_or_initialize_by(programme:)
30+
end
31+
2832
def icon_tick(content, color)
2933
template = <<-ERB
3034
<p class="app-status app-status--#{color}">

app/components/app_consent_summary_component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def call
1919

2020
summary_list.with_row do |row|
2121
row.with_key { "Decision" }
22-
row.with_value { helpers.consent_decision(@consent) }
22+
row.with_value { helpers.consent_status_tag(@consent) }
2323
if (href = @change_links[:response])
2424
row.with_action(
2525
text: "Change",
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<%= govuk_table do |table| %>
2+
<% table.with_caption(text: "Consent responses", size: "s") %>
3+
4+
<% table.with_head do |head| %>
5+
<% head.with_row do |row| %>
6+
<% row.with_cell(text: "Name") %>
7+
<% row.with_cell(text: "Response date") %>
8+
<% row.with_cell(text: "Decision") %>
9+
<% end %>
10+
<% end %>
11+
12+
<% table.with_body do |body| %>
13+
<% consents.each do |consent| %>
14+
<% body.with_row do |row| %>
15+
<% classes = "app-table__cell-muted" if consent.invalidated? || consent.withdrawn? %>
16+
17+
<% row.with_cell(classes:) do %>
18+
<%= link_to consent&.parent&.full_name || consent.patient.full_name,
19+
session_patient_programme_consent_path(session, patient, programme, consent) %>
20+
<br />
21+
<span class="nhsuk-u-font-size-16"><%= consent.who_responded %></span>
22+
<% end %>
23+
24+
<% row.with_cell(classes:, text: consent.responded_at.to_fs(:long)) %>
25+
26+
<% row.with_cell(classes:, text: helpers.consent_status_tag(consent)) %>
27+
<% end %>
28+
<% end %>
29+
<% end %>
30+
<% end %>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# frozen_string_literal: true
2+
3+
class AppConsentTableComponent < ViewComponent::Base
4+
def initialize(patient_session:, programme:)
5+
super
6+
7+
@patient_session = patient_session
8+
@programme = programme
9+
end
10+
11+
def render?
12+
consents.any?
13+
end
14+
15+
private
16+
17+
attr_reader :patient_session, :programme
18+
19+
delegate :patient, :session, to: :patient_session
20+
21+
def consents
22+
@consents ||=
23+
patient
24+
.consents
25+
.where(programme:)
26+
.includes(:consent_form, :parent)
27+
.order(created_at: :desc)
28+
end
29+
end

0 commit comments

Comments
 (0)