forked from verdnatura/hedera-web
62 lines
946 B
JavaScript
Executable File
62 lines
946 B
JavaScript
Executable File
|
|
Vn.Basket = new Class
|
|
({
|
|
Extends: Vn.Form
|
|
|
|
,open: function ()
|
|
{
|
|
if (this.basketChecked)
|
|
this.parent ();
|
|
}
|
|
|
|
,activate: function ()
|
|
{
|
|
Vn.BasketChecker.check (this.conn,
|
|
this.onBasketCheck.bind (this));
|
|
}
|
|
|
|
,onBasketCheck: function (isOk)
|
|
{
|
|
if (!isOk)
|
|
return;
|
|
|
|
this.basketChecked = true;
|
|
this.open ();
|
|
}
|
|
|
|
,onConfigureClick: function ()
|
|
{
|
|
Htk.Toast.showWarning (_('RememberReconfiguringImpact'));
|
|
this.hash.set ({'form': 'ecomerce/checkout'});
|
|
}
|
|
|
|
,onCatalogClick: function ()
|
|
{
|
|
this.hash.set ({'form': 'ecomerce/catalog'});
|
|
}
|
|
|
|
,onCheckoutClick: function ()
|
|
{
|
|
this.hash.set ({'form': 'ecomerce/confirm'});
|
|
}
|
|
|
|
,repeaterFunc: function (res, form)
|
|
{
|
|
res.$('subtotal').value = this.subtotal (form);
|
|
}
|
|
|
|
,onDeleteClick: function (button, form)
|
|
{
|
|
if (confirm (_('ReallyDelete')))
|
|
form.deleteRow ();
|
|
}
|
|
|
|
,subtotal: function (form)
|
|
{
|
|
return form.get ('amount') * form.get ('price');
|
|
}
|
|
});
|
|
|
|
|
|
|