6146-route-sugestedTicket-error #1722
|
@ -24,7 +24,14 @@ module.exports = Self => {
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
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({
|
const zoneAgencyModes = await Self.app.models.ZoneAgencyMode.find({
|
||||||
where: {
|
where: {
|
||||||
|
@ -35,11 +42,13 @@ module.exports = Self => {
|
||||||
const zoneIds = [];
|
const zoneIds = [];
|
||||||
for (let zoneAgencyMode of zoneAgencyModes)
|
for (let zoneAgencyMode of zoneAgencyModes)
|
||||||
zoneIds.push(zoneAgencyMode.zoneFk);
|
zoneIds.push(zoneAgencyMode.zoneFk);
|
||||||
|
|
||||||
const minDate = new Date(route.created);
|
const minDate = new Date(route.created);
|
||||||
minDate.setHours(0, 0, 0, 0);
|
minDate.setHours(0, 0, 0, 0);
|
||||||
|
|
||||||
const maxDate = new Date(route.created);
|
const maxDate = new Date(route.created);
|
||||||
maxDate.setHours(23, 59, 59, 59);
|
maxDate.setHours(23, 59, 59, 59);
|
||||||
|
|
||||||
let tickets = await Self.app.models.Ticket.find({
|
let tickets = await Self.app.models.Ticket.find({
|
||||||
where: {
|
where: {
|
||||||
zoneFk: {inq: zoneIds},
|
zoneFk: {inq: zoneIds},
|
||||||
|
@ -80,6 +89,12 @@ module.exports = Self => {
|
||||||
]
|
]
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
return tickets;
|
return tickets.map(ticket => {
|
||||||
|
const simpleTicket = ticket.toJSON();
|
||||||
|
return {
|
||||||
|
...simpleTicket,
|
||||||
|
agencyName: route.agencyMode().name
|
||||||
|
};
|
||||||
|
});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,17 +19,17 @@
|
||||||
<vn-thead>
|
<vn-thead>
|
||||||
<vn-tr>
|
<vn-tr>
|
||||||
<vn-th shrink>
|
<vn-th shrink>
|
||||||
<vn-multi-check
|
<vn-multi-check
|
||||||
model="model">
|
model="model">
|
||||||
</vn-multi-check>
|
</vn-multi-check>
|
||||||
</vn-th>
|
</vn-th>
|
||||||
<vn-th number>Ticket</vn-th>
|
<vn-th number>Ticket</vn-th>
|
||||||
<vn-th>Client</vn-th>
|
<vn-th>Client</vn-th>
|
||||||
<vn-th shrink>Province</vn-th>
|
<vn-th shrink>Province</vn-th>
|
||||||
<vn-th shrink>
|
<vn-th shrink>
|
||||||
<span translate>
|
<span translate>
|
||||||
Population
|
Population
|
||||||
</span>
|
</span>
|
||||||
</vn-th>
|
</vn-th>
|
||||||
<vn-th expand>PC</vn-th>
|
<vn-th expand>PC</vn-th>
|
||||||
<vn-th>Address</vn-th>
|
<vn-th>Address</vn-th>
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
<vn-tbody>
|
<vn-tbody>
|
||||||
<vn-tr ng-repeat="ticket in $ctrl.possibleTickets">
|
<vn-tr ng-repeat="ticket in $ctrl.possibleTickets">
|
||||||
<vn-td shrink>
|
<vn-td shrink>
|
||||||
<vn-check
|
<vn-check
|
||||||
ng-model="ticket.checked">
|
ng-model="ticket.checked">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
|
@ -62,7 +62,7 @@
|
||||||
<vn-icon-button
|
<vn-icon-button
|
||||||
icon="link_off"
|
icon="link_off"
|
||||||
class="pointer"
|
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)">
|
ng-click="unlinkZoneConfirmation.show(ticket)">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
|
|
Loading…
Reference in New Issue