forked from verdnatura/hedera-web
51 lines
898 B
JavaScript
Executable File
51 lines
898 B
JavaScript
Executable File
|
|
Vn.Orders = new Class
|
|
({
|
|
Extends: Vn.Form
|
|
|
|
,activate: function ()
|
|
{
|
|
Vn.Tpv.check (this.conn);
|
|
}
|
|
|
|
,onBasketClick: function ()
|
|
{
|
|
this.hash.set ({'form': 'ecomerce/basket'});
|
|
}
|
|
|
|
,repeaterFunc: function (res, form)
|
|
{
|
|
res.$('link').href = this.hash.make ({
|
|
'form': 'ecomerce/ticket',
|
|
'ticket': form.get ('ticket_id')
|
|
});
|
|
}
|
|
|
|
// TPV
|
|
|
|
,balanceConditionalFunc: function (field, value)
|
|
{
|
|
if (value >= 0)
|
|
Vn.Node.removeClass (this.$('balance'), 'negative');
|
|
else
|
|
Vn.Node.addClass (this.$('balance'), 'negative');
|
|
}
|
|
|
|
,onPayButtonClick: function ()
|
|
{
|
|
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, null);
|
|
}
|
|
});
|
|
|