diff --git a/modules/route/back/methods/route/driverRoutePdf.js b/modules/route/back/methods/route/driverRoutePdf.js index 161eb71af..65748afad 100644 --- a/modules/route/back/methods/route/driverRoutePdf.js +++ b/modules/route/back/methods/route/driverRoutePdf.js @@ -6,9 +6,9 @@ module.exports = Self => { accepts: [ { arg: 'id', - type: 'number', + type: 'string', required: true, - description: 'The client id', + description: 'The route id', http: {source: 'path'} }, { diff --git a/modules/route/front/index/index.js b/modules/route/front/index/index.js index 6845bf73f..9258c8fac 100644 --- a/modules/route/front/index/index.js +++ b/modules/route/front/index/index.js @@ -39,10 +39,7 @@ export default class Controller extends Section { routes.push(route.id); const routesId = routes.join(','); - this.vnReport.show('driver-route', { - authorization: this.vnToken.token, - routeId: routesId - }); + this.vnReport.show(`Routes/${routesId}/driver-route-pdf`); } openClonationDialog() { diff --git a/modules/route/front/index/index.spec.js b/modules/route/front/index/index.spec.js index 37386bc38..05dd56433 100644 --- a/modules/route/front/index/index.spec.js +++ b/modules/route/front/index/index.spec.js @@ -49,14 +49,12 @@ describe('Component vnRouteIndex', () => { const data = controller.$.model.data; data[0].checked = true; data[2].checked = true; - const expectedParams = { - authorization: null, - routeId: '1,3' - }; + + const routeIds = '1,3'; controller.showRouteReport(); - expect(controller.vnReport.show).toHaveBeenCalledWith('driver-route', expectedParams); + expect(controller.vnReport.show).toHaveBeenCalledWith(`Routes/${routeIds}/driver-route-pdf`); }); }); diff --git a/print/templates/reports/driver-route/driver-route.js b/print/templates/reports/driver-route/driver-route.js index 2de3d5192..b142a446e 100755 --- a/print/templates/reports/driver-route/driver-route.js +++ b/print/templates/reports/driver-route/driver-route.js @@ -14,6 +14,9 @@ module.exports = { const routes = await this.fetchRoutes(ids); const tickets = await this.fetchTickets(ids); + if (!tickets || !tickets.id) + throw new Error('This route(s) not have ticket(s)'); + const map = new Map(); for (let route of routes) diff --git a/print/templates/reports/driver-route/locale/es.yml b/print/templates/reports/driver-route/locale/es.yml index 3fb6b6885..d065d62e0 100644 --- a/print/templates/reports/driver-route/locale/es.yml +++ b/print/templates/reports/driver-route/locale/es.yml @@ -20,6 +20,7 @@ phone: Teléfono warehouse: Almacén salesPerson: Comercial import: Importe -route: Ruta +route: Ruta routeId: Ruta {0} -ticket: Ticket \ No newline at end of file +ticket: Ticket +This route(s) not have ticket(s): Esta ruta(s) no tiene ticket(s)