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

78 lines
1.4 KiB
JavaScript
Executable File

Vn.Confirm = new Class
({
Extends: Vn.Form
,onOrderReady: function (form)
{
if (form.row < 0)
return;
if (form.get ('method') != 'PICKUP')
{
Vn.Node.show (this.$('address'));
Vn.Node.setText (this.$('method'), _('Agency'));
}
else
{
Vn.Node.hide (this.$('address'));
Vn.Node.setText (this.$('method'), _('Warehouse'));
}
}
,onImportReady: function (form)
{
if (form.row != -1)
this.$('total').value = form.get ('tax_base') + form.get ('vat');
else
this.$('total').value = null;
}
,disableButtons: function (disable)
{
this.$('modify').disabled = disable;
this.$('confirm').disabled = disable;
}
,onModifyClick: function ()
{
window.history.back();
}
,onConfirmClick: function ()
{
this.disableButtons (true);
this.$('confirm-query').execute ();
}
,onConfirm: function (query, resultSet)
{
var res = resultSet.fetchResult ();
var debt = resultSet.fetchValue ();
if (res)
{
Vn.Cookie.unset ('order');
this.pay = debt > this.$('order-form').get ('credit');
this.popup = new Htk.Popup ();
this.popup.setChildNode (this.$('success-dialog'));
this.popup.showCenter ();
}
else
this.disableButtons (false);
}
,onAcceptClick: function ()
{
this.popup.hide ();
if (this.pay)
Vn.Tpv.pay (this.conn, this.$('total').value,
this.$('order-form').get ('company_id'));
else
this.hash.set ({'form': 'ecomerce/orders'});
}
});