Sha256: 90b6e4993305b2d0af2939aca16b227c480d4145082053acb869e4b9fcdb265d

Contents?: true

Size: 1.92 KB

Versions: 26

Compression:

Stored size: 1.92 KB

Contents

module Renalware
  module PrescriptionsHelper
    def patient_prescriptions_path(patient, treatable = nil, params = {})
      treatable ||= patient
      super(patient, params.merge(treatable_type: treatable.class.to_s, treatable_id: treatable.id))
    end

    def new_patient_prescription_path(patient, treatable = nil)
      treatable ||= patient
      super(patient, treatable_type: treatable.class.to_s, treatable_id: treatable.id)
    end

    def patient_medications_prescription_termination_path(patient, prescription, treatable = nil)
      treatable ||= patient
      super(patient, prescription, treatable_type: treatable.class.to_s, treatable_id: treatable.id)
    end

    def new_patient_medications_prescription_termination_path(patient,
                                                              prescription,
                                                              treatable = nil)
      treatable ||= patient
      super(patient, prescription, treatable_type: treatable.class.to_s, treatable_id: treatable.id)
    end

    def highlight_validation_fail(med_object, med_attribute)
      return unless med_object.errors.include?(med_attribute)

      "field_with_errors"
    end

    def validation_fail(prescription)
      prescription.errors.any? ? "show-form" : "content"
    end

    def default_provider(provider)
      provider == "gp" ? "checked" : nil
    end

    def medication_and_route(med_route)
      if med_route.blank?
        "No medication prescribed"
      else
        other_route = "Route: Other (Please specify in notes)"
        safe_join(
          med_route.map do |m|
            route = if m.medication_route.name == other_route
                      m.medication_route.full_name
                    else
                      m.medication_route.name
                    end
            "<li>
                #{m.drug.name} - #{route}
            </li>".html_safe
          end
        )
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
renalware-core-2.0.16 app/helpers/renalware/prescriptions_helper.rb
renalware-core-2.0.15 app/helpers/renalware/prescriptions_helper.rb
renalware-core-2.0.14 app/helpers/renalware/prescriptions_helper.rb
renalware-core-2.0.13 app/helpers/renalware/prescriptions_helper.rb
renalware-core-2.0.12 app/helpers/renalware/prescriptions_helper.rb
renalware-core-2.0.11 app/helpers/renalware/prescriptions_helper.rb
renalware-core-2.0.9 app/helpers/renalware/prescriptions_helper.rb
renalware-core-2.0.8 app/helpers/renalware/prescriptions_helper.rb
renalware-core-2.0.7 app/helpers/renalware/prescriptions_helper.rb
renalware-core-2.0.5 app/helpers/renalware/prescriptions_helper.rb
renalware-core-2.0.4 app/helpers/renalware/prescriptions_helper.rb
renalware-core-2.0.3 app/helpers/renalware/prescriptions_helper.rb
renalware-core-2.0.2 app/helpers/renalware/prescriptions_helper.rb
renalware-core-2.0.1 app/helpers/renalware/prescriptions_helper.rb
renalware-core-2.0.0 app/helpers/renalware/prescriptions_helper.rb
renalware-core-2.0.0.pre.rc13 app/helpers/renalware/prescriptions_helper.rb
renalware-core-2.0.0.pre.rc11 app/helpers/renalware/prescriptions_helper.rb
renalware-core-2.0.0.pre.rc10 app/helpers/renalware/prescriptions_helper.rb
renalware-core-2.0.0.pre.rc9 app/helpers/renalware/prescriptions_helper.rb
renalware-core-2.0.0.pre.rc8 app/helpers/renalware/prescriptions_helper.rb