Class: BBMB::Html::View::BarcodeReader

Inherits:
HtmlGrid::SpanComposite
  • Object
show all
Includes:
HtmlGrid::FormMethods
Defined in:
lib/bbmb/html/view/current_order.rb

Constant Summary collapse

COMPONENTS =
{
  [0,0] => :barcode_usb,
  [1,0] => :barcode_reader,
  [2,0] => :barcode_comport,
}
EVENT =
'scan'
FORM_ID =
'bcread'
FORM_NAME =
'bcread'

Instance Method Summary collapse

Instance Method Details

#barcode_comport(model) ⇒ Object



80
81
82
83
84
85
86
87
88
89
# File 'lib/bbmb/html/view/current_order.rb', line 80

def barcode_comport(model)
  input = HtmlGrid::Input.new(:barcode_comport, model, @session, self)
  input.set_attribute('type', 'hidden')
  val = @session.get_cookie_input(:comport)
  if(!/[0-9]+/.match(val)) 
    val = "-1"
  end
  input.value = val
  input
end

#barcode_reader(model) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
# File 'lib/bbmb/html/view/current_order.rb', line 69

def barcode_reader(model)
  button = HtmlGrid::Button.new(:barcode_button, model, @session, self)
  args = [
    @lookandfeel.lookup(:barcode_none),
    @lookandfeel.lookup(:barcode_empty),
  ]
  com = 'this.form.barcode_comport'
  argstr = args.join("', '")
  button.set_attribute('onclick', "bc_read(#{com}, '#{argstr}')")
  button
end

#barcode_usb(model) ⇒ Object



61
62
63
64
65
66
67
68
# File 'lib/bbmb/html/view/current_order.rb', line 61

def barcode_usb(model)
  if(!@session.client_nt5?)
    link = HtmlGrid::Link.new(:barcode_usb, model, @session, self)
    link.href = "http://www.ionetworks.com/support/epdrivers.jsp#E95"
    link.target = "_blank"
    link
  end
end