import ngModule from '../module'; export default class Controller { constructor($, $state) { this.$state = $state; Object.assign(this, { $, selectedWorker: null, }); } onSearch(params) { if (params) this.$.model.applyFilter(null, params); else this.$.model.clear(); } preview(event, worker) { if (event.defaultPrevented) return; event.preventDefault(); event.stopPropagation(); this.selectedWorker = worker; this.$.preview.show(); } goToTimeControl(event, workerId) { if (event.defaultPrevented) return; event.preventDefault(); event.stopPropagation(); this.$state.go('worker.card.timeControl', {id: workerId}, {absolute: true}); } onMoreChange(callback) { callback.call(this); } } Controller.$inject = ['$scope', '$state']; ngModule.component('vnWorkerIndex', { template: require('./index.html'), controller: Controller });