forked from verdnatura/hedera-web
56 lines
934 B
JavaScript
Executable File
56 lines
934 B
JavaScript
Executable File
|
|
Vn.Orders = new Class
|
|
({
|
|
Extends: Vn.Module
|
|
|
|
,activate: function ()
|
|
{
|
|
Vn.Tpv.check (this.conn);
|
|
}
|
|
|
|
,onBasketClick: function ()
|
|
{
|
|
this.hash.set ({'form': 'ecomerce/basket'});
|
|
}
|
|
|
|
,onShowClick: function (column, ticketId)
|
|
{
|
|
this.hash.set ({
|
|
'form': 'ecomerce/ticket',
|
|
'ticket': ticketId
|
|
});
|
|
}
|
|
|
|
// TPV
|
|
|
|
,balanceConditionalFunc: function (field, value)
|
|
{
|
|
var className = 'balance-amount ';
|
|
|
|
if (value > 0)
|
|
className += 'positive-balance';
|
|
else
|
|
className += 'negative-balance';
|
|
|
|
field.node.className = className;
|
|
}
|
|
|
|
,onPayButtonClick: function ()
|
|
{
|
|
var company = 442;
|
|
var amount = this.$('debt').value;
|
|
|
|
amount = amount <= 0 ? null : amount;
|
|
|
|
var defaultAmountStr = '';
|
|
|
|
if (amount !== null)
|
|
defaultAmountStr = Vn.Value.format (amount, '%.2d');
|
|
|
|
var amount = parseFloat (prompt (_('AmountToPay:'), defaultAmountStr));
|
|
|
|
Vn.Tpv.pay (this.conn, amount, company);
|
|
}
|
|
});
|
|
|