diff --git a/forms/ecomerce/catalog/catalog.js b/forms/ecomerce/catalog/catalog.js index 03db68a8..71c65d85 100644 --- a/forms/ecomerce/catalog/catalog.js +++ b/forms/ecomerce/catalog/catalog.js @@ -1,5 +1,7 @@ (function () { - + +var maxFilters = 5; + var View = { LIST: 0, GRID: 1 @@ -82,7 +84,6 @@ Hedera.Catalog = new Class icon: 'view-list', tip: _('List view') }); - this.view = View.GRID; var className = 'grid-view'; } else @@ -91,10 +92,10 @@ Hedera.Catalog = new Class icon: 'view-grid', tip: _('Grid view') }); - this.view = View.LIST; var className = 'list-view'; } + this.view = view; var node = this.$.gridView.node; node.className = className; localStorage.setItem ('hederaView', this.view); @@ -102,8 +103,8 @@ Hedera.Catalog = new Class ,onSwitchViewClick: function () { - this.setView (this.view === View.LIST ? - View.GRID : View.LIST); + this.setView (this.view === View.GRID ? + View.LIST : View.GRID); } ,onBasketReady: function (form) @@ -139,8 +140,14 @@ Hedera.Catalog = new Class this.$.items.query = this.buildQuery ('CALL catalogGetItems ()'); this.$.items.refresh (); - var tagsQuery = this.buildQuery ('CALL catalogGetTags ()'); - this.conn.execQuery (tagsQuery, this.onTagsReady.bind (this)); + var nTags = maxFilters - this.nFilters; + + if (nTags > 0) + { + var tagsQuery = this.buildQuery ( + 'CALL catalogGetTags (#nTags)', {nTags: nTags}); + this.conn.execQuery (tagsQuery, this.onTagsReady.bind (this)); + } this.hideMenu (); } @@ -154,7 +161,6 @@ Hedera.Catalog = new Class { this.$.filters.style.display = show ? 'block' : 'none'; this.$.categoryMsg.style.display = show ? 'none' : 'block'; - this.$.order.style.display = show ? 'block' : 'none'; } ,onRemoveFiltersClick: function () @@ -164,6 +170,7 @@ Hedera.Catalog = new Class } ,filters: {} + ,nFilters: 0 ,buildQuery: function (query, params, excludeTag) { @@ -342,9 +349,11 @@ Hedera.Catalog = new Class { this.$.currentFilters.removeChild (filter); delete this.filters[tagId]; + this.nFilters--; } else if (this.filters[tagId] === undefined) { + this.nFilters++; this.filters[tagId] = filterData; this.$.suggestedFilters.removeChild (filter); this.$.currentFilters.appendChild (filter); diff --git a/forms/ecomerce/catalog/style.css b/forms/ecomerce/catalog/style.css index 05a89b3f..ce3e7465 100644 --- a/forms/ecomerce/catalog/style.css +++ b/forms/ecomerce/catalog/style.css @@ -48,33 +48,6 @@ white-space: nowrap; overflow: hidden; } -.right-panel .filter -{ - padding: 1em 1.8em; -} -.right-panel .filters, -.right-panel .order -{ - display: none; -} -.right-panel .category-msg -{ - margin-top: 1em; -} -.right-panel .category-msg > h1 -{ - font-weight: normal; - text-align: center; - padding: 2.5em 0; - color: #777; -} -.right-panel h2 -{ - font-weight: normal; - padding: .4em 0; - color: #777; - font-size: 1.1em; -} .right-panel .categories { width: 95%; @@ -93,13 +66,20 @@ padding: 0; width: 100%; } -.right-panel .vn-filter, -.right-panel select +.right-panel .category-msg { - margin: 0 auto; - margin-bottom: .7em; - width: 90%; - display: block; + margin-top: 1em; +} +.right-panel .category-msg > h1 +{ + font-weight: normal; + text-align: center; + padding: 2.5em 0; + color: #777; +} +.right-panel .filters +{ + display: none; } .right-panel .filters > button { @@ -107,6 +87,13 @@ margin: 0 auto; margin-top: 1em; } +.right-panel .filters label +{ + font-size: .9em; + color: #666; + padding-top: .7em; + display: block; +} /* Items */ diff --git a/forms/ecomerce/catalog/ui.xml b/forms/ecomerce/catalog/ui.xml index 9857eb3f..a19b0f85 100755 --- a/forms/ecomerce/catalog/ui.xml +++ b/forms/ecomerce/catalog/ui.xml @@ -65,10 +65,10 @@ <db-model property="model" lot="card-lot"> - SELECT a.description, o.str origin - FROM vn2008.Articles a - LEFT JOIN vn_locale.origin_view o ON o.origin_id = a.id_origen - WHERE a.Id_Article = #item + SELECT i.description, o.name origin + FROM vn.item i + LEFT JOIN vn.originL10n o ON o.id = i.originFk + WHERE i.id = #item </db-model> </db-form> <db-model @@ -193,44 +193,41 @@ <div class="clear"/> </div> </div> - <div id="order" class="order"> - <h2>_Order by</h2> - <htk-combo - id="order-by" - on-change="onOrderChange" - value="relevancy" - not-null="true"/> - </div> <div id="category-msg" class="category-msg"> <h1>_Choose a category</h1> </div> <div id="filters" class="filters"> - <h2>_Filter by</h2> - <label>_Family</label> - <htk-combo - id="type" - name="type" - on-change="refreshTitle" - lot="params"> - <db-model - id="types" - property="model" - lot="params" - result-index="1"> - CALL item_available (); - SELECT DISTINCT t.id, l.name - FROM vn.itemType t - JOIN vn.item i ON i.typeFk = t.id - JOIN tmp.item_available a ON a.item_id = i.id - JOIN vn.itemTypeL10n l ON l.id = t.id - WHERE t.categoryFk = #category - ORDER BY name - </db-model> - </htk-combo> - <div id="current-filters"> - </div> - <div id="suggested-filters"> + <div> + <label>_Order by</label> + <htk-combo + id="order-by" + on-change="onOrderChange" + value="relevancy" + not-null="true"/> + <label>_Family</label> + <htk-combo + id="type" + name="type" + on-change="refreshTitle" + lot="params"> + <db-model + id="types" + property="model" + lot="params" + result-index="1"> + CALL itemGetAvailable; + SELECT DISTINCT t.id, l.name + FROM vn.itemType t + JOIN vn.item i ON i.typeFk = t.id + JOIN tmp.itemAvailable a ON a.id = i.id + JOIN vn.itemTypeL10n l ON l.id = t.id + WHERE t.categoryFk = #category + ORDER BY name + </db-model> + </htk-combo> </div> + <div id="current-filters"/> + <div id="suggested-filters"/> <button on-click="onRemoveFiltersClick" class="thin"> _Remove filters </button>