From bd70ddcb8382070419cf1c7b4a57cbe92041a7ab Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 6 Oct 2011 17:02:31 +0200 Subject: [PATCH] [imp] mostly css improvements bzr revid: nicolas.vanhoren@openerp.com-20111006150231-y8ybpunzis21za0d --- addons/point_of_sale/static/src/css/pos.css | 62 +++++++++++- addons/point_of_sale/static/src/js/pos.js | 26 ++++- addons/point_of_sale/static/src/pos.html | 5 + addons/point_of_sale/static/src/xml/pos.xml | 106 +++++++++----------- 4 files changed, 136 insertions(+), 63 deletions(-) diff --git a/addons/point_of_sale/static/src/css/pos.css b/addons/point_of_sale/static/src/css/pos.css index c55bf32a2a6..8b5b11cc01e 100644 --- a/addons/point_of_sale/static/src/css/pos.css +++ b/addons/point_of_sale/static/src/css/pos.css @@ -44,6 +44,15 @@ .point-of-sale li { list-style-type: none; } +.point-of-sale button img { + vertical-align: bottom; +} +.point-of-sale .pos-rigth-align { + text-align: right; +} +.point-of-sale .pos-rigth-align input { + text-align: right; +} .point-of-sale #container { width: 100%; height: 100%; @@ -415,8 +424,55 @@ padding-top: 7px; } -.point-of-sale .pos-payment-container { +.point-of-sale .pos-step-container { display: inline-block; - text-align: left; - font-size: 2em; + font-size: 1.5em; +} +.point-of-sale .pos-payment-container { + text-align: left; +} +.point-of-sale .pos-payment-container .payment-due { + display: block; + margin-top: 10px; + margin-bottom: 10px; + padding: 3px 6px 0px 6px; + background-color: white; + border:1px solid grey; + border-radius: 3px; +} +.point-of-sale .pos-payment-container table { + width: 100%; + margin-bottom: 20px; +} +.point-of-sale .pos-payment-container .paymentline-type { + font-size: 0.8em; + font-weight: bold; +} +.point-of-sale .step-screen button { + width: 50%; + text-align: center; + padding: 7px 0 7px 0; + font-size: 0.8em; + font-weight: bold; +} +.point-of-sale .pos-sale-ticket { + text-align: left; + width: 300px; + background-color: white; + margin: 20px; + padding: 10px; + display: inline-block; +} +.point-of-sale .pos-sale-ticket table { + width: 100%; + border: 0; +} +.point-of-sale .pos-sale-ticket table td { + border: 0; +} +.point-of-sale .pos-sale-ticket table td.receiptline-amount { + text-align: right; +} +.point-of-sale .pos-receipt-container { + font-size: 0.75em; } diff --git a/addons/point_of_sale/static/src/js/pos.js b/addons/point_of_sale/static/src/js/pos.js index 0e2968d134f..6100158547d 100644 --- a/addons/point_of_sale/static/src/js/pos.js +++ b/addons/point_of_sale/static/src/js/pos.js @@ -326,10 +326,20 @@ openerp.point_of_sale = function(db) { this.set({ paymentLines: new PaymentlineCollection }); + this.bind('change:validated', this.validatedChanged); return this.set({ name: "Order " + this.generateUniqueId() }); }; + Order.prototype.events = { + 'change:validated': 'validatedChanged' + }; + Order.prototype.validatedChanged = function() { + if (this.get("validated") && !this.previous("validated")) { + $('.step-screen').hide(); + $('#receipt-screen').show(); + } + } Order.prototype.generateUniqueId = function() { return new Date().getTime(); }; @@ -829,7 +839,7 @@ openerp.point_of_sale = function(db) { PaymentlineView.__super__.constructor.apply(this, arguments); } - PaymentlineView.prototype.tagName = 'li'; + PaymentlineView.prototype.tagName = 'tr'; PaymentlineView.prototype.className = 'paymentline'; PaymentlineView.prototype.template = qweb_template('pos-paymentline-template'); PaymentlineView.prototype.initialize = function() { @@ -923,7 +933,7 @@ openerp.point_of_sale = function(db) { $(this.el).find('#payment-due-total').html(dueTotal.toFixed(2)); $(this.el).find('#payment-paid-total').html(paidTotal.toFixed(2)); remainingAmount = dueTotal - paidTotal; - remaining = remainingAmount > 0 ? "Due left: " + remainingAmount.toFixed(2) : "Change: " + (-remainingAmount).toFixed(2); + remaining = remainingAmount > 0 ? 0 : (-remainingAmount).toFixed(2); return $('#payment-remaining').html(remaining); }; return PaymentView; @@ -937,7 +947,7 @@ openerp.point_of_sale = function(db) { ReceiptLineView.__super__.constructor.apply(this, arguments); } - ReceiptLineView.prototype.tagName = 'li'; + ReceiptLineView.prototype.tagName = 'tr'; ReceiptLineView.prototype.className = 'receiptline'; ReceiptLineView.prototype.template = qweb_template('pos-receiptline-template'); ReceiptLineView.prototype.initialize = function() { @@ -953,13 +963,21 @@ openerp.point_of_sale = function(db) { function ReceiptView() { ReceiptView.__super__.constructor.apply(this, arguments); } - + ReceiptView.prototype.initialize = function(options) { this.shop = options.shop; this.shop.bind('change:selectedOrder', this.changeSelectedOrder, this); this.bindOrderLineEvents(); return this.bindPaymentLineEvents(); }; + ReceiptView.prototype.events = { + "click button#pos-finish-order": "finishOrder" + }; + ReceiptView.prototype.finishOrder = function() { + $('.step-screen').hide(); + $('#products-screen').show(); + this.shop.get('selectedOrder').destroy(); + }; ReceiptView.prototype.receiptLineList = function() { return $(this.el).find('#receiptlines'); }; diff --git a/addons/point_of_sale/static/src/pos.html b/addons/point_of_sale/static/src/pos.html index 45deefe3c80..93b2418dee6 100644 --- a/addons/point_of_sale/static/src/pos.html +++ b/addons/point_of_sale/static/src/pos.html @@ -23,6 +23,11 @@ + + + + +