Module: Renalware::DrugsHelper

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

Instance Method Summary collapse

Instance Method Details

#drug_select_optionsObject



5
6
7
8
9
10
11
12
# File 'app/helpers/renalware/drugs_helper.rb', line 5

def drug_select_options
  options_for_select(
    Drugs::Type
      .all
      .reject { |dt| dt.name == "Peritonitis" }
      .map { |dt| [dt.name, dt.name.downcase] }
  )
end

#drug_types_colour_tag(drug_types) ⇒ Object



14
15
16
17
18
19
20
# File 'app/helpers/renalware/drugs_helper.rb', line 14

def drug_types_colour_tag(drug_types)
  drug_names = drug_types.map(&:name)
  return "esa" if drug_names.include?("ESA")
  return "immunosuppressant" if drug_names.include?("Immunosuppressant")

  "other"
end

#drug_types_tag(drug_type) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'app/helpers/renalware/drugs_helper.rb', line 22

def drug_types_tag(drug_type)
  if drug_type.map(&:name).include?("ESA")
    "ESA"
  elsif drug_type.map(&:name).include?("Immunosuppressant")
    "Immunosuppressant"
  else
    "Standard"
  end
end