Class: ODDB::View::Admin::PackageForm

Inherits:
HtmlGrid::Composite show all
Includes:
HtmlGrid::ErrorMessage, FormMethods
Defined in:
src/view/admin/package.rb

Constant Summary

COMPONENTS =
{
  [0,0]   => :iksnr,
  [2,0]   => :ikscd,
  [0,1]   => :descr,
  [2,1]   =>  :photo_link,
  [2,2]   => :pretty_dose,
  [0,3]   => :ikscat,
  [2,3]   => :sl_entry,
  [0,4]   => :price_exfactory,
  [2,4]   => :price_public,
  [0,5]   =>  :market_date,
  [2,5]   =>  :preview_with_market_date,
  [0,6]   =>  :deductible,
  [2,6]   =>  :lppv,
  [0,7]   =>  :out_of_trade,
  [0,8]   =>  :disable,
  [2,8]   =>  :pharmacode,
  [0,9]   =>  :generic_group,
  [0,10]  =>  :ddd_dose,
  [2,10]  =>  :disable_ddd_price,
  [1,11,0] => :submit,
  [1,11,1] => :delete_item,
}
COMPONENT_CSS_MAP =
{
  [0,0,4,1] =>  'standard',
  [0,2,4,4] =>  'standard',
  [3,1]     =>  'xxl',
  [3,3]     =>  'list',
  [3,8]     =>  'standard',
  [1,9]     =>  'standard',
  [1,10]    =>  'standard',
}
CSS_MAP =
{
  [0,0,4,12]  => 'list',
  [0,9]       =>  'list top',
}
LABELS =
true
LOOKANDFEEL_MAP =
{
  :descr  =>  :description,
}
SYMBOL_MAP =
{
  :deductible       => HtmlGrid::Select,
  :disable          =>  HtmlGrid::InputCheckbox,
  :disable_ddd_price=>  HtmlGrid::InputCheckbox,
  :price_exfactory  => HtmlGrid::InputCurrency,
  :price_public     =>  HtmlGrid::InputCurrency,
  :iksnr            =>  HtmlGrid::Value,
  :market_date      => HtmlGrid::InputDate,
  :out_of_trade     =>  HtmlGrid::BooleanValue,
  :preview_with_market_date =>  HtmlGrid::InputCheckbox,
  :refdata_override =>  HtmlGrid::InputCheckbox,
  :lppv             =>  HtmlGrid::Select,
}

Constants included from FormMethods

ACCEPT_CHARSET, DEFAULT_CLASS, EVENT

Instance Method Summary (collapse)

Methods included from FormMethods

#delete_item_warn, #get_event_button, #post_event_button

Methods inherited from HtmlGrid::Composite

event_link, #hash_insert_col, #hash_insert_row

Instance Method Details

- (Object) delete_item(model, session)

def commercial_form(model, session=@session)

    input = HtmlGrid::InputText.new(:commercial_form, 
                                    model, @session, self)
    if(comform = model.commercial_form)
      input.value = comform.send(@session.language)
    end
    input
  end


224
225
226
# File 'src/view/admin/package.rb', line 224

def delete_item(model, session)
  delete_item_warn(model, :w_delete_package)
end

- (Object) generic_group(model, session = @session)



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# File 'src/view/admin/package.rb', line 243

def generic_group(model, session=@session)
  input = HtmlGrid::Textarea.new(:generic_group, model, @session, self)
  my_factor = (model.generic_group_factor || 1).to_f
  if ggcs = model.generic_group_comparables
    input.value = ggcs.collect do |pac|
      str = pac.ikskey.to_s
      if (factor = pac.generic_group_factor) && (factor /= my_factor) != 1
        if factor.to_i == factor
          str << " (%ix)" % factor
        else
          str << " (%3.1fx)" % factor
        end
      end
      str
    end.sort.join(', ')
  end
  input.label = true
  input
end

- (Object) init



207
208
209
210
211
212
213
# File 'src/view/admin/package.rb', line 207

def init
  if(@model.out_of_trade)
    components.store([2,7], :refdata_override)
  end
  super
  error_message()
end

- (Object) sl_entry(model, session)



227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'src/view/admin/package.rb', line 227

def sl_entry(model, session)
  unless (model.is_a? Persistence::CreateItem)
    link = nil
    if (sl_entry = model.sl_entry)
      link = HtmlGrid::Link.new(:sl_modify, sl_entry, session, self)
      args = {'pointer' => sl_entry.pointer}
      link.href = @lookandfeel._event_url(:resolve, args)
    else
      link = HtmlGrid::Link.new(:sl_create, sl_entry, session, self)
      link.href = @lookandfeel.event_url(:new_item)
    end
    link.label = true
    link.set_attribute('class', 'list')
    link
  end
end