[FIX] point_of_sale: it was too easy to accidentally hit the close button on ipads...
authorFrederic van der Essen <fva@openerp.com / fvdessen+o@gmail.com>
Fri, 8 Aug 2014 13:27:06 +0000 (15:27 +0200)
committerFrederic van der Essen <fva@openerp.com / fvdessen+o@gmail.com>
Mon, 11 Aug 2014 15:17:12 +0000 (17:17 +0200)
addons/point_of_sale/static/src/css/pos.css
addons/point_of_sale/static/src/js/widgets.js

index ab0d52c..abb7243 100644 (file)
@@ -399,6 +399,11 @@ td {
     background: rgba(0,0,0,0.2);
     color:#EEE;
 }
+.pos .pos-rightheader .header-button.confirm {
+    background: #F03F00;
+    color: white;
+    font-weight: bold;
+}
 
 /*  c) The notifications indicator */
 
index 0f846b9..5788afc 100644 (file)
@@ -1131,7 +1131,21 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
 
             this.close_button = new module.HeaderButtonWidget(this,{
                 label: _t('Close'),
-                action: function(){ self.close(); },
+                action: function(){ 
+                    var self = this;
+                    if (!this.confirmed) {
+                        this.$el.addClass('confirm');
+                        this.$el.text(_t('Confirm'));
+                        this.confirmed = setTimeout(function(){
+                            self.$el.removeClass('confirm');
+                            self.$el.text(_t('Close'));
+                            self.confirmed = false;
+                        },900);
+                    } else {
+                        clearTimeout(this.confirmed);
+                        this.pos_widget.close();
+                    }
+                },
             });
             this.close_button.appendTo(this.$('.pos-rightheader'));