From 245243aa147aa8a52cb2804ad04051a98208754c Mon Sep 17 00:00:00 2001 From: carlosjr Date: Wed, 5 May 2021 13:36:54 +0200 Subject: [PATCH 1/4] routes without vehicle or vehicles without drop off now throw --- .../back/methods/route/getDeliveryPoint.js | 7 ++-- modules/route/front/tickets/index.html | 42 ++++++++++--------- modules/route/front/tickets/index.js | 15 ++++--- modules/route/front/tickets/locale/es.yml | 4 +- 4 files changed, 39 insertions(+), 29 deletions(-) diff --git a/modules/route/back/methods/route/getDeliveryPoint.js b/modules/route/back/methods/route/getDeliveryPoint.js index 59b22904f..e5a50805a 100644 --- a/modules/route/back/methods/route/getDeliveryPoint.js +++ b/modules/route/back/methods/route/getDeliveryPoint.js @@ -1,12 +1,12 @@ module.exports = Self => { Self.remoteMethod('getDeliveryPoint', { - description: 'get the deliveryPoint address ', + description: 'get the deliveryPoint address', accessType: 'WRITE', accepts: { arg: 'vehicleId', type: 'number', - required: true, description: 'vehicle id asigned in the route', + required: true, http: {source: 'path'} }, returns: { @@ -21,8 +21,9 @@ module.exports = Self => { Self.getDeliveryPoint = async vehicleId => { let vehicle = await Self.app.models.Vehicle.findById(vehicleId); - let deliveryPoint = await Self.app.models.DeliveryPoint.findById(vehicle.deliveryPointFk); + if (!vehicle.deliveryPointFk) return; + let deliveryPoint = await Self.app.models.DeliveryPoint.findById(vehicle.deliveryPointFk); return deliveryPoint.ubication; }; diff --git a/modules/route/front/tickets/index.html b/modules/route/front/tickets/index.html index 92a112747..3c4bb439b 100644 --- a/modules/route/front/tickets/index.html +++ b/modules/route/front/tickets/index.html @@ -5,9 +5,10 @@ data="$ctrl.tickets" auto-load="true"> - +
- + - + @@ -31,14 +32,14 @@ model="model"> - Order - Ticket + Order + Street + City + PC Client Packages - Warehouse - PC - Street + Ticket @@ -50,21 +51,18 @@ ng-model="ticket.checked"> - + + class="dense" + display-controls=true> - - - {{ticket.id}} - - + {{ticket.address.street}} + {{ticket.address.city}} + {{ticket.address.postalCode}} {{ticket.packages}} {{::ticket.volume | number:1}} - {{ticket.warehouse.name}} - {{ticket.address.postalCode}} - {{ticket.address.street}} + + + {{ticket.id}} + + { - deliveryPointAddress = response.data; - }).then(() => { - addresses = deliveryPointAddress; + if (!response.data) + throw new UserError(`The route's vehicle doesn't have a delivery point`); + + return response.data; + }).then(address => { + let addresses; + if (address) addresses = address; let lines = this.getSelectedItems(this.tickets); let url = 'http://gps.buscalia.com/usuario/localizar.aspx?bmi=true&addr='; diff --git a/modules/route/front/tickets/locale/es.yml b/modules/route/front/tickets/locale/es.yml index 042f5227b..e1abd31b4 100644 --- a/modules/route/front/tickets/locale/es.yml +++ b/modules/route/front/tickets/locale/es.yml @@ -8,4 +8,6 @@ Add ticket: Añadir ticket Tickets to add: Tickets a añadir Ticket not found: No se ha encontrado el ticket The selected ticket is not suitable for this route: El ticket seleccionado no es apto para esta ruta -PC: CP \ No newline at end of file +PC: CP +The route's vehicle doesn't have a delivery point: El vehículo de la ruta no tiene un punto de entrega +The route doesn't have a vehicle: La ruta no tiene un vehículo \ No newline at end of file From 657896bce07bb8d31146e474671abeb57799eeb4 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Mon, 10 May 2021 10:32:00 +0200 Subject: [PATCH 2/4] increased section width --- modules/route/front/tickets/index.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/route/front/tickets/index.html b/modules/route/front/tickets/index.html index 3c4bb439b..306e4d94a 100644 --- a/modules/route/front/tickets/index.html +++ b/modules/route/front/tickets/index.html @@ -7,7 +7,9 @@ - + Date: Mon, 10 May 2021 10:39:51 +0200 Subject: [PATCH 3/4] transaltion changes --- modules/route/front/tickets/locale/es.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/route/front/tickets/locale/es.yml b/modules/route/front/tickets/locale/es.yml index e1abd31b4..ebf9be25b 100644 --- a/modules/route/front/tickets/locale/es.yml +++ b/modules/route/front/tickets/locale/es.yml @@ -9,5 +9,5 @@ Tickets to add: Tickets a añadir Ticket not found: No se ha encontrado el ticket The selected ticket is not suitable for this route: El ticket seleccionado no es apto para esta ruta PC: CP -The route's vehicle doesn't have a delivery point: El vehículo de la ruta no tiene un punto de entrega +The route's vehicle doesn't have a delivery point: El vehículo de la ruta no tiene un almacén de salida The route doesn't have a vehicle: La ruta no tiene un vehículo \ No newline at end of file From ac917b6115bbdf6e889a9ae283b90dbb64d4c8ec Mon Sep 17 00:00:00 2001 From: carlosjr Date: Mon, 10 May 2021 10:46:17 +0200 Subject: [PATCH 4/4] mino changes on translations --- modules/route/front/tickets/index.js | 2 +- modules/route/front/tickets/locale/es.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/route/front/tickets/index.js b/modules/route/front/tickets/index.js index 238e80d27..3619335c8 100644 --- a/modules/route/front/tickets/index.js +++ b/modules/route/front/tickets/index.js @@ -56,7 +56,7 @@ class Controller extends Section { this.$http.get(query).then(response => { if (!response.data) - throw new UserError(`The route's vehicle doesn't have a delivery point`); + throw new UserError(`The route's vehicle doesn't have a departing warehouse`); return response.data; }).then(address => { diff --git a/modules/route/front/tickets/locale/es.yml b/modules/route/front/tickets/locale/es.yml index ebf9be25b..6fa29e5ca 100644 --- a/modules/route/front/tickets/locale/es.yml +++ b/modules/route/front/tickets/locale/es.yml @@ -9,5 +9,5 @@ Tickets to add: Tickets a añadir Ticket not found: No se ha encontrado el ticket The selected ticket is not suitable for this route: El ticket seleccionado no es apto para esta ruta PC: CP -The route's vehicle doesn't have a delivery point: El vehículo de la ruta no tiene un almacén de salida +The route's vehicle doesn't have a departing warehouse: El vehículo de la ruta no tiene un almacén de salida The route doesn't have a vehicle: La ruta no tiene un vehículo \ No newline at end of file