More Popups, total is updated

bzr revid: fva@openerp.com-20120507123932-mm38346wbz3ynt3k
This commit is contained in:
Frédéric van der Essen 2012-05-07 14:39:32 +02:00
parent b8427b9a85
commit 2c6acfab41
5 changed files with 99 additions and 10 deletions

View File

@ -665,6 +665,24 @@ body{
-webkit-transition-timing-function: ease-out;
}
.point-of-sale .popup .button.big-left{
position:absolute;
top: 120px;
left:40px;
width: 180px;
height: 180px;
line-height:180px;
}
.point-of-sale .popup .button.big-right{
position:absolute;
top: 120px;
right:40px;
width: 180px;
height: 180px;
line-height:180px;
}
/* Onscreen Keyboard http://net.tutsplus.com/tutorials/javascript-ajax/creating-a-keyboard-with-css-and-jquery/ */
.point-of-sale .keyboard_frame{

View File

@ -314,6 +314,7 @@ function openerp_pos_devices(module, instance){ //module is instance.point_of_sa
if(this.action_callback['product']){
this.action_callback['product'](parse_result);
}
//this.trigger("codebar",parse_result );
}else{
if(this.action_callback[parse_result.type]){
this.action_callback[parse_result.type](parse_result);

View File

@ -118,7 +118,7 @@ function openerp_pos_screens(module, instance){ //module is instance.point_of_sa
if(true || this.selected_order != this.pos.get('selectedOrder')){
var selectedOrder = this.pos.get('selectedOrder');
var user_mode = selectedOrder.get('user_mode');
var user_mode = this.current_mode; //selectedOrder.get('user_mode');
console.log('user mode:',user_mode);
if(user_mode === 'client'){
@ -163,7 +163,7 @@ function openerp_pos_screens(module, instance){ //module is instance.point_of_sa
selectedOrder.set({'cashier_screen': screen_name});
}
console.log('Set Current Screen: '+screen_name+' :',screen,'old:',this.current_screen, 'mode:',this.current_mode);
// console.log('Set Current Screen: '+screen_name+' :',screen,'old:',this.current_screen, 'mode:',this.current_mode);
if(screen && screen !== this.current_screen){
if(this.current_screen){
this.current_screen.hide();
@ -199,22 +199,59 @@ function openerp_pos_screens(module, instance){ //module is instance.point_of_sa
},
});
module.HelpPopupWidget = module.ScreenWidget.extend({
module.PopUpWidget = module.ScreenWidget.extend({
hide: function(){
if(this.$element){
this.$element.hide();
}
},
});
module.HelpPopupWidget = module.PopUpWidget.extend({
template:'HelpPopupWidget',
show: function(){
this._super();
this.pos.proxy.help_needed();
var self = this;
this.$element.find('.button').off('click').click(function(){
self.pos.screen_selector.close_popup();
self.pos.proxy.help_canceled();
});
},
});
module.ReceiptPopupWidget = module.PopUpWidget.extend({
template:'ReceiptPopupWidget',
show: function(){
this._super();
var self = this;
this.$element.find('.receipt').off('click').click(function(){
console.log('receipt!'); //TODO
self.pos.screen_selector.set_current_screen('scan');
});
this.$element.find('.invoice').off('click').click(function(){
console.log('invoice!'); //TODO
self.pos.screen_selector.set_current_screen('scan');
});
},
});
module.ErrorPopupWidget = module.PopUpWidget.extend({
template:'ErrorPopupWidget',
show: function(){
this._super();
this.pos.proxy.help_needed();
var self = this;
this.$element.find('.button').off('click').click(function(){
self.pos.screen_selector.close_popup();
self.pos.proxy.help_canceled();
});
},
hide:function(){
if(this.$element){
this.$element.hide();
}
this._super();
this.pos.proxy.help_canceled();
},
});
@ -413,7 +450,7 @@ function openerp_pos_screens(module, instance){ //module is instance.point_of_sa
'client': function(ean){
self.proxy.transaction_start();
//TODO 'log the client'
self.pos.screen_selector.set_current_screen('products');
self.pos.screen_selector.show_popup('receipt');
},
'discount': function(ean){
// TODO : what to do in this case ????

View File

@ -153,6 +153,7 @@ function openerp_pos_widgets(module, instance){ //module is instance.point_of_sa
init: function(parent, options) {
this._super(parent);
this.pos = options.pos;
this.pos_widget = options.pos_widget;
this.setNumpadState(options.numpadState);
this.pos.bind('change:selectedOrder', this.changeSelectedOrder, this);
this.bindOrderLineEvents();
@ -225,6 +226,7 @@ function openerp_pos_widgets(module, instance){ //module is instance.point_of_sa
total = currentOrder.getTotal();
totalTaxExcluded = currentOrder.getTotalTaxExcluded();
tax = currentOrder.getTax();
this.pos_widget.action_bar.set_total_value(Math.round(total*100)/100);
$('#subtotal').html(totalTaxExcluded.toFixed(2)).hide().fadeIn();
$('#tax').html(tax.toFixed(2)).hide().fadeIn();
$('#total').html(total.toFixed(2)).hide().fadeIn();
@ -421,7 +423,7 @@ function openerp_pos_widgets(module, instance){ //module is instance.point_of_sa
}
},
set_total_value: function(value){
this.$element.find('.value').hltml(value);
this.$element.find('.value').html(value);
},
});
@ -883,6 +885,18 @@ function openerp_pos_widgets(module, instance){ //module is instance.point_of_sa
});
this.help_popup.appendTo($('.point-of-sale'));
this.receipt_popup = new module.ReceiptPopupWidget(this, {
pos: this.pos,
pos_widget: this,
});
this.receipt_popup.appendTo($('.point-of-sale'));
this.error_popup = new module.ErrorPopupWidget(this, {
pos: this.pos,
pos_widget: this,
});
this.error_popup.appendTo($('.point-of-sale'));
this.paypadView = new module.PaypadWidget(null, {
pos: this.pos
});
@ -894,6 +908,7 @@ function openerp_pos_widgets(module, instance){ //module is instance.point_of_sa
this.numpadView.start();
this.orderView = new module.OrderWidget(null, {
pos: this.pos,
pos_widget: this,
});
this.orderView.$element = $('#current-order-content');
this.orderView.start();
@ -920,6 +935,8 @@ function openerp_pos_widgets(module, instance){ //module is instance.point_of_sa
},
popup_set:{
'help': this.help_popup,
'error': this.error_popup,
'receipt': this.receipt_popup,
},
default_client_screen: 'welcome',
default_cashier_screen: 'products',

View File

@ -268,10 +268,26 @@
</div>
</div>
</t>
<t t-name="ReceiptPopupWidget">
<div class="modal-dialog">
<div class="popup popup-help">
<p class="message">Welcome Mr. FooBar <br /> Choose your type of receipt:</p>
<div class = "button big-left receipt">
Ticket
</div>
<div class = "button big-right invoice">
Invoice
</div>
<div class="footer">
</div>
</div>
</div>
</t>
<t t-name="ErrorPopupWidget">
<div class="modal-dialog">
<div class="popup popup-help">
<p class="message">An unexpected error has occured. A technician is on the way</p>
<p class="message">An unexpected error has occured.<br /> A technician is on the way</p>
</div>
</div>
</t>
@ -407,7 +423,7 @@
</div>
</div>
<p class="total">
Total: <span class="value"> 1234 </span>
Total: <span class="value"> 0 </span>
</p>
</div>
<ul class="pos-actionbar-button-list">