Class: ODDB::Html::View::Drugs::Ajax::ExplainDddPrice

Inherits:
HtmlGrid::Composite
  • Object
show all
Includes:
PackageMethods
Defined in:
lib/oddb/html/view/drugs/ajax/explain_ddd_price.rb

Constant Summary collapse

COMPONENTS =
{
  [0,0] =>  :administration,
  [2,0] =>  :comment,
  [0,1]	=>	:ddd,
  [2,1]	=>	:price_public,
  [0,2]	=>	:dose,
  [2,2]	=>	:package_size,
  [0,3]	=>	:ddd_price_calculation,
}
COLSPAN_MAP =
{
	[1,3]	=>	3,
}
CSS_MAP =
{
  [0,0,4,4] => 'calculation',
}
LABELS =
true
LEGACY_INTERFACE =
false

Class Method Summary collapse

Instance Method Summary collapse

Methods included from PackageMethods

#active_agents, #adjust_price, #code_boolean, #code_festbetragsgruppe, #code_festbetragsstufe, #code_prescription, #code_registration, #code_zuzahlungsbefreit, #ddd_prices, #fachinfo_link, #feedback, #patinfo_link, #price_difference, #price_exfactory, #price_festbetrag, #price_public, #price_zuzahlung, #product, #product_local, #product_remote, #row_css, #size

Class Method Details

.data(*keys) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/oddb/html/view/drugs/ajax/explain_ddd_price.rb', line 32

def data(*keys)
  keys.each { |key|
    define_method(key) { |model|
      value key, self.send("_#{key}", model)
    }
  }
end

Instance Method Details

#_comment(model) ⇒ Object



46
47
48
# File 'lib/oddb/html/view/drugs/ajax/explain_ddd_price.rb', line 46

def _comment(model)
  model[:ddd].comment
end

#_ddd(model) ⇒ Object



49
50
51
# File 'lib/oddb/html/view/drugs/ajax/explain_ddd_price.rb', line 49

def _ddd(model)
  model[:ddd].dose
end

#_ddd_price(model) ⇒ Object



52
53
54
# File 'lib/oddb/html/view/drugs/ajax/explain_ddd_price.rb', line 52

def _ddd_price(model)
  adjust_price model[:package].dose_price(model[:ddd].dose)
end

#_dose(model) ⇒ Object



65
66
67
# File 'lib/oddb/html/view/drugs/ajax/explain_ddd_price.rb', line 65

def _dose(model)
  model[:package].doses.first
end

#_package_size(model) ⇒ Object



74
75
76
# File 'lib/oddb/html/view/drugs/ajax/explain_ddd_price.rb', line 74

def _package_size(model)
  size(model[:package])
end

#_price_public(model) ⇒ Object



68
69
70
# File 'lib/oddb/html/view/drugs/ajax/explain_ddd_price.rb', line 68

def _price_public(model)
  adjust_price model[:package].price(:public)
end

#administration(model) ⇒ Object



41
42
43
44
45
# File 'lib/oddb/html/view/drugs/ajax/explain_ddd_price.rb', line 41

def administration(model)
  adm = model[:ddd].administration
  value(:administration, 
        @lookandfeel.lookup("administration_#{adm}") { adm })
end

#ddd_price_calculation(model) ⇒ Object



55
56
57
58
59
60
61
62
63
64
# File 'lib/oddb/html/view/drugs/ajax/explain_ddd_price.rb', line 55

def ddd_price_calculation(model)
  comp = HtmlGrid::Value.new(:ddd_price_calculation, 
                             model, @session, self)
  comp.value = @lookandfeel.lookup(:ddd_price_calculation,
                                   _ddd(model), _dose(model), 
                                   _price_public(model), 
                                   _package_size(model), 
                                   _ddd_price(model))
  comp
end

#package_size(model) ⇒ Object



71
72
73
# File 'lib/oddb/html/view/drugs/ajax/explain_ddd_price.rb', line 71

def package_size(model)
  value :size, _package_size(model)
end

#value(key, value) ⇒ Object



77
78
79
80
81
# File 'lib/oddb/html/view/drugs/ajax/explain_ddd_price.rb', line 77

def value(key, value)
  val = HtmlGrid::Value.new(key, @model, @session, self)
  val.value = value
  val
end