import ngModule from '../module'; class Controller { constructor($scope, $http, $stateParams) { this.$scope = $scope; this.$http = $http; this.$stateParams = $stateParams; this.filter = { include: [{ relation: 'item' }] }; this.ticketVolumes = []; } get sales() { return this._sales; } set sales(value) { this._sales = value; if (value) this.applyVolumes(); } get volumes() { return this._volumes; } set volumes(value) { this._volumes = value; if (value) this.applyVolumes(); } applyVolumes() { if (!this.sales || !this.volumes) return; this.sales.forEach(sale => { this.volumes.forEach(volume => { if (sale.id === volume.saleFk) sale.volume = volume; }); }); } showDescriptor(event, itemFk) { this.quicklinks = { btnThree: { icon: 'icon-transaction', state: `item.card.diary({ id: ${itemFk}, warehouseFk: ${this.ticket.warehouseFk}, ticketFk: ${this.ticket.id} })`, tooltip: 'Item diary' } }; this.$scope.descriptor.itemFk = itemFk; this.$scope.descriptor.parent = event.target; this.$scope.descriptor.show(); } onDescriptorLoad() { this.$scope.popover.relocate(); } } Controller.$inject = ['$scope', '$http', '$stateParams']; ngModule.component('vnTicketVolume', { template: require('./index.html'), controller: Controller, bindings: { ticket: '<' } });