|
3 | 3 | class AppChildSummaryComponent < ViewComponent::Base
|
4 | 4 | def initialize(
|
5 | 5 | child,
|
6 |
| - team: nil, |
| 6 | + current_team: nil, |
7 | 7 | show_parents: false,
|
| 8 | + show_school_and_year_group: true, |
8 | 9 | change_links: {},
|
9 | 10 | remove_links: {}
|
10 | 11 | )
|
11 | 12 | super
|
12 | 13 |
|
13 | 14 | @child = child
|
14 |
| - @team = team |
| 15 | + @current_team = current_team |
15 | 16 | @show_parents = show_parents
|
| 17 | + @show_school_and_year_group = show_school_and_year_group |
16 | 18 | @change_links = change_links
|
17 | 19 | @remove_links = remove_links
|
18 | 20 | end
|
@@ -72,14 +74,16 @@ def call
|
72 | 74 | row.with_value { format_address }
|
73 | 75 | end
|
74 | 76 | end
|
75 |
| - summary_list.with_row do |row| |
76 |
| - row.with_key { "School" } |
77 |
| - row.with_value { format_school } |
78 |
| - end |
79 |
| - if @child.respond_to?(:year_group) |
| 77 | + if @show_school_and_year_group |
80 | 78 | summary_list.with_row do |row|
|
81 |
| - row.with_key { "Year group" } |
82 |
| - 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 |
83 | 87 | end
|
84 | 88 | end
|
85 | 89 | if (gp_practice = @child.try(:gp_practice))
|
@@ -129,7 +133,9 @@ def academic_year = AcademicYear.current
|
129 | 133 |
|
130 | 134 | def archive_reason
|
131 | 135 | @archive_reason ||=
|
132 |
| - (ArchiveReason.find_by(team: @team, patient: @child) if @team) |
| 136 | + if @current_team |
| 137 | + ArchiveReason.find_by(team: @current_team, patient: @child) |
| 138 | + end |
133 | 139 | end
|
134 | 140 |
|
135 | 141 | def format_nhs_number
|
|
0 commit comments