import './style.scss';

export default new Class({
	Extends: Hedera.Form,
	Template: require('./ui.xml'),

	async open() {
		const isOk = await Hedera.BasketChecker.check(this.conn, this.hash);
		if (isOk) await Hedera.Form.prototype.open.call(this);
	},
	
	activate() {	
		this.$.items.setInfo('bi', 'myBasketItem', 'hedera');
	},

	onConfigureClick() {
		Htk.Toast.showWarning(_('RememberReconfiguringImpact'));
		this.hash.setAll({form: 'ecomerce/checkout'});
	},

	onDeleteClick(form) {
		if (confirm(_('ReallyDelete')))
			form.deleteRow();
	},

	subtotal(form) {
		return form.$.amount * form.$.price;
	}
});