diff --git a/client/core/src/autocomplete/autocomplete.js b/client/core/src/autocomplete/autocomplete.js index f0e6eb304..a4e04a9be 100644 --- a/client/core/src/autocomplete/autocomplete.js +++ b/client/core/src/autocomplete/autocomplete.js @@ -19,6 +19,7 @@ class Autocomplete extends Component { this.maxRow = 10; this.showField = this.showField || 'name'; this.valueField = this.valueField || 'id'; + this.order = this.order || 'name ASC'; this.items = this.data || []; this.displayValueMultiCheck = []; this._multiField = []; @@ -219,38 +220,45 @@ class Autocomplete extends Component { } getItems() { let filter = {}; + if (!this.finding) { + this.finding = true; - if (this.maxRow) { - if (this.items) { - filter.skip = this.items.length; - } - filter.limit = this.maxRow; - filter.order = 'name ASC'; - } - - let json = JSON.stringify(filter); - - this.removeLoadMore = false; - - this.$http.get(`${this.url}?filter=${json}`).then( - json => { - if (json.data.length) { - json.data.forEach( - el => { - if (this.multiple) { - el.checked = this.field.indexOf(el[this.valueField]) !== -1; - } - this.items.push(el); - } - ); - if (filter.skip === 0 && this.maxRow && json.data.length < this.maxRow) { - this.removeLoadMore = true; - } - } else { - this.maxRow = false; + if (this.maxRow) { + if (this.items) { + filter.skip = this.items.length; } + filter.limit = this.maxRow; + filter.order = this.order; } - ); + + let json = JSON.stringify(filter); + + this.removeLoadMore = false; + + this.$http.get(`${this.url}?filter=${json}`).then( + json => { + if (json.data.length) { + json.data.forEach( + el => { + if (this.multiple) { + el.checked = this.field.indexOf(el[this.valueField]) !== -1; + } + this.items.push(el); + } + ); + if (filter.skip === 0 && this.maxRow && json.data.length < this.maxRow) { + this.removeLoadMore = true; + } + } else { + this.maxRow = false; + } + this.finding = false; + }, + () => { + this.finding = false; + } + ); + } } $onInit() { this.findMore = this.url && this.maxRow; @@ -308,7 +316,8 @@ module.component('vnAutocomplete', { data: '', field: '=', label: '@', - multiple: '@?' + multiple: '@?', + order: '@?' }, transclude: { tplItem: '?tplItem' diff --git a/client/production/src/locale/en.json b/client/production/src/locale/en.json index 9e26dfeeb..bb52c33b6 100644 --- a/client/production/src/locale/en.json +++ b/client/production/src/locale/en.json @@ -1 +1,3 @@ -{} \ No newline at end of file +{ + "Production" : "Production" +} \ No newline at end of file diff --git a/client/route/routes.json b/client/route/routes.json index b1b9358c9..cc7b42a3f 100644 --- a/client/route/routes.json +++ b/client/route/routes.json @@ -1,6 +1,6 @@ { "module": "route", - "name": "Route", + "name": "Routes", "icon" : "local_shipping", "validations" : false, "routes": [ diff --git a/client/route/src/locale/en.json b/client/route/src/locale/en.json new file mode 100644 index 000000000..ff0fd857e --- /dev/null +++ b/client/route/src/locale/en.json @@ -0,0 +1,3 @@ +{ + "Routes" : "Routes" +} diff --git a/client/route/src/locale/es.json b/client/route/src/locale/es.json index 0db3279e4..616431fe5 100644 --- a/client/route/src/locale/es.json +++ b/client/route/src/locale/es.json @@ -1,3 +1,3 @@ { - + "Routes" : "Rutas" } diff --git a/client/route/src/search-panel/search-panel.html b/client/route/src/search-panel/search-panel.html index 7249bbd9c..a262c06b8 100644 --- a/client/route/src/search-panel/search-panel.html +++ b/client/route/src/search-panel/search-panel.html @@ -2,7 +2,13 @@