import ngModule from '../module'; export default class Controller { constructor($scope, vnToken) { this.accessToken = vnToken.token; this.$ = $scope; this.selectedInvoiceOut = null; } showClientDescriptor(event, clientFk) { this.$.clientDescriptor.clientFk = clientFk; this.$.clientDescriptor.parent = event.target; this.$.clientDescriptor.show(); event.preventDefault(); event.stopImmediatePropagation(); } preview(event, invoiceOut) { this.selectedInvoiceOut = invoiceOut; this.$.summary.show(); event.preventDefault(); event.stopImmediatePropagation(); } onDescriptorLoad() { this.$.popover.relocate(); } openPdf(id, event) { let url = `api/InvoiceOuts/${id}/download?access_token=${this.accessToken}`; window.open(url, '_blank'); event.preventDefault(); event.stopImmediatePropagation(); } onSearch(params) { if (params) this.$.model.applyFilter(null, params); else this.$.model.clear(); } } Controller.$inject = ['$scope', 'vnToken']; ngModule.component('vnInvoiceOutIndex', { template: require('./index.html'), controller: Controller });