From b93a39f0a934a9607033a9f94d58c3917c098189 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 14 Oct 2015 13:51:43 +0200 Subject: [PATCH] Alpha --- web/forms/account/address/ui.xml | 6 +- web/forms/admin/access-log/ui.xml | 6 +- web/forms/agencies/provinces/ui.xml | 6 +- web/forms/ecomerce/catalog/catalog.js | 94 +++-- web/forms/ecomerce/catalog/filter-button.xml | 11 - web/forms/ecomerce/catalog/style.css | 60 ++- web/forms/ecomerce/catalog/ui.xml | 280 +++++++------ web/forms/ecomerce/checkout/checkout.js | 10 +- web/forms/ecomerce/ticket/ui.xml | 6 +- web/forms/news/new/ui.xml | 6 +- web/index.php | 2 + web/js/htk/field/select.js | 86 ++-- web/js/htk/style.css | 7 + web/js/sql/operation.js | 10 +- web/js/sql/search-tags.js | 2 +- web/js/vn/builder.js | 402 +++++++++++++++++-- web/js/vn/hash-param.js | 2 +- web/js/vn/object.js | 3 + 18 files changed, 717 insertions(+), 282 deletions(-) delete mode 100644 web/forms/ecomerce/catalog/filter-button.xml diff --git a/web/forms/account/address/ui.xml b/web/forms/account/address/ui.xml index a3f7888d..5186226f 100755 --- a/web/forms/account/address/ui.xml +++ b/web/forms/account/address/ui.xml @@ -1,8 +1,8 @@ - - - + + + diff --git a/web/forms/admin/access-log/ui.xml b/web/forms/admin/access-log/ui.xml index 8742652a..5578cb2b 100755 --- a/web/forms/admin/access-log/ui.xml +++ b/web/forms/admin/access-log/ui.xml @@ -1,8 +1,8 @@ - - - + + + SELECT Id_Cliente, Cliente, Telefono, movil diff --git a/web/forms/agencies/provinces/ui.xml b/web/forms/agencies/provinces/ui.xml index ac37cc8d..b359d01b 100755 --- a/web/forms/agencies/provinces/ui.xml +++ b/web/forms/agencies/provinces/ui.xml @@ -1,8 +1,8 @@ - - - + + +

ByProvince

diff --git a/web/forms/ecomerce/catalog/catalog.js b/web/forms/ecomerce/catalog/catalog.js index a55043b5..8a585edf 100755 --- a/web/forms/ecomerce/catalog/catalog.js +++ b/web/forms/ecomerce/catalog/catalog.js @@ -1,7 +1,4 @@ -Vn.resource ('forms/ecomerce/catalog/filter-button.xml'); -Vn.define (function () { - Vn.Catalog = new Class ({ Extends: Vn.Module @@ -345,21 +342,12 @@ Vn.Catalog = new Class if (this.popup) this.popup.reset (); } - - ,onSelectClick: function (select, e) - { - console.debug ('Select clicked!'); - console.debug (select, e); - - if (select.model.status === Db.Model.Status.CLEAN) - select.model.refresh (); - } }); -Vn.FilterButton = new Class +Vn.Filter = new Class ({ Extends: Htk.Widget - ,Tag: 'vn-filter-button' + ,Tag: 'vn-filter' ,Child: 'model' ,Properties: { @@ -368,7 +356,7 @@ Vn.FilterButton = new Class type: Db.Model ,set: function (x) { - this._grid.model = x; + this._select.model = x; this._model = x; } ,get: function () @@ -376,17 +364,17 @@ Vn.FilterButton = new Class return this._model; } }, - text: + placeholder: { type: String ,set: function (x) { - Vn.Node.setText (this._button, x);; - this._text = x; + this._select.placeholder = x; + this._placeholder = x; } ,get: function () { - return this._text; + return this._placeholder; } }, column: @@ -394,41 +382,72 @@ Vn.FilterButton = new Class type: String ,set: function (x) { - this._col.column = x; + this._column = x; } ,get: function () { - return this._col.column; + return this._column; } }, } + ,_columnIndex: 1 + ,initialize: function (props) { this.parent (props); - this.builderInit ('forms/ecomerce/catalog/filter-button.xml'); - this._button = this.createElement ('button'); - this._button.className = 'vn-filter-button thin'; - this._button.addEventListener ('click', this._onButtonClick.bind (this)); + this.createElement ('div'); + this.node.className = 'vn-filter'; - this._grid = new Htk.Grid (); - this._grid.showHeader = false; + this._select = new Htk.Select (); + this._select.on ('mousedown', this._onClick.bind (this)); + this._select.on ('changed', this._onChange.bind (this)); + this.node.appendChild (this._select.getNode ()); - this._col = new Htk.ColumnText (); - this._grid.appendColumn (this._col); + this._ul = document.createElement ('ul'); + this.node.appendChild (this._ul); } - ,_onButtonClick: function () + ,_onClick: function () { - if (!this._model) - return; - - this._model.refresh (); + if (this._model && this._model.status === Db.Model.Status.CLEAN) + this._model.refresh (); + } - var popup = new Htk.Popup (); - popup.setChild (this._grid); - popup.show (this._button); + ,_onCloseClick: function (li) + { + Vn.Node.remove (li); + } + + ,_onChange: function () + { + if (this._select.value === null + || this._select.value === undefined) + return; + + var li = document.createElement ('li'); + this._ul.appendChild (li); + + var button = document.createElement ('button'); + button.addEventListener ('click', + this._onCloseClick.bind (this, li)); + li.appendChild (button); + + var img = document.createElement ('img'); + img.src = 'image/close.svg'; + button.appendChild (img); + + var label = this._select.getByIndex (this._columnIndex); + var text = document.createTextNode (label); + li.appendChild (text); + + setTimeout (this._onTimeout.bind (this)); + } + + ,_onTimeout: function () + { + this._select.value = null; } }); @@ -459,4 +478,3 @@ Vn.ColumnItem = new Class } }); -}); diff --git a/web/forms/ecomerce/catalog/filter-button.xml b/web/forms/ecomerce/catalog/filter-button.xml deleted file mode 100644 index e524a102..00000000 --- a/web/forms/ecomerce/catalog/filter-button.xml +++ /dev/null @@ -1,11 +0,0 @@ - -