Class: ODDB::View::Drugs::PackageInnerComposite

Inherits:
HtmlGrid::Composite show all
Includes:
AdditionalInformation, ODDB::View::DataFormat
Defined in:
src/view/drugs/package.rb

Constant Summary

COMPONENTS =
{
  [0,0,0] =>  :ikskey,
  [1,0,0] =>  " ",
  [1,0,1] =>  :comarketing,
  [2,0]   => :registration_holder,
  [0,1]   => :name,
  [2,1]   => :registration_date,
  [0,2]   => :most_precise_dose,
  [2,2]   => :sequence_date,
  [2,3]   => :revision_date,
  [0,4,0] =>  :atc_class,
  [1,4,1] =>  :atc_ddd_link,
  [2,4]   => :expiration_date,
  [0,5]   => :galenic_form,
  [2,5]   => :size,
  [0,6]   =>  :index_therapeuticus,
  [2,6]   =>  :descr,
  [0,7]   =>  :ith_swissmedic,
  [0,8]   =>  :ikscat,
  [2,8]   =>  :indication,
  [0,9]   =>  :sl_entry,
  [0,10]  =>  :price_exfactory,
  [2,10]  =>  :price_public,
  [0,11]  =>  :deductible,
  [0,12]  =>  :pharmacode,
}
CSS_MAP =
{
  [0,0,4] => 'list',
  [0,1,4] => 'list',
  [0,2,4] => 'list',
  [0,3,4] => 'list',
  [0,4,4] => 'list',
  [0,5,4] => 'list',
  [0,6,4] => 'list',
  [0,7,4] => 'list',
  [0,8,4] => 'list',
  [0,9,4] => 'list',
  [0,10,4] => 'list',
  [0,11,4] => 'list',
  [0,12,4] => 'list',
}
DEFAULT_CLASS =
HtmlGrid::Value
LABELS =
true
LEGACY_INTERFACE =
false
LOOKANDFEEL_MAP =
{
  :descr  =>  :description,
}
COLSPAN_MAP =
{ }
SYMBOL_MAP =
{
  :sl_entry           => HtmlGrid::BooleanValue,
  :limitation         =>  HtmlGrid::BooleanValue,
  :patinfo_label      => HtmlGrid::LabelText,
  :fachinfo_label     =>  HtmlGrid::LabelText,
  :feedback_label     =>  HtmlGrid::LabelText,
  :narcotic_label     =>  HtmlGrid::LabelText,
  :registration_date  => HtmlGrid::DateValue,
  :revision_date      => HtmlGrid::DateValue,
  :sequence_date      =>  HtmlGrid::DateValue,
  :expiration_date    =>  HtmlGrid::DateValue,
}

Instance Method Summary (collapse)

Methods included from AdditionalInformation

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

Methods included from PartSize

#comparable_size, #part_size

Methods included from ODDB::View::DataFormat

#breakline, #company_name, #name_base, #price, #price_exfactory, #price_public

Methods included from ExternalLinks

#contact_link, #data_declaration, #external_link, #faq_link, #generic_definition, #help_link, #legal_note, #meddrugs_update, #wiki_link

Methods inherited from HtmlGrid::Composite

event_link, #hash_insert_col, #hash_insert_row

Instance Method Details

- (Object) _index_therapeuticus(model, key)



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'src/view/drugs/package.rb', line 165

def _index_therapeuticus(model, key)
  span = HtmlGrid::Span.new(model, @session, self)
  span.value = code = model.send(key)
  span.css_id = "#{key}#{model.ikskey}"
  if code
    ith = nil
    until ith || code.empty?
      ith = IndexTherapeuticus.find_by_code(code)
      code = code.gsub /\d+\.$/u, ''
    end
    if ith
      tooltip = HtmlGrid::Div.new(model, @session, self)
      tooltip.value = ith.send(@session.language) 
      span.dojo_tooltip = tooltip
    end
  end
  span.label = true
  span
end

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



143
144
145
146
147
148
149
# File 'src/view/drugs/package.rb', line 143

def atc_class(model, session=@session)
  val = HtmlGrid::Value.new(:atc_class, model, @session, self)
  if(atc = model.atc_class)
    val.value = atc_description(atc, @session)
  end
  val
end


150
151
152
153
154
# File 'src/view/drugs/package.rb', line 150

def atc_ddd_link(model, session=@session)
  if(atc = model.atc_class)
    super(atc, session)
  end
end

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

ignore AdditionalInformation#ikscat



156
157
158
# File 'src/view/drugs/package.rb', line 156

def ikscat(model, session=@session)
  HtmlGrid::Value.new(:ikscat, model, @session, self)
end

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



159
160
161
# File 'src/view/drugs/package.rb', line 159

def index_therapeuticus(model, session=@session)
  _index_therapeuticus model, :index_therapeuticus
end

- (Object) init



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'src/view/drugs/package.rb', line 97

def init
  if(@model.narcotic?)
    components.update([2,12] => :narcotic_label, [3,12] => :narcotic)
  end
  if(@lookandfeel.enabled?(:feedback))
    components.update([0,12] => :feedback_label, [1,12] => :feedback,
                      [0,13] => :pharmacode)
    css_map.store([0,13,4], 'list')
  end
  if(@model.ddd_price)
    components.store([2,11], :ddd_price)
  end
  if(@model.production_science)
    components.store([2,12], :production_science)
  end

  if(@model.sl_entry)
    components.store([2,9], :limitation)
    hash_insert_row(components, [0,10], :introduction_date)
    hash_insert_row(css_map, [0,10,4], 'list')
    if(@model.limitation_text)
      hash_insert_row(components, [0,10], :limitation_text)
      hash_insert_row(css_map, [0,10,4], 'list')
    end
  end
  if(@lookandfeel.enabled?(:fachinfos))
    hash_insert_row(components, [0,9], :fachinfo_label)
    hash_insert_row(css_map, [0,9,4], 'list')
    components.update({
      [1,9]   => :fachinfo,
      [2,9]   => :patinfo_label,
      [3,9]   => :patinfo,
    })
  elsif(@lookandfeel.enabled?(:patinfos))
    hash_insert_row(components, [2,9], :patinfo_label)
    hash_insert_row(css_map, [0,9,4], 'list')
    components.store([3,9], :patinfo)
  end
  if(idx = components.index(:limitation_text))
    css_map.store(idx, 'list top')
    sidx = idx.dup 
    sidx[0] += 1
    colspan_map.store(sidx, 3)
  end
  super
end

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



184
185
186
# File 'src/view/drugs/package.rb', line 184

def introduction_date(model, session=@session)
  HtmlGrid::DateValue.new(:introduction_date, model.sl_entry, @session, self)
end

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



162
163
164
# File 'src/view/drugs/package.rb', line 162

def ith_swissmedic(model, session=@session)
  _index_therapeuticus model, :ith_swissmedic
end

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



187
188
189
190
191
192
193
194
195
# File 'src/view/drugs/package.rb', line 187

def limitation_text(model, session=@session)
  text = HtmlGrid::Div.new(model, @session, self)
  text.label = true
  if(lim = model.limitation_text)
    text.value = lim.send(@session.language)
    text.css_class = "long-text"
  end
  text
end

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



196
197
198
# File 'src/view/drugs/package.rb', line 196

def most_precise_dose(model, session=@session)
  HtmlGrid::Value.new(:most_precise_dose, model, session, self)
end

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



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'src/view/drugs/package.rb', line 199

def name(model, session=@session)
  link = HtmlGrid::Link.new(:name, model, @session, self)
  link.value = model.name
  link.label = true
  args = {
    :zone => :drugs, 
    :search_query => model.name_base.gsub('/', '%2F'),
    :search_type => :st_oddb,
  }
  if @lookandfeel.disabled?(:best_result)
    link.href = @lookandfeel._event_url(:search, args)
  else
    link.href = @lookandfeel._event_url(:search, args, "best_result")
  end
  link
end

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



215
216
217
# File 'src/view/drugs/package.rb', line 215

def registration_holder(model, session=@session)
  HtmlGrid::Value.new(:company_name, model, @session, self)
end