Class: Renalware::HD::AdministerPrescriptionDropdownComponent

Inherits:
ApplicationComponent
  • Object
show all
Includes:
PresenterHelper, DropdownButtonHelper
Defined in:
app/components/renalware/hd/administer_prescription_dropdown_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from PresenterHelper

#present

Methods included from DropdownButtonHelper

#dropdown_btn_item

Methods inherited from ApplicationComponent

#policy, #renalware

Constructor Details

#initialize(patient:) ⇒ AdministerPrescriptionDropdownComponent

Returns a new instance of AdministerPrescriptionDropdownComponent.



10
11
12
# File 'app/components/renalware/hd/administer_prescription_dropdown_component.rb', line 10

def initialize(patient:)
  @patient = patient
end

Instance Attribute Details

#patientObject (readonly)

Returns the value of attribute patient.



8
9
10
# File 'app/components/renalware/hd/administer_prescription_dropdown_component.rb', line 8

def patient
  @patient
end

Instance Method Details

#prescriptions_to_give_on_hdObject



14
15
16
17
18
19
# File 'app/components/renalware/hd/administer_prescription_dropdown_component.rb', line 14

def prescriptions_to_give_on_hd
  @prescriptions_to_give_on_hd ||= begin
    prescriptions = patient.prescriptions.includes([:drug]).to_be_administered_on_hd
    present(prescriptions, Medications::PrescriptionPresenter)
  end
end