2015-01-23 13:09:30 +00:00
|
|
|
|
|
|
|
Vn.Orders = new Class
|
|
|
|
({
|
|
|
|
Extends: Vn.Module
|
|
|
|
|
|
|
|
,activate: function ()
|
|
|
|
{
|
2015-03-06 23:33:54 +00:00
|
|
|
this.payPopup = new Htk.Popup ();
|
2015-03-27 19:10:49 +00:00
|
|
|
this.payPopup.setChildNode (this.$('balance-popup'));
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2015-07-28 19:14:26 +00:00
|
|
|
Vn.Tpv.check (this.conn);
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
|
2015-07-10 12:30:08 +00:00
|
|
|
,onBasketClick: function ()
|
2015-01-23 13:09:30 +00:00
|
|
|
{
|
2015-07-10 12:30:08 +00:00
|
|
|
this.hash.set ({'form': 'ecomerce/basket'});
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
,onShowClick: function (column, ticketId)
|
|
|
|
{
|
|
|
|
this.hash.set ({
|
2015-01-31 01:05:12 +00:00
|
|
|
'form': 'ecomerce/ticket',
|
2015-01-23 13:09:30 +00:00
|
|
|
'ticket': ticketId
|
|
|
|
});
|
|
|
|
}
|
2015-07-28 19:14:26 +00:00
|
|
|
|
2015-01-23 13:09:30 +00:00
|
|
|
// TPV
|
|
|
|
|
2015-03-27 19:10:49 +00:00
|
|
|
,balanceConditionalFunc: function (field, value)
|
2015-01-23 13:09:30 +00:00
|
|
|
{
|
2015-03-27 19:10:49 +00:00
|
|
|
var className = 'balance-amount ';
|
2015-03-07 00:56:24 +00:00
|
|
|
|
2015-01-23 13:09:30 +00:00
|
|
|
if (value > 0)
|
2015-03-27 19:10:49 +00:00
|
|
|
className += 'positive-balance';
|
2015-01-23 13:09:30 +00:00
|
|
|
else
|
2015-03-27 19:10:49 +00:00
|
|
|
className += 'negative-balance';
|
2015-03-07 00:56:24 +00:00
|
|
|
|
|
|
|
field.node.className = className;
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
,onPayButtonClick: function ()
|
|
|
|
{
|
2015-03-06 23:33:54 +00:00
|
|
|
this.payPopup.show (this.$('pay-button'));
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
,onCompanyPayClick: function (column, value, row)
|
|
|
|
{
|
2015-03-06 23:33:54 +00:00
|
|
|
var model = this.$('balance');
|
2015-01-23 13:09:30 +00:00
|
|
|
var company = model.get (row, 'id');
|
|
|
|
var amount = model.get (row, 'amount');
|
2015-02-08 15:38:38 +00:00
|
|
|
|
2015-01-23 13:09:30 +00:00
|
|
|
amount = amount <= 0 ? null : amount;
|
|
|
|
|
|
|
|
var defaultAmountStr = '';
|
|
|
|
|
2015-07-10 12:30:08 +00:00
|
|
|
if (amount !== null)
|
|
|
|
defaultAmountStr = Vn.Value.format (amount, '%.2d');
|
2015-01-23 13:09:30 +00:00
|
|
|
|
|
|
|
var amount = parseFloat (prompt (_('AmountToPay:'), defaultAmountStr));
|
|
|
|
|
2015-07-28 19:14:26 +00:00
|
|
|
Vn.Tpv.pay (this.conn, amount, company);
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|