Class: ODDB::View::Admin::SequenceForm

Inherits:
HtmlGrid::Composite show all
Includes:
HtmlGrid::ErrorMessage, HtmlGrid::InfoMessage, ODDB::View::AdditionalInformation, SequenceDisplay, FormMethods
Defined in:
src/view/admin/sequence.rb

Direct Known Subclasses

ResellerSequenceForm

Constant Summary

COMPONENTS =
{
  [0,0]   => :iksnr,
  [2,0]   => :seqnr,
  [0,1]   => :name_base,
  [2,1]   => :name_descr,
  [0,2]   => :longevity,
  [2,2]   => :export_flag,
  [0,3]   => :atc_class,
  [2,3]   => :atc_descr,
  [0,4]   => :sequence_date,
}
COMPONENT_CSS_MAP =
{
  [1,0,1,5] =>  'standard',
  [3,0,1,2] =>  'standard',
  [3,3]     =>  'standard',
}
CSS_MAP =
{
  [0,0,4,5] =>  'list',
}
LABELS =
true
LOOKANDFEEL_MAP =
{
  :language_select => :language_select_html,
}
SYMBOL_MAP =
{
  :export_flag        => HtmlGrid::InputCheckbox,
  :iksnr              => HtmlGrid::Value,
  :html_upload        => HtmlGrid::InputFile,
  :patinfo_label      => HtmlGrid::LabelText,
  :atc_request_label  => HtmlGrid::LabelText,
  :no_company         => HtmlGrid::LabelText,
  :regulatory_email   => HtmlGrid::InputText,
  :activate_patinfo   => HtmlGrid::InputDate,
  :deactivate_patinfo => HtmlGrid::InputDate,
  :sequence_date      => HtmlGrid::InputDate,
}

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 included from ODDB::View::AdditionalInformation

#_fachinfo, #atc_ddd_link, #atc_description, #comarketing, #complementary_type, #compositions, #ddd_price, #deductible, #fachinfo, #feedback, #google_search, #ikscat, #limitation_link, #limitation_text, #minifi, #narcotic, #notify, #patent, #qty_unit, #square, #twitter_share

Methods included from PartSize

#comparable_size, #part_size

Methods included from Drugs::AtcDddLink

#atc_ddd_link

Methods included from SequenceDisplay

#atc_class, #atc_request

Methods inherited from HtmlGrid::Composite

event_link, #hash_insert_col, #hash_insert_row

Instance Method Details

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



410
411
412
413
414
415
416
417
418
419
420
# File 'src/view/admin/sequence.rb', line 410

def assign_patinfo(model, session=@session)
  link = HtmlGrid::Link.new(:assign_patinfo, model, session, self)
  link.href = @lookandfeel.event_url(:assign_patinfo)
  if(@model.has_patinfo?)
    link.value = @lookandfeel.lookup(:assign_this_patinfo)
  else
    link.value = @lookandfeel.lookup(:assign_other_patinfo)
  end
  link.set_attribute('class', 'small')
  link
end

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



421
422
423
424
425
426
427
# File 'src/view/admin/sequence.rb', line 421

def atc_descr(model, session=@session)
  if(atc_descr_error?)
    HtmlGrid::InputText.new(:atc_descr, model, session, self)
  else
    super
  end
end

- (Boolean) atc_descr_error?

Returns:

  • (Boolean)


428
429
430
431
432
433
# File 'src/view/admin/sequence.rb', line 428

def atc_descr_error?
  ((err = @session.error(:atc_class)) \
   && err.message == "e_unknown_atc_class") \
   || ((atc = @model.atc_class) \
       && atc.description.empty?)
end

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



434
435
436
# File 'src/view/admin/sequence.rb', line 434

def delete_item(model, session=@session)
  delete_item_warn(model, :w_delete_sequence)
end

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



437
438
439
440
441
442
443
444
445
# File 'src/view/admin/sequence.rb', line 437

def delete_patinfo(model, session=@session)
  if(model.has_patinfo?)
    button = HtmlGrid::Button.new(:delete_patinfo, 
                                  model, session, self)
    script = "this.form.patinfo.value = 'delete'; this.form.submit();"
    button.set_attribute('onclick', script)
    button
  end
end

- (Object) init



368
369
370
371
372
373
# File 'src/view/admin/sequence.rb', line 368

def init
  reorganize_components
  super
  error_message()
  info_message()
end

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



446
447
448
449
450
451
# File 'src/view/admin/sequence.rb', line 446

def language_select(model, session=@session)
  sel = View::Admin::FachinfoLanguageSelect.new(:language_select, model, 
    session, self)
  #sel.label = false
  sel
end

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



460
461
462
463
464
465
466
# File 'src/view/admin/sequence.rb', line 460

def patinfo(model, session=@session)
  if(link = super)
    pos = components.index(:patinfo)
    link.set_attribute('class', 'square infos')
    link
  end
end

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



477
478
479
# File 'src/view/admin/sequence.rb', line 477

def patinfo_label(model, session=@session)
  HtmlGrid::LabelText.new(:patinfo, model, session , self)
end

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



480
481
482
483
484
485
486
# File 'src/view/admin/sequence.rb', line 480

def patinfo_upload(model, session=@session)
  if(model.company.invoiceable?)
    HtmlGrid::InputFile.new(:patinfo_upload, model, @session, self)
  else
    PointerLink.new(:e_company_not_invoiceable, model.company, @session, self)
  end
end


467
468
469
470
471
472
473
474
475
476
# File 'src/view/admin/sequence.rb', line 467

def profile_link(model, session=@session)
  if(comp = model.company)
    link = HtmlGrid::Link.new(:company_link, model, session, self)  
    args = { :pointer  => comp.pointer }
    link.href = @lookandfeel._event_url(:resolve, args)
    link.set_attribute('class', 'small')
    link.label = false
    link  
  end
end

- (Object) reorganize_components



374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
# File 'src/view/admin/sequence.rb', line 374

def reorganize_components
  if(@model.is_a?(ODDB::Sequence))
    components.update({
      [0,5]   => :html_upload,
      [2,5]   => :language_select,
      [0,6]   => :patinfo_upload,
      [2,6]   =>  :patinfo_label,
      [3,6,1] =>  :patinfo,
      [3,6,2] =>  :assign_patinfo,
      [3,6,3] =>  :delete_patinfo,
      [0,7]   =>  :activate_patinfo,
      [2,7]   =>  :deactivate_patinfo,
      [1,8,0] =>  :submit,
      [1,8,1] =>  :delete_item,
    })
    css_map.update({
      [0,5,4,4] =>  'list',
      [0,6,5]   =>  'list',
    })
    if(@model.atc_class.nil? && !atc_descr_error?)
      if(@model.company.nil?)
        components.store([5,3], :atc_request_label)
        components.store([3,3], :no_company)
      else
        if(@model.company.regulatory_email.to_s.empty?)
          components.store([2,3], :regulatory_email)
        else
          components.store([2,3], :atc_request_label)
          components.store([3,3], :atc_request)
        end
      end
    end
  else
    components.store([1,5], :submit)
  end
end

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



452
453
454
455
456
457
458
459
# File 'src/view/admin/sequence.rb', line 452

def seqnr(model, session=@session)
  klass = if(model.seqnr.nil?)
            HtmlGrid::InputText
          else
            HtmlGrid::Value
          end
  klass.new(:seqnr, model, session, self)
end