Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions app/components/app_patient_search_form_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,14 @@ class AppPatientSearchFormComponent < ViewComponent::Base
link_errors: true,
label: { text: "Children missing an NHS number" } %>

<%= f.govuk_check_box :aged_out_of_programmes,
1, 0,
checked: form.aged_out_of_programmes,
multiple: false,
link_errors: true,
label: { text: "Children aged out of programmes" } %>
<% if show_aged_out_of_programmes %>
<%= f.govuk_check_box :aged_out_of_programmes,
1, 0,
checked: form.aged_out_of_programmes,
multiple: false,
link_errors: true,
label: { text: "Children aged out of programmes" } %>
<% end %>
<% end %>

<% if show_buttons_in_details? %>
Expand Down Expand Up @@ -195,7 +197,8 @@ def initialize(
triage_statuses: [],
vaccine_methods: [],
year_groups: [],
heading_level: 3
heading_level: 3,
show_aged_out_of_programmes: false
)
super

Expand All @@ -211,6 +214,7 @@ def initialize(
@vaccine_methods = vaccine_methods
@year_groups = year_groups
@heading_level = heading_level
@show_aged_out_of_programmes = show_aged_out_of_programmes
end

private
Expand All @@ -225,7 +229,8 @@ def initialize(
:triage_statuses,
:vaccine_methods,
:year_groups,
:heading_level
:heading_level,
:show_aged_out_of_programmes

def open_details?
@form.date_of_birth_year.present? || @form.date_of_birth_month.present? ||
Expand Down
7 changes: 6 additions & 1 deletion app/views/consent_forms/search.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@
</div>

<div class="nhsuk-grid-column-two-thirds">
<%= render AppPatientSearchFormComponent.new(@form, url: search_consent_form_path(@consent_form), heading_level: 2) %>
<%= render AppPatientSearchFormComponent.new(
@form,
url: search_consent_form_path(@consent_form),
heading_level: 2,
show_aged_out_of_programmes: true,
) %>

<%= render AppSearchResultsComponent.new(@pagy, label: "children") do %>
<% @patients.each do |patient| %>
Expand Down
7 changes: 6 additions & 1 deletion app/views/patients/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<%= h1 t(".title"), size: "xl" %>

<%= render AppPatientSearchFormComponent.new(@form, url: patients_path, heading_level: 2) %>
<%= render AppPatientSearchFormComponent.new(
@form,
url: patients_path,
heading_level: 2,
show_aged_out_of_programmes: true,
) %>

<% if @patients.any? %>
<%= render AppPatientTableComponent.new(@patients, current_user:, count: @pagy.count) %>
Expand Down