hedera-web/forms/ecomerce/basket/index.js

48 lines
939 B
JavaScript
Raw Normal View History

2022-11-16 01:44:39 +00:00
import './style.scss';
2022-11-16 01:44:39 +00:00
export default new Class({
2022-11-15 21:26:48 +00:00
Extends: Hedera.Form,
2022-11-16 01:44:39 +00:00
Template: require('./ui.xml'),
2022-11-28 08:51:31 +00:00
async open() {
2023-01-30 10:08:26 +00:00
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);
2022-11-15 21:26:48 +00:00
},
2016-07-22 20:00:27 +00:00
2022-11-15 21:26:48 +00:00
activate() {
2022-05-28 01:18:06 +00:00
this.$.items.setInfo('bi', 'myBasketItem', 'hedera');
2022-11-15 21:26:48 +00:00
},
2015-02-01 03:21:54 +00:00
2022-11-15 21:26:48 +00:00
onConfigureClick() {
2022-05-24 10:18:44 +00:00
Htk.Toast.showWarning(_('RememberReconfiguringImpact'));
2023-01-30 10:08:26 +00:00
this.hash.setAll({
form: 'ecomerce/checkout',
id: this.$.params.$.id
});
},
onConfirmClick() {
this.hash.setAll({
form: 'ecomerce/confirm',
id: this.$.params.$.id
});
2022-11-15 21:26:48 +00:00
},
2022-11-15 21:26:48 +00:00
onDeleteClick(form) {
2022-05-24 10:18:44 +00:00
if (confirm(_('ReallyDelete')))
form.deleteRow();
2022-11-15 21:26:48 +00:00
},
2022-11-15 21:26:48 +00:00
subtotal(form) {
2022-05-28 15:49:46 +00:00
return form.$.amount * form.$.price;
}
});