0
1
Fork 0
hedera-web-mindshore/forms/ecomerce/basket/index.js

48 lines
939 B
JavaScript

import './style.scss';
export default new Class({
Extends: Hedera.Form,
Template: require('./ui.xml'),
async open() {
await Hedera.Form.prototype.open.call(this);
let orderId = this.$.params.$.id;
if (!orderId)
orderId = localStorage.getItem('hederaBasket');
if (!orderId)
this.hash.setAll({form: 'ecomerce/pending'});
else
await Hedera.Basket.check(this.conn, this.hash);
this.$.params.set('id', orderId);
},
activate() {
this.$.items.setInfo('bi', 'myBasketItem', 'hedera');
},
onConfigureClick() {
Htk.Toast.showWarning(_('RememberReconfiguringImpact'));
this.hash.setAll({
form: 'ecomerce/checkout',
id: this.$.params.$.id
});
},
onConfirmClick() {
this.hash.setAll({
form: 'ecomerce/confirm',
id: this.$.params.$.id
});
},
onDeleteClick(form) {
if (confirm(_('ReallyDelete')))
form.deleteRow();
},
subtotal(form) {
return form.$.amount * form.$.price;
}
});