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 @@