[imp] improved numpad
bzr revid: nicolas.vanhoren@openerp.com-20111216160858-f9ruclwhdmebjoqc
This commit is contained in:
parent
a26df4085c
commit
7fe7189365
|
@ -556,7 +556,8 @@ openerp.point_of_sale = function(db) {
|
|||
},
|
||||
reset: function() {
|
||||
return this.set({
|
||||
buffer: "0"
|
||||
buffer: "0",
|
||||
mode: "quantity"
|
||||
});
|
||||
},
|
||||
updateTarget: function() {
|
||||
|
@ -580,6 +581,8 @@ openerp.point_of_sale = function(db) {
|
|||
this.state = options.state;
|
||||
},
|
||||
start: function() {
|
||||
this.state.bind('change:mode', this.changedMode, this);
|
||||
this.changedMode();
|
||||
this.$element.find('button#numpad-backspace').click(_.bind(this.clickDeleteLastChar, this));
|
||||
this.$element.find('button#numpad-minus').click(_.bind(this.clickSwitchSign, this));
|
||||
this.$element.find('button.number-char').click(_.bind(this.clickAppendNewChar, this));
|
||||
|
@ -597,12 +600,14 @@ openerp.point_of_sale = function(db) {
|
|||
return this.state.appendNewChar(newChar);
|
||||
},
|
||||
clickChangeMode: function(event) {
|
||||
var newMode;
|
||||
$('.selected-mode').removeClass('selected-mode');
|
||||
$(event.currentTarget).addClass('selected-mode');
|
||||
newMode = event.currentTarget.attributes['data-mode'].nodeValue;
|
||||
var newMode = event.currentTarget.attributes['data-mode'].nodeValue;
|
||||
return this.state.changeMode(newMode);
|
||||
}
|
||||
},
|
||||
changedMode: function() {
|
||||
var mode = this.state.get('mode');
|
||||
$('.selected-mode').removeClass('selected-mode');
|
||||
$(_.str.sprintf('.mode-button[data-mode="%s"]', mode), this.$element).addClass('selected-mode');
|
||||
},
|
||||
});
|
||||
/*
|
||||
Gives access to the payment methods (aka. 'cash registers')
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
<button class="input-button number-char">1</button>
|
||||
<button class="input-button number-char">2</button>
|
||||
<button class="input-button number-char">3</button>
|
||||
<button class="mode-button selected-mode" data-mode='quantity'>Qty</button>
|
||||
<button class="mode-button" data-mode='quantity'>Qty</button>
|
||||
<br />
|
||||
<button class="input-button number-char">4</button>
|
||||
<button class="input-button number-char">5</button>
|
||||
|
|
Loading…
Reference in New Issue