Class: ODDB::Html::View::Drugs::Admin::PackageInnerForm

Inherits:
PackageInnerComposite show all
Includes:
HtmlGrid::ErrorMessage
Defined in:
lib/oddb/html/view/drugs/admin/package.rb

Constant Summary collapse

COMPONENTS =
{
  [0,0] => :name, 
  ## google's third parameter ensures that its link is written before 
  #  the name - this allows a float: right in css to work correctly
  [1,0,0] => :google,  
  [2,0] => :code_cid, 
  [0,1] => :company, 
  [2,1] => :atc,
  [0,2] => :price_exfactory, 
  [2,2] => :price_public,
  [2,3] => :price_festbetrag,
  [0,4] => :code_festbetragsstufe,
  [2,4] => :code_festbetragsgruppe,
  [0,5] => :code_zuzahlungsbefreit,
  [2,5] => :sequence,
  [0,6] => :code_prescription,
  [1,7,0] => :submit, 
  [1,7,1] => :delete, 
}
SYMBOL_MAP =
{
  :name   => HtmlGrid::InputText,
}

Constants inherited from PackageInnerComposite

PackageInnerComposite::CSS_MAP, PackageInnerComposite::DEFAULT_CLASS, PackageInnerComposite::LABELS, PackageInnerComposite::LEGACY_INTERFACE

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PackageInnerComposite

#atc, #code_cid, #code_festbetragsstufe, #company, #equivalence_factor

Methods included from Google

#google

Methods included from PackageMethods

#active_agents, #adjust_price, #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

.input_text(*keys) ⇒ Object



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/oddb/html/view/drugs/admin/package.rb', line 126

def input_text(*keys)
  keys.each { |key|
    define_method(key) { |model|
      input = HtmlGrid::InputText.new(key, model, @session, self)
      value = super model
      if(value.is_a? HtmlGrid::Component)
        input.value = value.value
      else
        input.value = value
      end
      if input.value.to_s.empty?
        input.value = @session.user_input key
      end
      input
    }
  }
end

Instance Method Details

#code_boolean(model, key) ⇒ Object



173
174
175
176
177
# File 'lib/oddb/html/view/drugs/admin/package.rb', line 173

def code_boolean(model, key)
  box = HtmlGrid::InputCheckbox.new("code_#{key}", model, @session, self)
  box.set_attribute('checked', (code = model.code(key)) && code.value)
  box
end

#delete(model) ⇒ Object



178
179
180
181
182
183
184
185
186
187
# File 'lib/oddb/html/view/drugs/admin/package.rb', line 178

def delete(model)
  button = HtmlGrid::Button.new(:delete, model, @session, self)
  script = "this.form.event.value = 'delete'; this.form.submit();" 
  if(model.saved?)
    confirm = @lookandfeel.lookup(:delete_package_confirm)
    script = "if(confirm('#{confirm}')) { #{script} };"
  end
  button.onclick = script
  button
end

#initObject



169
170
171
172
# File 'lib/oddb/html/view/drugs/admin/package.rb', line 169

def init
  super
  error_message
end

#sequence(model) ⇒ Object



188
189
190
# File 'lib/oddb/html/view/drugs/admin/package.rb', line 188

def sequence(model)
  SequenceSelect.new("sequence", model, @session, self)
end