forked from verdnatura/hedera-web
51 lines
998 B
JavaScript
51 lines
998 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);
|
|
this.basket = new Hedera.Basket(this.app);
|
|
|
|
this.orderId = this.$.params.$.id || this.basket.orderId;
|
|
if (!this.orderId)
|
|
return this.hash.setAll({form: 'ecomerce/checkout'});
|
|
|
|
this.$.lot.assign({id: this.orderId});
|
|
},
|
|
|
|
activate() {
|
|
this.$.items.setInfo('bi', 'myOrderRow', 'hedera');
|
|
},
|
|
|
|
onConfigureClick() {
|
|
Htk.Toast.showWarning(_('RememberReconfiguringImpact'));
|
|
this.hash.setAll({
|
|
form: 'ecomerce/checkout',
|
|
id: this.orderId
|
|
});
|
|
},
|
|
|
|
async onCatalogClick() {
|
|
const basket = new Hedera.Basket(this.app);
|
|
await basket.load(this.orderId);
|
|
},
|
|
|
|
onConfirmClick() {
|
|
this.hash.setAll({
|
|
form: 'ecomerce/confirm',
|
|
id: this.orderId
|
|
});
|
|
},
|
|
|
|
onDeleteClick(form) {
|
|
if (confirm(_('ReallyDelete')))
|
|
form.deleteRow();
|
|
},
|
|
|
|
subtotal(form) {
|
|
return form.$.amount * form.$.price;
|
|
}
|
|
});
|