diff --git a/modules/ticket/back/methods/ticket-tracking/setDelivered.js b/modules/ticket/back/methods/ticket-tracking/setDelivered.js index 94cbad7a22..509f5b4460 100644 --- a/modules/ticket/back/methods/ticket-tracking/setDelivered.js +++ b/modules/ticket/back/methods/ticket-tracking/setDelivered.js @@ -35,11 +35,11 @@ module.exports = Self => { let worker = await models.Worker.findOne({where: {userFk: userId}}); let promises = []; - for (let i = 0; i < ticketIds.length; i++) { + for (let id of ticketIds) { let promise = models.TicketTracking.changeState(ctx, { stateFk: state.id, workerFk: worker.id, - ticketFk: ticketIds[i] + ticketFk: id }); promises.push(promise); } diff --git a/modules/ticket/front/index/index.js b/modules/ticket/front/index/index.js index 0cf076d612..2c8b9b83c1 100644 --- a/modules/ticket/front/index/index.js +++ b/modules/ticket/front/index/index.js @@ -4,6 +4,10 @@ import UserError from 'core/lib/user-error'; import './style.scss'; export default class Controller extends Section { + constructor($element, $, vnReport) { + super($element, $); + this.vnReport = vnReport; + } setDelivered() { const checkedTickets = this.checked; let ids = []; @@ -25,13 +29,9 @@ export default class Controller extends Section { openDeliveryNotes(ids) { for (let id of ids) { - const params = { - authorization: this.vnToken.token, - ticketId: id - }; - - const serializedParams = this.$httpParamSerializer(params); - window.open(`api/report/delivery-note?${serializedParams}`); ``; + this.vnReport.show('delivery-note', { + ticketId: id, + }); } } @@ -156,6 +156,7 @@ export default class Controller extends Section { return [minHour, maxHour]; } } +Controller.$inject = ['$element', '$scope', 'vnReport']; ngModule.component('vnTicketIndex', { template: require('./index.html'),