[imp] mostly css improvements

bzr revid: nicolas.vanhoren@openerp.com-20111006150231-y8ybpunzis21za0d
This commit is contained in:
niv-openerp 2011-10-06 17:02:31 +02:00
parent 2e71848a60
commit bd70ddcb83
4 changed files with 136 additions and 63 deletions

View File

@ -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;
}

View File

@ -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');
};

View File

@ -23,6 +23,11 @@
<script type="text/javascript" src="/web/static/src/js/dates.js"></script>
<script type="text/javascript" src="/point_of_sale/static/lib/backbone/backbone-0.5.3.js"></script>
<script type="text/javascript" src="/point_of_sale/static/src/js/pos.js"></script>
<script type="text/javascript" src="/web/static/lib/datejs/globalization/en-US.js"></script>
<script type="text/javascript" src="/web/static/lib/datejs/core.js"></script>
<script type="text/javascript" src="/web/static/lib/datejs/parser.js"></script>
<script type="text/javascript" src="/web/static/lib/datejs/sugarpak.js"></script>
<script type="text/javascript" src="/web/static/lib/datejs/extras.js"></script>
<script type="text/javascript">
$(function() {
var db = openerp.init();

View File

@ -92,53 +92,48 @@
<div id="products-screen" class="step-screen selected-step"></div>
<div id="payment-screen" class="step-screen" style="display:none">
<header><h2>Payment</h2></header>
<div class="pos-payment-container">
<section>
<p>
Due:
<span id="payment-due-total"></span>
</p>
<p>Paid:</p>
<ol id="paymentlines"></ol>
</section>
<footer>
<p>
Total paid:
<span id="payment-paid-total"></span>
</p>
<p>
<span id="payment-remaining"></span>
</p>
<p>
<button id="validate-order">Validate</button>
</p>
</footer>
<div class="pos-step-container">
<div class="pos-payment-container">
<span id="payment-due-total" class="payment-due pos-rigth-align"></span>
<table id="paymentlines">
</table>
<table>
<tr>
<td class="paymentline-type">Paid:</td>
<td class="paymentline-amount pos-rigth-align"><span id="payment-paid-total"></span></td>
</tr>
<tr>
<td class="paymentline-type">Change:</td>
<td class="paymentline-amount pos-rigth-align"><span id="payment-remaining"></span></td>
</tr>
</table>
</div>
<div class="pos-payment-buttons">
<button id="validate-order">
<img src="/web/static/src/img/icons/gtk-apply.png"></img>
Validate</button>
</div>
</div>
</div>
<div id="receipt-screen" class="step-screen" style="display:none">
<header>Receipt</header>
<section>
<ol id="receiptlines"></ol>
</section>
<footer id="receipt-summary">
<ul>
<li>
Total:
<span id="receipt-summary-total"></span>
</li>
<li>
Tax:
<span id="receipt-summary-tax"></span>
</li>
<li>
Change:
<span id="receipt-summary-change"></span>
</li>
</ul>
</footer>
<p>
<button id="print-receipt">Print receipt</button>
</p>
<header><h2>Receipt</h2></header>
<div class="pos-step-container">
<div class="pos-receipt-container">
<div class="pos-sale-ticket">
OpenERP Point of Sale<br />
<br />
<t t-esc="new Date().toString(Date.CultureInfo.formatPatterns.shortDate + ' ' +
Date.CultureInfo.formatPatterns.longTime)"/><br />
<br />
<table id="receiptlines"></table>
<br />
Total: <span id="receipt-summary-total"></span><br />
Tax: <span id="receipt-summary-tax"></span><br />
Change: <span id="receipt-summary-change"></span><br />
</div>
</div>
<button id="pos-finish-order">Finish Order</button>
</div>
</div>
</div>
</div>
@ -213,24 +208,23 @@
</td>
</t>
<t t-name="pos-paymentline-template">
<span class="paymentline-type">
<td class="paymentline-type">
<t t-esc="name"/>
</span>
<span class="paymentline-amount">
</td>
<td class="paymentline-amount pos-rigth-align">
<input type="text" t-att-value="amount.toFixed(2)" />
</span>
</td>
</t>
<t t-name="pos-receiptline-template">
<span class="receiptline-quantity">
<td class="receiptline-quantity">
<t t-esc="quantity.toFixed(0)"/>
</span>
<span class="receiptline-name">
</td>
<td class="receiptline-name">
<t t-esc="name"/>
</span>
<span class="receiptline-amount">
<t t-esc="(list_price * (1 - discount/100) * quantity).toFixed(2)"/>
</span>
</td>
<td class="receiptline-amount">
<t t-esc="(list_price * (1 - discount/100) * quantity).toFixed(2)"/>
</td>
</t>
<t t-name="pos-payment-button-template">
<button class="payment-button" t-att-cash-register-id="id">