Class: ODDB::View::Ajax::SwissmedicCat

Inherits:
HtmlGrid::Composite show all
Defined in:
src/view/ajax/swissmedic_cat.rb

Constant Summary

COMPONENTS =
{}
LEGACY_INTERFACE =
false
DEFAULT_CLASS =
HtmlGrid::Value
SYMBOL_MAP =
{
  :registration_date  => HtmlGrid::DateValue,
  :sequence_date      => HtmlGrid::DateValue,
  :revision_date      => HtmlGrid::DateValue,
  :expiration_date    =>  HtmlGrid::DateValue,
  :market_date        =>  HtmlGrid::DateValue,
  :out_of_trade       =>  HtmlGrid::BooleanValue,
}

Instance Method Summary (collapse)

Methods inherited from HtmlGrid::Composite

event_link, #hash_insert_col, #hash_insert_row

Instance Method Details

- (Object) deductible(model)



112
113
114
115
116
117
118
# File 'src/view/ajax/swissmedic_cat.rb', line 112

def deductible(model)
  link = HtmlGrid::Link.new(:deductible, model, @session, self)
  link.value = @lookandfeel.lookup(deductible_value(model))
  link.href = @lookandfeel.lookup(:explain_deductible_url)
  link.css_class = 'list'
  link
end

- (Object) deductible_label(model)



119
120
121
122
123
# File 'src/view/ajax/swissmedic_cat.rb', line 119

def deductible_label(model)
  link = HtmlGrid::Link.new(:deductible, model, @session, self)
  link.href = @lookandfeel.lookup(:deductible_legal_url)
  link
end

- (Object) deductible_value(model)



124
125
126
127
128
129
130
# File 'src/view/ajax/swissmedic_cat.rb', line 124

def deductible_value(model)
  if(@lookandfeel.enabled?(:just_medical_structure, false))
    model.deductible_m
  else
    model.deductible
  end
end

- (Object) init



23
24
25
26
27
28
# File 'src/view/ajax/swissmedic_cat.rb', line 23

def init
  @components = {}
  @css_map = {}
  reorganize_components if(@model)
  super
end

- (Object) lppv_ajax(model)



131
132
133
134
135
136
# File 'src/view/ajax/swissmedic_cat.rb', line 131

def lppv_ajax(model)
  link = HtmlGrid::Link.new(:lppv_ajax, model, @session, self)
  link.href = @lookandfeel.lookup(:lppv_url)
  link.css_class = 'list'
  link
end

- (Object) patent_protected(model)



137
138
139
140
141
142
143
144
145
146
147
148
# File 'src/view/ajax/swissmedic_cat.rb', line 137

def patent_protected(model)
  patent = model.patent
  date = nil
  if(cn = patent.certificate_number)
    date = HtmlGrid::Link.new(:patent_protected, patent, @session, self)
    date.href = @lookandfeel.lookup(:swissreg_url, cn)
  else
    date = HtmlGrid::Value.new(:patent_protected, patent, @session, self)
  end
  date.value = @lookandfeel.format_date(patent.expiry_date)
  date
end

- (Object) reorganize_components



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'src/view/ajax/swissmedic_cat.rb', line 29

def reorganize_components
  y=0
  if(cat = @model.ikscat)
    iks = "ikscat_" << cat.to_s.downcase
    @components.store([0,y], :ikscat)
    @components.store([1,y], iks)
    y += 1
  end
  if(sl = @model.sl_entry)
    @components.store([0,y], "sl")
    @components.store([1,y,0], "sl_list")
    if(date = sl.introduction_date)
      @components.store([1,y,1], :sl_since)
    end
    y += 1
  end
  if(gt = @model.sl_generic_type)
    @components.store([0,y], "sl_#{gt}_short")
    @components.store([1,y], "sl_#{gt}")
    y += 1
  end
  if(@lookandfeel.result_list_components.has_value?(:deductible) \
     && deductible_value(@model))
    @components.store([0,y], :deductible_label)
    @components.store([1,y], :deductible)
    y += 1
  end
  if(@model.lppv)
    @components.store([0,y], "lppv")
    @components.store([1,y], :lppv_ajax)
    y += 1
  end
  if(@model.registration_date)
    @components.store([0,y], "registration_date")
    @components.store([1,y], :registration_date)
    y += 1
  end
  if(@model.sequence_date)
    @components.store([0,y], "sequence_date")
    @components.store([1,y], :sequence_date)
    y += 1
  end
  if(@model.revision_date)
    @components.store([0,y], "revision_date")
    @components.store([1,y], :revision_date)
    y += 1
  end
  if(@model.expiration_date)
    @components.store([0,y], "expiration_date")
    @components.store([1,y], :expiration_date)
    y += 1
  end
  if(@model.index_therapeuticus)
    @components.store([0,y], "index_therapeuticus")
    @components.store([1,y], :index_therapeuticus)
    y += 1
  end
  if(@model.ith_swissmedic)
    @components.store([0,y], "ith_swissmedic")
    @components.store([1,y], :ith_swissmedic)
    y += 1
  end
  @components.store([0,y], "refdata")
  @components.store([1,y], :out_of_trade)
  y += 1
  if(@model.production_science)
    @components.store([0,y], "production_science")
    @components.store([1,y], :production_science)
    y += 1
  end
  if(@model.preview?)
    @components.store([0,y], "market_date_preview")
    @components.store([1,y], :market_date)
    y += 1
  end
  if(@model.patent)
    @components.store([0,y], "patented_until")
    @components.store([1,y], :patent_protected)
    y += 1
  end
  @css_map.store([1,0,1,y], 'list')
  @css_map.store([0,0,1,y], 'bold top list')
end

- (Object) sl_since(model)



149
150
151
152
153
154
# File 'src/view/ajax/swissmedic_cat.rb', line 149

def sl_since(model)
  sl = model.sl_entry
  date = sl.introduction_date
  @lookandfeel.lookup(:sl_since, 
                      @lookandfeel.format_date(date))
end