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: ' - + diff --git a/client/salix/src/locale/es.json b/client/salix/src/locale/es.json index f2bc551fc..fc0932817 100644 --- a/client/salix/src/locale/es.json +++ b/client/salix/src/locale/es.json @@ -9,5 +9,7 @@ "Can't contact with server": "No se pudo contactar con el servidor", "Push on applications menu": "Para abrir un módulo pulsa en el menú de aplicaciones", "Clients": "Clientes", + "Routes" : "Rutas", + "Production" : "Producción", "Modules access" : "Acceso a módulos" } \ No newline at end of file diff --git a/services/route/common/models/zone.json b/services/route/common/models/zone.json new file mode 100644 index 000000000..a7a45bd27 --- /dev/null +++ b/services/route/common/models/zone.json @@ -0,0 +1,33 @@ +{ + "name": "Zone", + "base": "MyModel", + "validateUpsert": true, + "properties": { + "id": { + "id": true, + "type": "Number", + "forceId": false + }, + "name": { + "type": "String" + }, + "printingOrder":{ + "type": "Number" + } + }, + "acls": [ + { + "accessType": "*", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "DENY" + }, + { + "accessType": "*", + "principalType": "ROLE", + "principalId": "root", + "permission": "ALLOW" + } + ] + } + \ No newline at end of file diff --git a/services/route/server/model-config.json b/services/route/server/model-config.json index 904b02b80..da305afb0 100644 --- a/services/route/server/model-config.json +++ b/services/route/server/model-config.json @@ -44,5 +44,8 @@ }, "Delivery": { "dataSource": "vn" + }, + "Zone": { + "dataSource": "vn" } }