-
-
+
+
+
+ SELECT title, date_time, text, image, id FROM news
+ WHERE tag = 'course'
+ ORDER BY priority, date_time DESC
+
+
+
+
+
diff --git a/package/usr/share/hedera-web/forms/ecomerce/catalog/catalog.js b/package/usr/share/hedera-web/forms/ecomerce/catalog/catalog.js
index 8e8096e1..135d2eb3 100755
--- a/package/usr/share/hedera-web/forms/ecomerce/catalog/catalog.js
+++ b/package/usr/share/hedera-web/forms/ecomerce/catalog/catalog.js
@@ -10,61 +10,66 @@ Vn.Catalog = new Class
this.popup = new Htk.Popup ();
this.popup.setChildNode (this.$('lots-popup'));
}
-
- ,onRealmsReload: function (model, status)
+
+ ,typeRenderer: function (builder, form)
{
- if (status != Db.Model.Status.READY)
- return;
-
- this.onRealmChange ();
- this.onTypeChange ();
+ var link = builder.$('link');
+ link.href = this.hash.make ({'type': form.get ('tipo_id')}, true);
}
- ,onRealmChange: function ()
+ ,realmRenderer: function (builder, form)
{
- var color;
- var realms = this.$('realms-model');
- var row = realms.search ('id', this.$('realm').value);
-
- if (row != -1)
- this.realmColor = '#'+ realms.get (row, 'color');
- else
- this.realmColor = null;
- }
-
- ,onTypesReload: function (model, status)
- {
- if (status == Db.Model.Status.READY)
- this.refreshTitle ();
+ var link = builder.$('link');
+ link.href = this.hash.make ({
+ 'form': this.hash.get ('form'),
+ 'realm': form.get ('id')
+ });
+
+ var img = builder.$('image');
+ img.src = 'image/family/'+ form.get ('id') +'.svg';
+ img.title = form.get ('reino');
+ img.alt = img.title;
}
,onTypeChange: function ()
{
if (Vn.isMobile ())
this.hideMenu ();
+
+ var realms = this.$('realms-model');
+
+ if (!realms.ready)
+ return;
this.refreshTitle ();
var color = null;
if (this.$('type').value)
- color = this.realmColor;
+ {
+ var row = realms.search ('id', this.$('realm').value);
+
+ if (row != -1)
+ color = '#'+ realms.get (row, 'color');
+ }
this.$('header').style.backgroundColor = color;
- var itemsGrid = this.$('items-grid').getNode ();
- var thead = itemsGrid.getElementsByTagName ('thead')[0];
- var tr = thead.getElementsByTagName ('tr')[0];
+ var tr = this.$('items-grid').getNode ().querySelector ('thead tr');
tr.style.backgroundColor = color;
}
,refreshTitle: function (title)
{
- var title = null;
+ var types = this.$('types-model');
+
+ if (!types.ready)
+ return;
+
+ var title = _('Catalog');
if (this.$('type').value)
{
- var types = this.$('types-model');
var row = types.search ('tipo_id', this.$('type').value);
if (row != -1)
@@ -73,8 +78,7 @@ Vn.Catalog = new Class
else if (this.$('search-entry').value)
title = _('SearchResults');
- if (title)
- Vn.Node.setText (this.$('title'), title);
+ Vn.Node.setText (this.$('title'), title);
}
,onSearch: function (event)
@@ -128,12 +132,7 @@ Vn.Catalog = new Class
{
renderer.value = form.get ('Medida') +' '+ form.get ('Categoria') +' '+ form.get ('Color');
}
-
- ,typeRenderer: function (column, form)
- {
- column.href = this.hash.make ({'type': form.get ('tipo_id')}, true);
- }
-
+
,amountRender: function (renderer, form)
{
var amount = form.get ('amount');
@@ -234,89 +233,3 @@ Vn.Catalog = new Class
}
});
-Htk.Realm = new Class
-({
- Extends: Htk.Field
- ,Tag: 'htk-realm'
- ,Properties:
- {
- model:
- {
- type: Db.Model
- ,set: function (x)
- {
- x.indexColumn ('id');
- this.link ({_model: x}, {'status-changed': this.onModelReload});
- this.onModelReload (x);
- }
- ,get: function ()
- {
- return this._model;
- }
- }
- }
-
- ,_model: null
- ,selectedImg: null
-
- ,initialize: function (props)
- {
- this.parent (props);
- this.createElement ('div');
- this.node.className = 'htk-realm';
- }
-
- ,onModelReload: function (model)
- {
- Vn.Node.removeChilds (this.node);
-
- if (model.status != Db.Model.Status.READY)
- return;
-
- var width = parseInt (100 / model.numRows) +'%';
-
- for (var i = 0; i < model.numRows; i++)
- {
- var id = model.get (i, 'id');
-
- var img = document.createElement ('img');
-// img.src = Vn.Config['image_dir'] +'/family/full/'+ id +'.png';
- img.src = 'image/family/'+ id +'.svg';
- img.title = model.get (i, 'reino');
- img.alt = img.title;
- img.style.width = width;
- img.style.backgroundColor = '#'+ model.get ('color');
- img.addEventListener ('click', this.clicked.bind (this, img, id));
- this.node.appendChild (img);
-
- if (id == this.value)
- this.focusImage (img);
- }
- }
-
- ,focusImage: function (img)
- {
- if (this.selectedImg)
- this.selectedImg.className = '';
-
- img.className = 'selected';
- this.selectedImg = img;
- }
-
- ,clicked: function (img, value)
- {
- this.focusImage (img);
-
- if (value != this.value)
- this.valueChanged (value);
- }
-
- ,putValue: function (value)
- {
- var row = this._model.search ('id', value);
-
- if (row != -1)
- this.focusImage (this.node.childNodes[row]);
- }
-});
-
diff --git a/package/usr/share/hedera-web/forms/ecomerce/catalog/style.css b/package/usr/share/hedera-web/forms/ecomerce/catalog/style.css
index 961f078f..c18be55b 100755
--- a/package/usr/share/hedera-web/forms/ecomerce/catalog/style.css
+++ b/package/usr/share/hedera-web/forms/ecomerce/catalog/style.css
@@ -106,7 +106,7 @@ button.basket
font-size: 1.1em;
text-align: center;
background-color: #00BCD4;
- box-shadow: 0 0.2em 0.2em #BBB;
+ border-radius: 0;
}
button.basket:hover
{
@@ -115,19 +115,26 @@ button.basket:hover
/* Realms */
-.htk-realm
+.realms-box
{
- text-align: center;
- vertical-align: middle;
+ text-align: left;
box-shadow: 0 0 0.4em #AAA;
+ background-color: rgba(1, 1, 1, .1);
}
-.htk-realm img
+.realms-box a
{
+ display: inline-block;
+ line-height: 0;
+ width: 33.3%;
+}
+.realms-box a > img
+{
+ width: 100%;
+ border: 0;
padding: 0;
- max-height: 4em;
cursor: pointer;
}
-.htk-realm img:hover
+.realms-box img:hover
{
opacity: 0.85;
}
@@ -137,39 +144,20 @@ button.basket:hover
.types-box
{
position: absolute;
- top: 6.8em;
+ top: 14.6em;
bottom: 0;
right: 0;
left: 0;
overflow: auto;
}
-.types
-{
- width: 100%;
-}
-.types > thead
-{
- display: none;
-}
-.types > tbody > tr
-{
- border-top: none;
- height: 2.2em;
-}
-.types > tbody a
+.types-box a
{
+ padding: .5em 1.5em;
display: block;
- padding: 0.3em 7%;
- width: 88%;
- height: 100%;
}
-.types tbody a:hover
+.types-box a:hover
{
- background-color: #EEE;
-}
-.types td.grid-message
-{
- padding-top: 1em;
+ background-color: rgba(1, 1, 1, .1);
}
/* Grid view */
diff --git a/package/usr/share/hedera-web/forms/ecomerce/catalog/ui.xml b/package/usr/share/hedera-web/forms/ecomerce/catalog/ui.xml
index 0568a6ae..7691ba43 100755
--- a/package/usr/share/hedera-web/forms/ecomerce/catalog/ui.xml
+++ b/package/usr/share/hedera-web/forms/ecomerce/catalog/ui.xml
@@ -1,13 +1,12 @@
+
+
+
-
- SELECT id, reino, color FROM vn2008.reinos
- WHERE display != FALSE ORDER BY reino
-
@@ -20,11 +19,17 @@
CALL bionic_from_type (@calc, #type);
- SELECT t.item_id, SUM(t.available) available, MIN(t.price) price,
+ SELECT t.item_id, SUM(t.available) - IFNULL(m.amount, 0) available, MIN(t.price) price,
a.Foto, a.Article, a.Categoria, a.Medida, a.Tallos, a.Color, o.Abreviatura
FROM cache.bionic t
JOIN vn2008.Articles a ON a.Id_Article = t.item_id
LEFT JOIN vn2008.Origen o ON a.id_origen = o.id
+ LEFT JOIN (
+ SELECT item_id, SUM(amount) amount
+ FROM basket_item
+ GROUP BY item_id
+ ) m
+ ON m.item_id = t.item_id
WHERE t.calc_id = @calc AND t.available > 0
GROUP BY item_id
ORDER BY a.Article, a.Medida
@@ -35,8 +40,16 @@
CALL bionic_from_type (@calc, #type);
- SELECT l.warehouse_id, l.items, l.grouping, l.price, l.rate, b.available
+ SELECT l.warehouse_id, l.items, l.grouping, l.price, l.rate,
+ t.amount, b.available - IFNULL(t.amount, 0) available
FROM cache.bionic b
+ LEFT JOIN (
+ SELECT warehouse_id, SUM(amount) amount
+ FROM basket_item
+ WHERE item_id = #item
+ GROUP BY warehouse_id
+ ) t
+ ON t.warehouse_id = b.warehouse_id
JOIN cache.bionic_lot l
ON l.warehouse_id = b.warehouse_id
AND l.item_id = b.item_id
@@ -97,22 +110,39 @@
ShoppingBasket
-
-
-
-
-
-
-
-
- CALL type_list (#realm)
-
-
-
-
-
-
-
+
+
+ SELECT id, reino, color FROM vn2008.reinos
+ WHERE display != FALSE ORDER BY reino
+
+
+
+
+
+
+
+
+
+ CALL type_list (#realm)
+
+
+
+
+
+
+
+
+
+