diff --git a/e2e/paths/08-route/02_basic_data.spec.js b/e2e/paths/08-route/02_basic_data.spec.js index 4c30f85d9..fe7fbe0fb 100644 --- a/e2e/paths/08-route/02_basic_data.spec.js +++ b/e2e/paths/08-route/02_basic_data.spec.js @@ -22,7 +22,7 @@ describe('Route basic Data path', () => { nextMonth.setMonth(nextMonth.getMonth() + 1); await page.autocompleteSearch(selectors.routeBasicData.worker, 'adminBossNick'); - await page.autocompleteSearch(selectors.routeBasicData.vehicle, '1111-IMK - Warehouse One'); + await page.autocompleteSearch(selectors.routeBasicData.vehicle, '3333-BAT - Warehouse One'); await page.pickDate(selectors.routeBasicData.createdDate, nextMonth); await page.clearInput(selectors.routeBasicData.kmStart); await page.write(selectors.routeBasicData.kmStart, '1'); diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 33741d395..17a0cf3a2 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -273,7 +273,9 @@ "Not exist this branch": "La rama no existe", "This ticket cannot be signed because it has not been boxed": "Este ticket no puede firmarse porque no ha sido encajado", "Insert a date range": "Inserte un rango de fechas", - "Added observation": "{{user}} añadió esta observacion: {{text}}", - "Comment added to client": "Observación añadida al cliente {{clientFk}}", - "Cannot create a new claimBeginning from a different ticket": "No se puede crear una línea de reclamación de un ticket diferente al origen" -} + "Added observation": "{{user}} añadió esta observacion: {{text}}", + "Comment added to client": "Observación añadida al cliente {{clientFk}}", + "Cannot create a new claimBeginning from a different ticket": "No se puede crear una línea de reclamación de un ticket diferente al origen", + "Valid priorities: 1,2,3": "Valid priorities: 1,2,3", + "No se pueden borrar tickets con abonos asociados. Este ticket está asociado al abono Nº 2": "No se pueden borrar tickets con abonos asociados. Este ticket está asociado al abono Nº 2" +} \ No newline at end of file diff --git a/modules/route/back/methods/vehicle/getVehiclesSorted.js b/modules/route/back/methods/vehicle/getVehiclesSorted.js index 50b0e51ff..b785e5dc8 100644 --- a/modules/route/back/methods/vehicle/getVehiclesSorted.js +++ b/modules/route/back/methods/vehicle/getVehiclesSorted.js @@ -1,5 +1,5 @@ module.exports = Self => { - Self.remoteMethodCtx('getVehiclesSorted', { + Self.remoteMethod('getVehiclesSorted', { description: 'Sort the vehicles by a warehouse', accessType: 'WRITE', accepts: [{ @@ -16,16 +16,13 @@ module.exports = Self => { } }); - Self.getVehiclesSorted = async(ctx, options) => { - const args = ctx.args; - + Self.getVehiclesSorted = async warehouseFk => { const vehicles = await Self.rawSql(` SELECT v.id, v.numberPlate, w.name FROM vehicle v - JOIN warehouse w ON w.id = v.warehouseFk - WHERE v.warehouseFk = ? - ORDER BY v.warehouseFk DESC, v.numberPlate ASC`, args.warehouseFk); + JOIN warehouse w ON w.id = v.warehouseFk + ORDER BY v.warehouseFk = ? DESC, v.numberPlate ASC`, [warehouseFk]); - return [vehicles]; + return vehicles; }; }; diff --git a/modules/route/front/basic-data/index.html b/modules/route/front/basic-data/index.html index a99f45d4a..d4b33e36e 100644 --- a/modules/route/front/basic-data/index.html +++ b/modules/route/front/basic-data/index.html @@ -21,7 +21,6 @@
{{name}} - {{nickname}}
- {{$ctrl.route.vehicleFk}} - {{numberPlate}} - {{warehouse.name}} + {{numberPlate}} - {{name}} diff --git a/modules/route/front/basic-data/index.js b/modules/route/front/basic-data/index.js index f3f06d6e0..80626e97e 100644 --- a/modules/route/front/basic-data/index.js +++ b/modules/route/front/basic-data/index.js @@ -9,7 +9,16 @@ class Controller extends Section { } constructor($element, $) { super($element, $); - this.$http.post(`Vehicles/getVehiclesSorted`, {params: {warehouseFk: 1}}); + this.$http.get(`UserConfigs/getUserConfig`) + .then(res => { + if (res && res.data) { + this.$http.post(`Vehicles/getVehiclesSorted`, {warehouseFk: res.data.warehouseFk}) + .then(res => { + if (res && res.data) + this.vehicles = res.data; + }); + } + }); } }