Showing and hiding widgets in different screens and modes
bzr revid: fva@openerp.com-20120504102737-gfi4kggapocpnxrk
This commit is contained in:
parent
22c0ae2d8b
commit
bf9fc9b13c
|
@ -180,6 +180,10 @@ function openerp_pos_screens(module, instance){ //module is instance.point_of_sa
|
|||
this._super();
|
||||
var self = this;
|
||||
|
||||
this.pos_widget.set_numpad_visible(false);
|
||||
this.pos_widget.set_leftpane_visible(true);
|
||||
this.pos_widget.set_cashier_controls_visible(false);
|
||||
|
||||
self.pos.proxy.weighting_start();
|
||||
|
||||
this.intervalID = setInterval(function(){
|
||||
|
@ -227,6 +231,11 @@ function openerp_pos_screens(module, instance){ //module is instance.point_of_sa
|
|||
show: function(){
|
||||
this._super();
|
||||
var self = this;
|
||||
|
||||
this.pos_widget.set_numpad_visible(false);
|
||||
this.pos_widget.set_leftpane_visible(true);
|
||||
this.pos_widget.set_cashier_controls_visible(false);
|
||||
|
||||
this.pos_widget.orderView.setNumpadState(this.pos_widget.numpadView.state);
|
||||
this.pos_widget.action_bar.add_new_button(
|
||||
{
|
||||
|
@ -261,6 +270,10 @@ function openerp_pos_screens(module, instance){ //module is instance.point_of_sa
|
|||
this._super();
|
||||
var self = this;
|
||||
|
||||
this.pos_widget.set_numpad_visible(false);
|
||||
this.pos_widget.set_leftpane_visible(true);
|
||||
this.pos_widget.set_cashier_controls_visible(false);
|
||||
|
||||
this.pos.proxy.payment_request(0,'card','info'); //TODO TOTAL
|
||||
|
||||
var intervalID = setInterval(function(){
|
||||
|
@ -307,6 +320,11 @@ function openerp_pos_screens(module, instance){ //module is instance.point_of_sa
|
|||
show: function(){
|
||||
this._super();
|
||||
var self = this;
|
||||
|
||||
this.pos_widget.set_numpad_visible(false);
|
||||
this.pos_widget.set_leftpane_visible(false);
|
||||
this.pos_widget.set_cashier_controls_visible(false);
|
||||
|
||||
this.pos_widget.action_bar.add_new_button(
|
||||
{
|
||||
label:'scan',
|
||||
|
@ -357,6 +375,11 @@ function openerp_pos_screens(module, instance){ //module is instance.point_of_sa
|
|||
show: function(){
|
||||
this._super();
|
||||
var self = this;
|
||||
|
||||
this.pos_widget.set_numpad_visible(false);
|
||||
this.pos_widget.set_leftpane_visible(true);
|
||||
this.pos_widget.set_cashier_controls_visible(false);
|
||||
|
||||
this.pos_widget.action_bar.add_new_button(
|
||||
{
|
||||
label: 'help',
|
||||
|
@ -410,6 +433,11 @@ function openerp_pos_screens(module, instance){ //module is instance.point_of_sa
|
|||
show: function(){
|
||||
this._super();
|
||||
var self = this;
|
||||
|
||||
this.pos_widget.set_numpad_visible(true);
|
||||
this.pos_widget.set_leftpane_visible(true);
|
||||
this.pos_widget.set_cashier_controls_visible(true);
|
||||
|
||||
this.pos_widget.orderView.setNumpadState(this.pos_widget.numpadView.state);
|
||||
this.pos_widget.action_bar.add_new_button(
|
||||
{
|
||||
|
@ -468,6 +496,13 @@ function openerp_pos_screens(module, instance){ //module is instance.point_of_sa
|
|||
$('button#pos-finish-order', this.$element).click(_.bind(this.finishOrder, this));
|
||||
$('button#print-the-ticket', this.$element).click(_.bind(this.print, this));
|
||||
},
|
||||
show: function(){
|
||||
this._super();
|
||||
|
||||
this.pos_widget.set_numpad_visible(true);
|
||||
this.pos_widget.set_leftpane_visible(true);
|
||||
this.pos_widget.set_cashier_controls_visible(true);
|
||||
},
|
||||
print: function() {
|
||||
window.print();
|
||||
},
|
||||
|
@ -504,6 +539,11 @@ function openerp_pos_screens(module, instance){ //module is instance.point_of_sa
|
|||
},
|
||||
show: function(){
|
||||
this._super();
|
||||
|
||||
this.pos_widget.set_numpad_visible(true);
|
||||
this.pos_widget.set_leftpane_visible(true);
|
||||
this.pos_widget.set_cashier_controls_visible(true);
|
||||
|
||||
this.setNumpadState(this.pos_widget.numpadView.state);
|
||||
},
|
||||
hide: function(){
|
||||
|
|
|
@ -729,6 +729,10 @@ function openerp_pos_widgets(module, instance){ //module is instance.point_of_sa
|
|||
init: function() {
|
||||
this._super.apply(this, arguments);
|
||||
this.pos = new module.PosModel(this.session);
|
||||
this.numpad_visible = true;
|
||||
this.leftpane_visible = true;
|
||||
this.leftpane_width = '440px';
|
||||
this.cashier_controls_visible = true;
|
||||
},
|
||||
start: function() {
|
||||
var self = this;
|
||||
|
@ -882,6 +886,43 @@ function openerp_pos_widgets(module, instance){ //module is instance.point_of_sa
|
|||
var self = this;
|
||||
this.synch_notification.on_change_nbr_pending(self.pos.get('nbr_pending_operations').length);
|
||||
},
|
||||
set_numpad_visible: function(visible){
|
||||
if(visible != this.numpad_visible){
|
||||
this.numpad_visible = visible;
|
||||
if(visible){
|
||||
$('#numpad').show();
|
||||
$('#paypad').show();
|
||||
}else{
|
||||
$('#numpad').hide();
|
||||
$('#paypad').hide();
|
||||
}
|
||||
}
|
||||
},
|
||||
set_leftpane_visible: function(visible){
|
||||
if(visible != this.leftpane_visible){
|
||||
this.leftpane_visible = visible;
|
||||
if(visible){
|
||||
$('#leftpane').show().animate({'width':this.leftpane_width},500,'swing');
|
||||
$('#rightpane').animate({'left':this.leftpane_width},500,'swing');
|
||||
}else{
|
||||
var leftpane = $('#leftpane');
|
||||
$('#leftpane').animate({'width':'0px'},500,'swing', function(){ leftpane.hide(); });
|
||||
$('#rightpane').animate({'left':'0px'},500,'swing');
|
||||
}
|
||||
}
|
||||
},
|
||||
set_cashier_controls_visible: function(visible){
|
||||
if(visible != this.cashier_controls_visible){
|
||||
this.cashier_controls_visible = visible;
|
||||
if(visible){
|
||||
$('#loggedas').show();
|
||||
$('#rightheader').show();
|
||||
}else{
|
||||
$('#loggedas').hide();
|
||||
$('#rightheader').hide();
|
||||
}
|
||||
}
|
||||
},
|
||||
try_close: function() {
|
||||
var self = this;
|
||||
self.pos.flush().then(_.bind(function() {
|
||||
|
|
Loading…
Reference in New Issue