import ngModule from '../module'; export default class Controller { constructor($scope, vnToken) { this.accessToken = vnToken.token; this.$ = $scope; this.setDefaultFilter(); } setDefaultFilter() { let to = new Date(); to.setDate(to.getDate() + 1); to.setHours(0, 0, 0, 0); let from = new Date(); from.setHours(0, 0, 0, 0); this.filter = {from, to, warehouseFk: localStorage.defaultWarehouseFk}; } showWorkerDescriptor(event, workerFk) { if (event.defaultPrevented) return; event.preventDefault(); event.stopImmediatePropagation(); this.selectedWorker = workerFk; this.$.workerDescriptor.parent = event.target; this.$.workerDescriptor.show(); } preview(event, route) { this.routeSelected = route; this.$.summary.show(); event.preventDefault(); event.stopImmediatePropagation(); } onSearch(params) { if (params) this.$.model.applyFilter(null, params); else this.$.model.clear(); } } Controller.$inject = ['$scope', 'vnToken']; ngModule.component('vnRouteIndex', { template: require('./index.html'), controller: Controller });