2015-01-23 13:09:30 +00:00
|
|
|
|
2016-09-26 09:28:47 +00:00
|
|
|
Hedera.Basket = new Class
|
2015-01-23 13:09:30 +00:00
|
|
|
({
|
2016-09-26 09:28:47 +00:00
|
|
|
Extends: Hedera.Form
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2015-07-28 19:14:26 +00:00
|
|
|
,open: function ()
|
|
|
|
{
|
2015-12-10 13:48:43 +00:00
|
|
|
this.close ();
|
|
|
|
this.isOpen = true;
|
2015-07-28 19:14:26 +00:00
|
|
|
|
2016-09-26 09:28:47 +00:00
|
|
|
Hedera.BasketChecker.check (this.conn,
|
2015-07-15 13:39:07 +00:00
|
|
|
this.onBasketCheck.bind (this));
|
2015-07-10 12:30:08 +00:00
|
|
|
}
|
2015-02-01 03:21:54 +00:00
|
|
|
|
2015-07-28 19:14:26 +00:00
|
|
|
,onBasketCheck: function (isOk)
|
2015-02-01 03:21:54 +00:00
|
|
|
{
|
2015-12-10 13:48:43 +00:00
|
|
|
if (isOk)
|
|
|
|
this.loadUi ();
|
2015-02-01 03:21:54 +00:00
|
|
|
}
|
2016-07-22 20:00:27 +00:00
|
|
|
|
|
|
|
,activate: function ()
|
|
|
|
{
|
|
|
|
this.$('items').setInfo ('i', 'basket_item', 'hedera');
|
|
|
|
}
|
2015-02-01 03:21:54 +00:00
|
|
|
|
2015-06-30 12:06:19 +00:00
|
|
|
,onConfigureClick: function ()
|
2015-02-01 03:21:54 +00:00
|
|
|
{
|
2015-08-17 18:02:14 +00:00
|
|
|
Htk.Toast.showWarning (_('RememberReconfiguringImpact'));
|
2015-07-10 12:30:08 +00:00
|
|
|
this.hash.set ({'form': 'ecomerce/checkout'});
|
2015-02-01 03:21:54 +00:00
|
|
|
}
|
2015-06-30 12:06:19 +00:00
|
|
|
|
2015-08-27 14:04:34 +00:00
|
|
|
,onCatalogClick: function ()
|
|
|
|
{
|
|
|
|
this.hash.set ({'form': 'ecomerce/catalog'});
|
|
|
|
}
|
|
|
|
|
2015-06-30 12:06:19 +00:00
|
|
|
,onCheckoutClick: function ()
|
2015-02-01 03:21:54 +00:00
|
|
|
{
|
2015-07-28 19:14:26 +00:00
|
|
|
this.hash.set ({'form': 'ecomerce/confirm'});
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
|
2015-11-30 16:46:24 +00:00
|
|
|
,repeaterFunc: function (res, form)
|
2015-01-23 13:09:30 +00:00
|
|
|
{
|
2015-11-30 16:46:24 +00:00
|
|
|
res.$('subtotal').value = this.subtotal (form);
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
|
2015-11-30 16:46:24 +00:00
|
|
|
,onDeleteClick: function (button, form)
|
2015-01-23 13:09:30 +00:00
|
|
|
{
|
2015-11-30 16:46:24 +00:00
|
|
|
if (confirm (_('ReallyDelete')))
|
|
|
|
form.deleteRow ();
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
,subtotal: function (form)
|
|
|
|
{
|
2015-06-30 12:06:19 +00:00
|
|
|
return form.get ('amount') * form.get ('price');
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-07-10 12:30:08 +00:00
|
|
|
|
|
|
|
|