Merge pull request '6146-route-sugestedTicket-error' (!1722) from 6146-route-sugestedTicket-error into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #1722 Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
commit
cfbd24c721
|
@ -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
|
||||
};
|
||||
});
|
||||
};
|
||||
};
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
<vn-icon-button
|
||||
icon="link_off"
|
||||
class="pointer"
|
||||
title="{{'Unlink zone' | translate: {zoneName: ticket.zone.name, agencyName: ticket.agencyMode.name} }}"
|
||||
title="{{'Unlink zone' | translate: {zoneName: ticket.zone.name, agencyName: ticket.agencyName} }}"
|
||||
ng-click="unlinkZoneConfirmation.show(ticket)">
|
||||
</vn-icon-button>
|
||||
</vn-td>
|
||||
|
|
Loading…
Reference in New Issue