Module: Renalware::HospitalsHelper

Defined in:
app/helpers/renalware/hospitals_helper.rb

Instance Method Summary collapse

Instance Method Details

#ward_dropdown_grouped_by_hospital_unit(form, attribute, **options) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/helpers/renalware/hospitals_helper.rb', line 5

def ward_dropdown_grouped_by_hospital_unit(form, attribute, **options)
  form.input(
    attribute.to_sym,
    as: :grouped_select,
    group_method: :wards,
    collection: Renalware::Hospitals::WardPresenter.units_with_wards,
    label_method: lambda { |ward|
      Renalware::Hospitals::WardPresenter.new(ward).title_including_unit
    },
    wrapper: :horizontal_medium,
    input_html: { class: "searchable_select" },
    **options
  )
end

#ward_title(ward) ⇒ Object



20
21
22
23
# File 'app/helpers/renalware/hospitals_helper.rb', line 20

def ward_title(ward)
  ward_label = ward.name.blank? ? ward.code : "#{ward.name} (#{ward.code})"
  "#{ward.hospital_unit.unit_code} / #{ward_label}"
end