import ngModule from '../../module'; class Controller { constructor($scope, $stateParams) { this.$stateParams = $stateParams; this.$ = $scope; this.filter = { include: [ { relation: 'atender', scope: { include: { relation: 'user', scope: { fields: ['nickname'] } } } }, { relation: 'requester', scope: { include: { relation: 'user', scope: { fields: ['nickname'] } } } }, { relation: 'sale' } ] }; } removeLine(index) { this.$.model.remove(index); this.$.watcher.check(); this.$.model.save().then(() => { this.$.watcher.notifySaved(); this.$.watcher.updateOriginalData(); }); } showItemDescriptor(event, sale) { this.quicklinks = { btnThree: { icon: 'icon-transaction', state: `item.card.diary({ id: ${sale.itemFk}, ticketFk: ${this.$stateParams.id} })`, tooltip: 'Item diary' } }; this.$.itemDescriptor.itemFk = sale.itemFk; this.$.itemDescriptor.parent = event.target; this.$.itemDescriptor.show(); } showWorkerDescriptor(event, userId) { event.preventDefault(); event.stopImmediatePropagation(); this.selectedWorker = userId; this.$.workerDescriptor.parent = event.target; this.$.workerDescriptor.show(); } } Controller.$inject = ['$scope', '$stateParams']; ngModule.component('vnTicketRequestIndex', { template: require('./index.html'), controller: Controller });