diff --git a/db/changes/232401/00-ACLgetVehiclesSorted.sql b/db/changes/232401/00-ACLgetVehiclesSorted.sql index 5d3ec454d..6625f0d5c 100644 --- a/db/changes/232401/00-ACLgetVehiclesSorted.sql +++ b/db/changes/232401/00-ACLgetVehiclesSorted.sql @@ -1,3 +1,3 @@ INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalId`) VALUES - ('Vehicle','getVehiclesSorted','WRITE','ALLOW','employee'); \ No newline at end of file + ('Vehicle','sorted','WRITE','ALLOW','employee'); \ No newline at end of file diff --git a/e2e/paths/08-route/02_basic_data.spec.js b/e2e/paths/08-route/02_basic_data.spec.js index 7ab7dda42..6008b0482 100644 --- a/e2e/paths/08-route/02_basic_data.spec.js +++ b/e2e/paths/08-route/02_basic_data.spec.js @@ -24,7 +24,7 @@ describe('Route basic Data path', () => { const form = 'vn-route-basic-data form'; const values = { worker: 'adminBossNick', - vehicle: '1111-IMK', + vehicle: '1111-IMK - Warehouse One', created: nextMonth, kmStart: 1, kmEnd: 2, diff --git a/front/core/components/autocomplete/index.js b/front/core/components/autocomplete/index.js index 52491f7e0..2539c4ef4 100755 --- a/front/core/components/autocomplete/index.js +++ b/front/core/components/autocomplete/index.js @@ -174,7 +174,6 @@ export default class Autocomplete extends Field { refreshDisplayed() { let display = ''; - let hasTemplate = this.$transclude && this.$transclude.isSlotFilled('tplItem'); if (this._selection && this.showField) { if (this.multiple && Array.isArray(this._selection)) { @@ -182,19 +181,8 @@ export default class Autocomplete extends Field { if (display.length > 0) display += ', '; display += item[this.showField]; } - } else { + } else display = this._selection[this.showField]; - if (hasTemplate) { - let template = this.$transclude(() => {}, null, 'tplItem'); - const element = template[0]; - const description = element.querySelector('.text-secondary'); - if (description) description.remove(); - - const displayElement = angular.element(element); - const displayText = displayElement.text(); - display = this.$interpolate(displayText)(this._selection); - } - } } this.input.value = display; diff --git a/modules/route/back/methods/vehicle/getVehiclesSorted.js b/modules/route/back/methods/vehicle/sorted.js similarity index 85% rename from modules/route/back/methods/vehicle/getVehiclesSorted.js rename to modules/route/back/methods/vehicle/sorted.js index 384d89391..4231b77cb 100644 --- a/modules/route/back/methods/vehicle/getVehiclesSorted.js +++ b/modules/route/back/methods/vehicle/sorted.js @@ -1,5 +1,5 @@ module.exports = Self => { - Self.remoteMethod('getVehiclesSorted', { + Self.remoteMethod('sorted', { description: 'Sort the vehicles by warehouse', accessType: 'WRITE', accepts: [{ @@ -11,12 +11,12 @@ module.exports = Self => { root: true }, http: { - path: `/getVehiclesSorted`, + path: `/sorted`, verb: `POST` } }); - Self.getVehiclesSorted = async warehouseFk => { + Self.sorted = async warehouseFk => { const vehicles = await Self.rawSql(` SELECT ROW_NUMBER() OVER (ORDER BY v.warehouseFk = ? DESC, w.id, v.numberPlate) AS 'order', v.id, diff --git a/modules/route/back/models/vehicle.js b/modules/route/back/models/vehicle.js index 459afe1c2..73e321443 100644 --- a/modules/route/back/models/vehicle.js +++ b/modules/route/back/models/vehicle.js @@ -1,3 +1,3 @@ module.exports = Self => { - require('../methods/vehicle/getVehiclesSorted')(Self); + require('../methods/vehicle/sorted')(Self); }; diff --git a/modules/route/front/basic-data/index.html b/modules/route/front/basic-data/index.html index 1ba84583f..1d6e260a9 100644 --- a/modules/route/front/basic-data/index.html +++ b/modules/route/front/basic-data/index.html @@ -28,7 +28,8 @@ show-field="description" order="order" value-field="id" - label="Vehicle"> + label="Vehicle" + vn-name="vehicle"> diff --git a/modules/route/front/basic-data/index.js b/modules/route/front/basic-data/index.js index 80626e97e..a147a451c 100644 --- a/modules/route/front/basic-data/index.js +++ b/modules/route/front/basic-data/index.js @@ -12,7 +12,7 @@ class Controller extends Section { this.$http.get(`UserConfigs/getUserConfig`) .then(res => { if (res && res.data) { - this.$http.post(`Vehicles/getVehiclesSorted`, {warehouseFk: res.data.warehouseFk}) + this.$http.post(`Vehicles/sorted`, {warehouseFk: res.data.warehouseFk}) .then(res => { if (res && res.data) this.vehicles = res.data;