Class: ODDB::View::Admin::RegistrationForm

Inherits:
Form
  • Object
show all
Includes:
HtmlGrid::ErrorMessage, HtmlGrid::InfoMessage, ODDB::View::AdditionalInformation, FachinfoPdfMethods
Defined in:
src/view/admin/registration.rb

Constant Summary

COMPONENTS =
{
  [0,0]   => :iksnr,
  [2,0]   => :registration_date,
  [0,1]   => :company_name,
  [2,1]   => :revision_date,
  [0,2]   => :generic_type,
  [2,2]   => :expiration_date,
  [4,2]   => :renewal_flag,
  [0,3,0] =>  :complementary_select,
  [0,3,1] =>  :complementary_type,
  [2,3]   => :market_date,
  [0,4]   => :index_therapeuticus,
  [2,4]   => :manual_inactive_date,
  [0,5]   => :ith_swissmedic,
  [2,5]   => :inactive_date,
  [0,6]   => :indication,
  [2,6]   => :patented_until,
  [0,7]   => :export_flag,
  [2,7]   =>  :ignore_patent,
  [3,7]   =>  :violates_patent,
  [0,8]   => :parallel_import,
  [2,8]   => :vaccine,
}
COMPONENT_CSS_MAP =
{
  [1,0,1,7] =>  'standard',
  [3,0,1,7] =>  'standard',
}
CSS_MAP =
{
  [0,0,6,9] =>  'list',
  [0,8]     =>  'list',
}
COLSPAN_MAP =
{ [3,6] => 3 }
DEFAULT_CLASS =
HtmlGrid::Value
LABELS =
true
SYMBOL_MAP =
{
  :activate_fachinfo  =>  HtmlGrid::InputDate,
  :deactivate_fachinfo=>  HtmlGrid::InputDate,
  :expiration_date    =>  HtmlGrid::InputDate,
  :export_flag        =>  HtmlGrid::InputCheckbox,
  :vaccine            =>  HtmlGrid::InputCheckbox,
  :fachinfo_label     =>  HtmlGrid::LabelText,
  :generic_type       => HtmlGrid::Select,
  :ignore_patent      =>  HtmlGrid::InputCheckbox,
  :inactive_date      => HtmlGrid::DateValue,
  :manual_inactive_date=> HtmlGrid::InputDate,
  :index_therapeuticus=>  HtmlGrid::InputText,
  :ith_swissmedic     =>  HtmlGrid::InputText,
  :market_date        =>  HtmlGrid::InputDate,
  :parallel_import    =>  HtmlGrid::InputCheckbox,
  :registration_date  => HtmlGrid::InputDate,
  :renewal_flag       => HtmlGrid::InputCheckbox,
  :revision_date      => HtmlGrid::InputDate,
  :textinfo_update    =>  HtmlGrid::InputCheckbox,
}

Constants included from FachinfoPdfMethods

TAG_METHOD

Constants included from FormMethods

ACCEPT_CHARSET, DEFAULT_CLASS, EVENT

Instance Method Summary (collapse)

Methods included from FachinfoPdfMethods

#assign_fachinfo, #fachinfo_upload, #language_select

Methods included from ODDB::View::AdditionalInformation

#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, #patinfo, #qty_unit, #square, #twitter_share

Methods included from PartSize

#comparable_size, #part_size

Methods included from Drugs::AtcDddLink

#atc_ddd_link

Methods included from FormMethods

#delete_item, #delete_item_warn, #get_event_button, #post_event_button

Instance Method Details

- (Object) _fachinfo(model, css = 'square infos')



266
267
268
269
270
271
272
273
274
275
276
# File 'src/view/admin/registration.rb', line 266

def _fachinfo(model, css='square infos')
  if(model.has_fachinfo?)
    link = HtmlGrid::Link.new(:square_fachinfo,
        model, @session, self)
    link.href = @lookandfeel._event_url(:fachinfo,
      {:swissmedicnr => model.iksnr})
    link.css_class = css
    link.set_attribute('title', @lookandfeel.lookup(:fachinfo))
    link
  end
end

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



255
256
257
258
259
260
261
262
# File 'src/view/admin/registration.rb', line 255

def company_name(model, session=@session)
  klass = if(session.user.allowed?('login', 'org.oddb.CompanyUser'))
    HtmlGrid::Value
  else
    HtmlGrid::InputText
  end
  klass.new(:company_name, model, session, self)
end

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



263
264
265
# File 'src/view/admin/registration.rb', line 263

def complementary_select(model, session=@session)
  HtmlGrid::Select.new(:complementary_type, model, @session, self)
end

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



277
278
279
280
281
282
283
284
# File 'src/view/admin/registration.rb', line 277

def iksnr(model, session=@session)
  klass = if model.is_a?(Persistence::CreateItem)
    HtmlGrid::InputText
  else
    HtmlGrid::Value
  end
  klass.new(:iksnr, model, session, self)
end

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



285
286
287
# File 'src/view/admin/registration.rb', line 285

def indication(model, session=@session)
  InputDescription.new(:indication, model.indication, session, self)
end

- (Object) init



219
220
221
222
223
224
# File 'src/view/admin/registration.rb', line 219

def init
  reorganize_components()
  super
  info_message()
  error_message()
end

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



288
289
290
# File 'src/view/admin/registration.rb', line 288

def new_registration(model, session=@session)
  get_event_button(:new_registration)
end

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



291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# File 'src/view/admin/registration.rb', line 291

def patented_until(model, session=@session)
  unless (model.is_a? Persistence::CreateItem)
    link = nil
    if((patent = model.patent) && (date = patent.expiry_date))
      link = HtmlGrid::Link.new(:patented_until, patent, @session, self)
      args = {'pointer' => patent.pointer}
      link.href = @lookandfeel._event_url(:resolve, args)
      link.value = @lookandfeel.format_date(date)
    else
      link = HtmlGrid::Link.new(:patented_until, nil, @session, self)
      args = {:pointer => model.pointer}
      link.href = @lookandfeel.event_url(:new_patent, args)
      link.value = @lookandfeel.lookup(:new_patent)
    end
    link.label = true
    link.set_attribute('class', 'list')
    link
  end
end

- (Object) reorganize_components



225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# File 'src/view/admin/registration.rb', line 225

def reorganize_components
  if(@model.is_a?(Persistence::CreateItem))
    components.store([1,9], :submit)
    css_map.store([1,9], 'list')
  else
    components.update({
      [0,9]   => 'fi_upload_instruction0',
      [2,9]   => :fachinfo_label,
      [3,9,0] =>  :fachinfo,
      [3,9,1] =>  :assign_fachinfo,
      [0,10]  => 'fi_upload_instruction1',
      [1,10]  => :language_select,
      [2,10]  => :textinfo_update,
      [0,11]  => 'fi_upload_instruction2',
      [1,11]  => :fachinfo_upload,
      [2,11]  =>  :activate_fachinfo,
      [0,12]  => 'fi_upload_instruction3',
      [1,12,0]=>  :submit,
      [1,12,1]=>  :new_registration,
      [2,12]  =>  :deactivate_fachinfo,
    })
    colspan_map.store([3,9], 3)
    colspan_map.store([0,9], 2)
    css_map.store([0,9], 'list bg bold')
    css_map.store([1,9], 'list bg')
    css_map.store([2,9,2,4], 'list')
    css_map.store([0,10,2,3], 'list bg')
    component_css_map.store [3,11,1,2], 'standard'
  end
end

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



310
311
312
313
314
315
# File 'src/view/admin/registration.rb', line 310

def violates_patent(model, session=@session)
  if model.ignore_patent? \
    || model.sequences.any? { |seqnr, seq| seq.violates_patent? }
    @lookandfeel.lookup(:violates_patent)
  end
end