Skip to content

Commit 9883eac

Browse files
authored
Merge pull request #4206 from nhsuk/next
Version 2.15
2 parents 4ef2935 + 8eabac5 commit 9883eac

File tree

189 files changed

+3150
-670
lines changed

Some content is hidden

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

189 files changed

+3150
-670
lines changed

Gemfile.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ GEM
101101
public_suffix (>= 2.0.2, < 7.0)
102102
aes_key_wrap (1.1.0)
103103
amazing_print (1.8.1)
104-
annotaterb (4.17.0)
104+
annotaterb (4.18.0)
105105
activerecord (>= 6.0.0)
106106
activesupport (>= 6.0.0)
107107
array_enum (1.6.0)
@@ -113,8 +113,8 @@ GEM
113113
ast (2.4.3)
114114
attr_required (1.0.2)
115115
aws-eventstream (1.4.0)
116-
aws-partitions (1.1141.0)
117-
aws-sdk-accessanalyzer (1.75.0)
116+
aws-partitions (1.1143.0)
117+
aws-sdk-accessanalyzer (1.76.0)
118118
aws-sdk-core (~> 3, >= 3.228.0)
119119
aws-sigv4 (~> 1.5)
120120
aws-sdk-core (3.229.0)
@@ -125,7 +125,7 @@ GEM
125125
bigdecimal
126126
jmespath (~> 1, >= 1.6.1)
127127
logger
128-
aws-sdk-ec2 (1.545.0)
128+
aws-sdk-ec2 (1.546.0)
129129
aws-sdk-core (~> 3, >= 3.228.0)
130130
aws-sigv4 (~> 1.5)
131131
aws-sdk-ecr (1.108.0)
@@ -137,10 +137,10 @@ GEM
137137
aws-sdk-kms (1.110.0)
138138
aws-sdk-core (~> 3, >= 3.228.0)
139139
aws-sigv4 (~> 1.5)
140-
aws-sdk-rds (1.286.0)
140+
aws-sdk-rds (1.287.0)
141141
aws-sdk-core (~> 3, >= 3.228.0)
142142
aws-sigv4 (~> 1.5)
143-
aws-sdk-s3 (1.196.0)
143+
aws-sdk-s3 (1.196.1)
144144
aws-sdk-core (~> 3, >= 3.228.0)
145145
aws-sdk-kms (~> 1)
146146
aws-sigv4 (~> 1.5)
@@ -270,7 +270,7 @@ GEM
270270
raabro (~> 1.4)
271271
globalid (1.2.1)
272272
activesupport (>= 6.1)
273-
good_job (4.11.1)
273+
good_job (4.11.2)
274274
activejob (>= 6.1.0)
275275
activerecord (>= 6.1.0)
276276
concurrent-ruby (>= 1.3.1)
@@ -664,8 +664,8 @@ GEM
664664
syntax_tree (>= 2.0.1)
665665
temple (0.10.0)
666666
thor (1.4.0)
667-
thruster (0.1.14-arm64-darwin)
668-
thruster (0.1.14-x86_64-linux)
667+
thruster (0.1.15-arm64-darwin)
668+
thruster (0.1.15-x86_64-linux)
669669
tilt (2.6.0)
670670
timeout (0.4.3)
671671
turbo-rails (2.0.16)

app/assets/stylesheets/components/_status.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@
88
gap: nhsuk-spacing(1);
99

1010
.nhsuk-icon {
11+
flex-shrink: 0;
12+
height: 1.5em;
1113
margin-left: nhsuk-spacing(-1);
1214
margin-top: nhsuk-spacing(-1);
15+
width: 1.5em;
1316
}
1417

1518
&--aqua-green {

app/components/app_activity_log_component.rb

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class AppActivityLogComponent < ViewComponent::Base
1414
<% end %>
1515
ERB
1616

17-
def initialize(patient: nil, patient_session: nil)
17+
def initialize(team:, patient: nil, patient_session: nil)
1818
super
1919

2020
if patient.nil? && patient_session.nil?
@@ -63,14 +63,17 @@ def initialize(patient: nil, patient_session: nil)
6363
)
6464

6565
@patient_specific_directions = @patient.patient_specific_directions
66+
67+
@archive_reasons = @patient.archive_reasons.where(team:)
6668
end
6769

68-
attr_reader :patient,
69-
:patient_sessions,
70+
attr_reader :archive_reasons,
7071
:consents,
7172
:gillick_assessments,
7273
:notes,
7374
:notify_log_entries,
75+
:patient,
76+
:patient_sessions,
7477
:pre_screenings,
7578
:session_attendances,
7679
:triages,
@@ -83,6 +86,7 @@ def events_by_day
8386

8487
def all_events
8588
[
89+
archive_events,
8690
attendance_events,
8791
consent_events,
8892
gillick_assessment_events,
@@ -96,6 +100,17 @@ def all_events
96100
].flatten
97101
end
98102

103+
def archive_events
104+
archive_reasons.flat_map do |archive_reason|
105+
{
106+
title: "Record archived: #{archive_reason.human_enum_name(:type)}",
107+
body: archive_reason.other_details,
108+
at: archive_reason.created_at,
109+
by: archive_reason.created_by
110+
}
111+
end
112+
end
113+
99114
def consent_events
100115
consents.flat_map do |consent|
101116
events = []

app/components/app_child_summary_component.rb

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
# frozen_string_literal: true
22

33
class AppChildSummaryComponent < ViewComponent::Base
4-
def initialize(child, show_parents: false, change_links: {}, remove_links: {})
4+
def initialize(
5+
child,
6+
current_team: nil,
7+
show_parents: false,
8+
show_school_and_year_group: true,
9+
change_links: {},
10+
remove_links: {}
11+
)
512
super
613

714
@child = child
15+
@current_team = current_team
816
@show_parents = show_parents
17+
@show_school_and_year_group = show_school_and_year_group
918
@change_links = change_links
1019
@remove_links = remove_links
1120
end
@@ -25,6 +34,14 @@ def call
2534
)
2635
end
2736
end
37+
38+
if archive_reason
39+
summary_list.with_row do |row|
40+
row.with_key { "Archive reason" }
41+
row.with_value { format_archive_reason }
42+
end
43+
end
44+
2845
summary_list.with_row do |row|
2946
row.with_key { "Full name" }
3047
row.with_value { format_full_name }
@@ -57,14 +74,16 @@ def call
5774
row.with_value { format_address }
5875
end
5976
end
60-
summary_list.with_row do |row|
61-
row.with_key { "School" }
62-
row.with_value { format_school }
63-
end
64-
if @child.respond_to?(:year_group)
77+
if @show_school_and_year_group
6578
summary_list.with_row do |row|
66-
row.with_key { "Year group" }
67-
row.with_value { format_year_group }
79+
row.with_key { "School" }
80+
row.with_value { format_school }
81+
end
82+
if @child.respond_to?(:year_group)
83+
summary_list.with_row do |row|
84+
row.with_key { "Year group" }
85+
row.with_value { format_year_group }
86+
end
6887
end
6988
end
7089
if (gp_practice = @child.try(:gp_practice))
@@ -112,10 +131,27 @@ def call
112131

113132
def academic_year = AcademicYear.current
114133

134+
def archive_reason
135+
@archive_reason ||=
136+
if @current_team
137+
ArchiveReason.find_by(team: @current_team, patient: @child)
138+
end
139+
end
140+
115141
def format_nhs_number
116142
highlight_if(helpers.patient_nhs_number(@child), @child.nhs_number_changed?)
117143
end
118144

145+
def format_archive_reason
146+
type_string = archive_reason.human_enum_name(:type)
147+
148+
if archive_reason.other?
149+
"#{type_string}: #{archive_reason.other_details}"
150+
else
151+
type_string
152+
end
153+
end
154+
119155
def format_full_name
120156
highlight_if(
121157
@child.full_name,

app/components/app_consent_summary_component.rb

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,22 @@ def call
5454
end
5555
end
5656

57+
unless consent.notify_parents_on_vaccination.nil?
58+
summary_list.with_row do |row|
59+
row.with_key { "Confirmation of vaccination sent to parent?" }
60+
row.with_value do
61+
consent.notify_parents_on_vaccination ? "Yes" : "No"
62+
end
63+
if (href = change_links[:notify_parents_on_vaccination])
64+
row.with_action(
65+
text: "Change",
66+
visually_hidden_text: "decision",
67+
href:
68+
)
69+
end
70+
end
71+
end
72+
5773
if consent.reason_for_refusal.present?
5874
summary_list.with_row do |row|
5975
row.with_key { "Reason for refusal" }
@@ -63,7 +79,7 @@ def call
6379

6480
unless consent.notify_parent_on_refusal.nil?
6581
summary_list.with_row do |row|
66-
row.with_key { "Confirmation of decision sent to parent" }
82+
row.with_key { "Confirmation of decision sent to parent?" }
6783
row.with_value { consent.notify_parent_on_refusal ? "Yes" : "No" }
6884
end
6985
end

app/components/app_notices_table_component.rb

Lines changed: 19 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,55 +4,39 @@ class AppNoticesTableComponent < ViewComponent::Base
44
def initialize(
55
deceased_patients:,
66
invalidated_patients:,
7-
restricted_patients:
7+
restricted_patients:,
8+
has_vaccination_records_dont_notify_parents_patients:
89
)
910
super
1011

1112
@deceased_patients = deceased_patients
1213
@invalidated_patients = invalidated_patients
1314
@restricted_patients = restricted_patients
15+
@has_vaccination_records_dont_notify_parents_patients =
16+
has_vaccination_records_dont_notify_parents_patients
1417
end
1518

1619
def render?
1720
@deceased_patients.present? || @invalidated_patients.present? ||
18-
@restricted_patients.present?
21+
@restricted_patients.present? ||
22+
@has_vaccination_records_dont_notify_parents_patients.present?
1923
end
2024

2125
private
2226

2327
def notices
24-
(deceased_notices + invalidated_notices + restricted_notices)
25-
.sort_by { _1[:date] }
26-
.reverse
27-
end
28-
29-
def deceased_notices
30-
@deceased_patients.map do |patient|
31-
{
32-
patient:,
33-
date_time: patient.date_of_death_recorded_at,
34-
message: "Record updated with child’s date of death"
35-
}
36-
end
37-
end
38-
39-
def invalidated_notices
40-
@invalidated_patients.map do |patient|
41-
{
42-
patient:,
43-
date_time: patient.invalidated_at,
44-
message: "Record flagged as invalid"
45-
}
46-
end
47-
end
48-
49-
def restricted_notices
50-
@restricted_patients.map do |patient|
51-
{
52-
patient:,
53-
date_time: patient.restricted_at,
54-
message: "Record flagged as sensitive"
55-
}
56-
end
28+
all_patients =
29+
(
30+
@deceased_patients + @invalidated_patients + @restricted_patients +
31+
@has_vaccination_records_dont_notify_parents_patients
32+
).uniq
33+
34+
notices =
35+
all_patients.flat_map do |patient|
36+
helpers
37+
.patient_important_notices(patient)
38+
.map { |notification| notification.merge(patient:) }
39+
end
40+
notices.sort_by { it[:date_time] }.reverse
5741
end
5842
end

app/components/app_patient_card_component.rb

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,47 @@ class AppPatientCardComponent < ViewComponent::Base
44
erb_template <<-ERB
55
<%= render AppCardComponent.new(heading_level:, section: true) do |card| %>
66
<% card.with_heading { "Child’s details" } %>
7-
8-
<% if patient.date_of_death.present? %>
9-
<%= render AppStatusComponent.new(
10-
text: "Record updated with child’s date of death"
11-
) %>
12-
<% end %>
13-
14-
<% if patient.invalidated? %>
15-
<%= render AppStatusComponent.new(
16-
text: "Record flagged as invalid"
17-
) %>
7+
8+
<% helpers.patient_important_notices(patient).each do |notification| %>
9+
<%= render AppStatusComponent.new(text: notification[:message]) %>
1810
<% end %>
1911
20-
<% if patient.restricted? %>
21-
<%= render AppStatusComponent.new(
22-
text: "Record flagged as sensitive"
23-
) %>
24-
<% end %>
25-
26-
<%= render AppChildSummaryComponent.new(patient, show_parents: true, change_links:, remove_links:) %>
12+
<%= render AppChildSummaryComponent.new(
13+
patient,
14+
current_team:,
15+
show_parents: true,
16+
show_school_and_year_group:,
17+
change_links:,
18+
remove_links:
19+
) %>
2720
2821
<%= content %>
2922
<% end %>
3023
ERB
3124

32-
def initialize(patient, change_links: {}, remove_links: {}, heading_level: 3)
25+
def initialize(
26+
patient,
27+
current_team:,
28+
change_links: {},
29+
remove_links: {},
30+
heading_level: 3
31+
)
3332
super
3433

3534
@patient = patient
35+
@current_team = current_team
3636
@change_links = change_links
3737
@remove_links = remove_links
3838
@heading_level = heading_level
3939
end
4040

4141
private
4242

43-
attr_reader :patient, :change_links, :remove_links, :heading_level
43+
attr_reader :patient,
44+
:current_team,
45+
:change_links,
46+
:remove_links,
47+
:heading_level
48+
49+
def show_school_and_year_group = patient.show_year_group?(team: current_team)
4450
end

0 commit comments

Comments
 (0)