From b5b7770f3f19cbea1d63d5806cd790bfeeb48ede Mon Sep 17 00:00:00 2001 From: jgallego Date: Thu, 24 Aug 2023 10:41:28 +0200 Subject: [PATCH] refs #6146 fixes: muestra la agencia de la ruta --- .../back/methods/route/getSuggestedTickets.js | 19 +++++++++++++++++-- modules/route/front/ticket-popup/index.html | 12 ++++++------ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/modules/route/back/methods/route/getSuggestedTickets.js b/modules/route/back/methods/route/getSuggestedTickets.js index c1a9c7cae..e1b90d359 100644 --- a/modules/route/back/methods/route/getSuggestedTickets.js +++ b/modules/route/back/methods/route/getSuggestedTickets.js @@ -24,7 +24,14 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - const route = await Self.app.models.Route.findById(id, null, myOptions); + const route = await Self.app.models.Route.findById(id, { + include: { + relation: 'agencyMode', + scope: { + fields: ['name'] + } + } + }, myOptions); const zoneAgencyModes = await Self.app.models.ZoneAgencyMode.find({ where: { @@ -35,11 +42,13 @@ module.exports = Self => { const zoneIds = []; for (let zoneAgencyMode of zoneAgencyModes) zoneIds.push(zoneAgencyMode.zoneFk); + const minDate = new Date(route.created); minDate.setHours(0, 0, 0, 0); const maxDate = new Date(route.created); maxDate.setHours(23, 59, 59, 59); + let tickets = await Self.app.models.Ticket.find({ where: { zoneFk: {inq: zoneIds}, @@ -80,6 +89,12 @@ module.exports = Self => { ] }, myOptions); - return tickets; + return tickets.map(ticket => { + const simpleTicket = ticket.toJSON(); + return { + ...simpleTicket, + agencyName: route.agencyMode().name + }; + }); }; }; diff --git a/modules/route/front/ticket-popup/index.html b/modules/route/front/ticket-popup/index.html index 99e3364b8..5046d5e43 100644 --- a/modules/route/front/ticket-popup/index.html +++ b/modules/route/front/ticket-popup/index.html @@ -19,17 +19,17 @@ - Ticket Client Province - + - Population - + Population + PC Address @@ -39,7 +39,7 @@ - @@ -62,7 +62,7 @@