@@ -6,7 +6,7 @@ class AppPatientCardComponent < ViewComponent::Base
66 <% card . with_heading ( level : heading_level ) { "Child’s details" } %>
77
88 <% important_notices . each do |notice | %>
9- <%= render AppStatusComponent . new ( text : notice ) %>
9+ <%= render AppStatusComponent . new ( text : notice [ :message ] ) %>
1010 <% end %>
1111
1212 <%= render AppChildSummaryComponent . new (
@@ -46,40 +46,5 @@ def initialize(
4646
4747 def show_school_and_year_group = patient . show_year_group? ( team : current_team )
4848
49- def important_notices
50- notices = patient . important_notices . where ( team_id : current_team . id )
51-
52- [
53- (
54- if patient . restricted?
55- notices . restricted . order ( recorded_at : :desc ) . first &.message
56- end
57- ) ,
58- (
59- if patient . invalidated?
60- notices . invalidated . order ( recorded_at : :desc ) . first &.message
61- end
62- ) ,
63- *notices . deceased . first &.message ,
64- *gillick_no_notify_notices
65- ] . compact
66- end
67-
68- def gillick_no_notify_notices
69- no_notify_vaccination_records =
70- patient . vaccination_records . select do
71- it . notify_parents == false && it . team == current_team
72- end
73-
74- if no_notify_vaccination_records . any?
75- vaccinations_sentence =
76- "#{ no_notify_vaccination_records . map ( &:programme ) . uniq . map ( &:name ) . to_sentence } " \
77- "#{ "vaccination" . pluralize ( no_notify_vaccination_records . length ) } "
78-
79- "Child gave consent for #{ vaccinations_sentence } under Gillick competence and " \
80- "does not want their parents to be notified. " \
81- "These records will not be automatically synced with GP records. " \
82- "Your team must let the child's GP know they were vaccinated."
83- end
84- end
49+ def important_notices = ImportantNotices . call ( patient :)
8550end
0 commit comments