52 lines
901 B
JavaScript
Executable File
52 lines
901 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'});
|
|
}
|
|
|
|
,onShowClick: function (button, form)
|
|
{
|
|
this.hash.set ({
|
|
'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 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);
|
|
}
|
|
});
|
|
|