forked from verdnatura/hedera-web
48 lines
843 B
JavaScript
48 lines
843 B
JavaScript
|
|
Hedera.Basket = new Class
|
|
({
|
|
Extends: Hedera.Form
|
|
|
|
,open: function() {
|
|
this.close();
|
|
this.isOpen = true;
|
|
|
|
Hedera.BasketChecker.check(this.conn,
|
|
this.onBasketCheck.bind(this));
|
|
}
|
|
|
|
,onBasketCheck: function(isOk) {
|
|
if (isOk)
|
|
this.loadUi();
|
|
}
|
|
|
|
,activate: function() {
|
|
this.$('items').setInfo('bi', 'myBasketItem', 'hedera');
|
|
}
|
|
|
|
,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'});
|
|
}
|
|
|
|
,onDeleteClick: function(button, form) {
|
|
if (confirm(_('ReallyDelete')))
|
|
form.deleteRow();
|
|
}
|
|
|
|
,subtotal: function(form) {
|
|
return form.get('amount') * form.get('price');
|
|
}
|
|
});
|
|
|
|
|
|
|