diff --git a/forms/ecomerce/basket/basket.js b/forms/ecomerce/basket/basket.js
index ea5e98ef..d6b48b36 100644
--- a/forms/ecomerce/basket/basket.js
+++ b/forms/ecomerce/basket/basket.js
@@ -39,14 +39,18 @@ Hedera.Basket = new Class
this.hash.setAll ({form: 'ecomerce/confirm'});
}
- ,repeaterFunc: function (res, lot)
+ ,repeaterFunc: function (scope, lot)
{
- res.$.subtotal.value = this.subtotal (lot);
+ var $ = lot.$;
+ scope.$.subtotal.value = this.subtotal (lot);
- if (lot.$.amount > lot.$.available)
- Vn.Node.addClass (res.$.available, 'unavailable');
+ if ($.available <= 0)
+ text = _('Not available');
else
- Vn.Node.removeClass (res.$.available, 'unavailable');
+ text = $.available +' '+ _('availables');
+
+ Vn.Node.setText (scope.$.available, text);
+ Vn.Node.setVisible (scope.$.available, $.available < $.amount);
}
,onDeleteClick: function (button)
diff --git a/forms/ecomerce/basket/style.css b/forms/ecomerce/basket/style.css
index 56d6abde..c2d9b57d 100644
--- a/forms/ecomerce/basket/style.css
+++ b/forms/ecomerce/basket/style.css
@@ -55,13 +55,9 @@
/* Fields */
.basket ._available
-{
- visibility: hidden;
-}
-.basket ._available.unavailable
{
color: red;
- visibility: visible;
+ visibility: hidden;
}
.basket .icon > img
{
diff --git a/forms/ecomerce/basket/ui.xml b/forms/ecomerce/basket/ui.xml
index e6d67324..3cfa2b39 100755
--- a/forms/ecomerce/basket/ui.xml
+++ b/forms/ecomerce/basket/ui.xml
@@ -27,8 +27,9 @@
-
- SELECT r.id, r.amount, r.price, 0 available,
+
+ SET @a = -8;
+ SELECT r.id, r.amount, r.price, @a := @a + 4 available,
i.name, i.size, i.category, i.image
FROM basket_item r
JOIN vn.item i ON i.id = r.item_id
diff --git a/forms/ecomerce/confirm/confirm.js b/forms/ecomerce/confirm/confirm.js
index 940b4da2..63594a2c 100644
--- a/forms/ecomerce/confirm/confirm.js
+++ b/forms/ecomerce/confirm/confirm.js
@@ -25,16 +25,9 @@ Hedera.Confirm = new Class
var order = form.params;
- if (order.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 isPickup = order.method == 'PICKUP';
+ Vn.Node.display (this.$.address, !isPickup);
+ Vn.Node.setText (this.$.address, _(isPickup ? 'Warehouse' : 'Agency'));
var total = order.taxBase + order.vat;
diff --git a/js/hedera/tpv.js b/js/hedera/tpv.js
index f757122d..285ce3e5 100644
--- a/js/hedera/tpv.js
+++ b/js/hedera/tpv.js
@@ -104,9 +104,9 @@ module.exports = new Class
path += location.pathname;
path += location.search ? location.search : '';
path += this.hash.make ({
- 'form': 'ecomerce/orders',
- 'tpvStatus': status,
- 'tpvOrder': '%s'
+ form: 'ecomerce/orders',
+ tpvStatus: status,
+ tpvOrder: '%s'
}, true);
return path;
diff --git a/js/htk/style.css b/js/htk/style.css
index 07ef4a4c..13ca048b 100644
--- a/js/htk/style.css
+++ b/js/htk/style.css
@@ -136,7 +136,7 @@ td.cell-image .htk-image
.htk-combo
{
- line-height: 2.2em;
+ line-height: 2.1em;
}
.htk-combo > .text
{
diff --git a/js/vn/compiler-element.js b/js/vn/compiler-element.js
index 5452e889..daaa8fa1 100644
--- a/js/vn/compiler-element.js
+++ b/js/vn/compiler-element.js
@@ -80,7 +80,7 @@ module.exports = new Class
{
var id = context.nodeId;
object.setAttribute ('id', scope.getHtmlId (id));
- object.className = '_'+ id +' '+ object.className;
+ VnNode.addClass (object, '_'+ id);
}
return object;
diff --git a/js/vn/component.js b/js/vn/component.js
index 7629d898..75e97692 100644
--- a/js/vn/component.js
+++ b/js/vn/component.js
@@ -38,7 +38,7 @@ module.exports = Klass.implement
}
,get: function ()
{
- return this._node.className;
+ return this._className;
}
},
/**
@@ -91,11 +91,6 @@ module.exports = Klass.implement
else if (child instanceof Element)
this._node.appendChild (child);
}
-
- ,addEventListener: function (eventName, callback)
- {
- this.node.addEventListener (eventName, callback);
- }
,on: function (id, callback, instance)
{
diff --git a/js/vn/node.js b/js/vn/node.js
index e6f8dac9..496ace95 100644
--- a/js/vn/node.js
+++ b/js/vn/node.js
@@ -48,7 +48,7 @@ module.exports =
*/
,setText: function (node, text)
{
- Vn.Node.removeChilds (node);
+ this.removeChilds (node);
if (text)
node.appendChild (
@@ -59,7 +59,7 @@ module.exports =
* Adds a class to the node CSS classes. Note that this
* function doesn't check if the node already has the class.
*
- * @param {Node} node The HTML Node
+ * @param {Node} node The HTML element
* @param {string} className The CSS class name
*/
,addClass: function (node, className)
@@ -71,7 +71,7 @@ module.exports =
* Removes a class from the node CSS classes. This functions
* removes all ocurrences of the class from the node.
*
- * @param {Node} node The HTML Node
+ * @param {Node} node The HTML element
* @param {string} className The CSS class name
*/
,removeClass: function (node, className)
@@ -93,20 +93,49 @@ module.exports =
/**
* Hides the node from the document.
*
- * @param {Node} node The HTML Node
+ * @param {Node} node The HTML element
*/
,hide: function (node)
{
- node.style.display = 'none';
+ node.style.visibility = 'none';
}
/**
* Shows a hidden node.
*
- * @param {Node} node The hidden HTML Node
+ * @param {Node} node The HTML element
+ * @param {String} displayValue The CSS display value when it's displayed,
+ * if it isn't specified 'block' is used
*/
- ,show: function (node)
+ ,show: function (node, displayValue)
{
- node.style.display = 'block';
+ node.style.display = displayValue ? displayValue : 'block';
+ }
+
+ /**
+ * Shows or hides node.
+ *
+ * @param {Node} node The HTML element
+ * @param {Boolean} display Wheter to display the node
+ * @param {String} displayValue The CSS display value when it's displayed,
+ * if it isn't specified 'block' is used
+ */
+ ,display: function (node, display, displayValue)
+ {
+ if (display)
+ this.show (node, displayValue);
+ else
+ this.hide (node);
+ }
+
+ /**
+ * Shows or hides node.
+ *
+ * @param {Node} node The HTML Node
+ * @param {Boolean} visible Wheter to display the node
+ */
+ ,setVisible: function (node, visible)
+ {
+ node.style.visibility = visible ? 'visible' : 'hidden';
}
};