This commit is contained in:
Juan Ferrer 2019-03-13 09:57:18 +01:00
parent 95d9c6c4d5
commit 6f1b96cb4a
7 changed files with 77 additions and 99 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (1.406.34) stable; urgency=low
hedera-web (1.406.35) stable; urgency=low
* Initial Release.

View File

@ -27,10 +27,9 @@
{
margin: .1em 0;
margin-left: 5em;
}
.items .row > p.important
{
font-size: 1.2em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* Topbar */

View File

@ -13,7 +13,8 @@
<div class="rows box">
<htk-repeater form-id="iter" empty-message="_Enter a search term">
<db-model property="model" id="items">
SELECT id, longName, size, category, image
SELECT id, longName, size, category, image,
value5, value6, value7
FROM vn.item
WHERE longName LIKE CONCAT('%', #filter, '%')
OR id = #filter
@ -36,12 +37,15 @@
editable="true"
conn="conn"/>
<p class="concept">
<htk-text form="iter" column="longName"/>
<htk-text form="iter" column="size"/>
<htk-text form="iter" column="category"/>
<htk-text form="iter" column="longName"/>
</p>
<p class="tags">
<htk-text form="iter" column="value5"/>
<htk-text form="iter" column="value6"/>
<htk-text form="iter" column="value7"/>
</p>
<p>
<htk-text form="iter" column="id"/>
@<htk-text form="iter" column="id"/>
</p>
<p>
<htk-text form="iter" column="image"/>

View File

@ -55,11 +55,8 @@
<htk-text form="iter" column="item"/>
</h2>
<p class="tags">
<htk-text form="iter" column="tag5"/>
<htk-text form="iter" column="value5"/>,
<htk-text form="iter" column="tag6"/>
<htk-text form="iter" column="value6"/>,
<htk-text form="iter" column="tag7"/>
<htk-text form="iter" column="value5"/>
<htk-text form="iter" column="value6"/>
<htk-text form="iter" column="value7"/>
</p>
<p class="amount">

View File

@ -1,53 +1,46 @@
Hedera.Confirm = new Class
({
Extends: Hedera.Form
Hedera.Confirm = new Class({
Extends: Hedera.Form,
,open: function ()
{
this.close ();
open: function() {
this.close();
this.isOpen = true;
Hedera.BasketChecker.check (this.conn,
this.onBasketCheck.bind (this));
}
Hedera.BasketChecker.check(this.conn,
this.onBasketCheck.bind(this));
},
,onBasketCheck: function (isOk)
{
onBasketCheck: function(isOk) {
if (isOk)
this.loadUi ();
}
this.loadUi();
},
,onOrderReady: function (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'));
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'));
}
var total = form.get ('taxBase') + form.get ('tax');
var total = form.get('taxableBase') + form.get('tax');
if (total === null)
total = 0;
var credit = form.get ('credit');
var debt = form.get ('debt');
var credit = form.get('credit');
var debt = form.get('debt');
var totalDebt = debt + total;
var exceededCredit = totalDebt - credit;
var creditExceededCond = exceededCredit > 0;
if (creditExceededCond)
Htk.Toast.showWarning (
Htk.Toast.showWarning(
_('You have exceeded your credit.'));
this.$('debt').value = debt;
@ -58,12 +51,10 @@ Hedera.Confirm = new Class
this.$('pay-amount').value = 'ALL';
if (credit > 0)
{
if (credit > 0) {
this.$('credit-info').style.display = 'table-row';
if (creditExceededCond)
{
if (creditExceededCond) {
this.$('amount-selector').style.display = 'block';
this.$('exceeded-info').style.display = 'table-row';
this.$('pay-amount').value = 'EXCEEDED';
@ -72,21 +63,16 @@ Hedera.Confirm = new Class
var methods = [];
if (totalDebt <= 0)
{
if (totalDebt <= 0) {
methods = ['balance'];
selectedMethod = 'BALANCE';
}
else
{
} else {
methods = ['card', 'transfer', 'later'];
if (!creditExceededCond)
{
methods.push ('credit');
if (!creditExceededCond) {
methods.push('credit');
selectedMethod = 'CREDIT';
}
else
} else
selectedMethod = 'CARD';
}
@ -94,17 +80,15 @@ Hedera.Confirm = new Class
this.$(methods[i] +'-method').style.display = 'block';
this.$('pay-method').value = selectedMethod;
}
},
,onPayMethodChange: function (payMethod)
{
onPayMethodChange: function(payMethod) {
var id = this.displayedInfo;
if (id)
Vn.Node.removeClass (this.$(id), 'selected');
Vn.Node.removeClass(this.$(id), 'selected');
switch (payMethod.value)
{
switch (payMethod.value) {
case 'BALANCE':
id = 'balance-method';
break;
@ -124,48 +108,41 @@ Hedera.Confirm = new Class
this.displayedInfo = id;
if (id)
Vn.Node.addClass (this.$(id), 'selected');
}
Vn.Node.addClass(this.$(id), 'selected');
},
,disableButtons: function (disable)
{
disableButtons: function(disable) {
this.$('modify').disabled = disable;
this.$('confirm').disabled = disable;
}
},
,onModifyClick: function ()
{
onModifyClick: function() {
window.history.back();
}
},
,onConfirmClick: function ()
{
this.disableButtons (true);
this.$('confirm-query').execute ();
}
onConfirmClick: function() {
this.disableButtons(true);
this.$('confirm-query').execute();
},
,onConfirm: function (query, resultSet)
{
this.disableButtons (false);
onConfirm: function(query, resultSet) {
this.disableButtons(false);
if (resultSet.fetchResult ())
this.$('success-dialog').show ();
}
if (resultSet.fetchResult())
this.$('success-dialog').show();
},
,onDialogResponse: function ()
{
if (this.$('pay-method').value === 'CARD')
{
onDialogResponse: function() {
if (this.$('pay-method').value === 'CARD') {
if (this.$('pay-amount').value === 'EXCEEDED')
var payAmount = this.$('excess-amount').value;
else
var payAmount = this.$('total-amount').value;
var tpv = new Hedera.Tpv ({conn: this.conn});
tpv.pay (payAmount, this.$('order-form').get ('companyFk'));
}
else
this.hash.set ({'form': 'ecomerce/orders'});
var tpv = new Hedera.Tpv({conn: this.conn});
tpv.pay(payAmount, this.$('order-form').get('companyFk'));
} else
this.hash.set({'form': 'ecomerce/orders'});
}
});

View File

@ -4,9 +4,9 @@
<db-model property="model" result-index="1">
CALL basketGetTax;
SELECT o.id, o.sent, o.notes, o.companyFk,
ag.description agency, v.code method,
ad.nickname, ad.postalCode, ad.city, ad.street,
t.*, c.credit, myClientGetDebt(NULL) debt
ag.description agency, v.code method,
ad.nickname, ad.postalCode, ad.city, ad.street,
t.*, c.credit, myClientGetDebt(NULL) debt
FROM myBasket o
JOIN vn.agencyMode ag ON ag.id = o.agencyModeFk
LEFT JOIN myAddress ad ON ad.id = o.addressFk
@ -14,10 +14,11 @@
JOIN myClient c
JOIN (
SELECT
IFNULL(SUM(taxBase), 0) taxBase,
IFNULL(SUM(tax + equalizationTax), 0) tax
FROM tmp.orderTax
IFNULL(SUM(taxableBase), 0) taxableBase,
IFNULL(SUM(tax), 0) tax
FROM tmp.orderAmount
) t;
DROP TEMPORARY TABLE tmp.orderAmount;
DROP TEMPORARY TABLE tmp.orderTax;
</db-model>
</db-form>
@ -72,7 +73,7 @@
<t>Order total</t>
</td>
<td class="currency">
<htk-text format="%.2d€" form="order-form" column="taxBase"/>
<htk-text format="%.2d€" form="order-form" column="taxableBase"/>
</td>
</tr>
<tr>

View File

@ -1,6 +1,6 @@
{
"name": "hedera-web",
"version": "1.406.34",
"version": "1.406.35",
"description": "Verdnatura web page",
"license": "GPL-3.0",
"repository": {