0
1
Fork 0
This commit is contained in:
Juan Ferrer Toribio 2017-11-23 17:06:28 +01:00
parent 7b54145da6
commit b9c14883c4
9 changed files with 59 additions and 41 deletions

View File

@ -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)

View File

@ -55,13 +55,9 @@
/* Fields */
.basket ._available
{
visibility: hidden;
}
.basket ._available.unavailable
{
color: red;
visibility: visible;
visibility: hidden;
}
.basket .icon > img
{

View File

@ -27,8 +27,9 @@
</p>
</div>
<htk-repeater renderer="repeaterFunc">
<db-model id="items" property="model" updatable="true">
SELECT r.id, r.amount, r.price, 0 available,
<db-model id="items" property="model" updatable="true" result-index="1">
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

View File

@ -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;

View File

@ -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;

View File

@ -136,7 +136,7 @@ td.cell-image .htk-image
.htk-combo
{
line-height: 2.2em;
line-height: 2.1em;
}
.htk-combo > .text
{

View File

@ -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;

View File

@ -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)
{

View File

@ -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';
}
};