import ngModule from '../module'; export default class Controller { constructor($scope, vnToken) { this.accessToken = vnToken.token; this.$ = $scope; this.ticketSelected = null; this.filter = { include: [ { relation: 'agencyMode', scope: { fields: ['name'] } }, { relation: 'vehicle', scope: { fields: ['numberPlate'] } }, { relation: 'worker', scope: { fields: ['userFk'], include: { relation: 'user', scope: { fields: ['nickname'] } } } }, ] }; } exprBuilder(param, value) { switch (param) { case 'search': return {id: value}; case 'from': return {created: {gte: value}}; case 'to': return {created: {lte: value}}; case 'workerFk': case 'vehicleFk': case 'agencyModeFk': case 'm3': case 'description': return {[param]: value}; } } showWorkerDescriptor(event, userId) { if (event.defaultPrevented) return; event.preventDefault(); event.stopPropagation(); this.selectedWorker = userId; this.$.workerDescriptor.parent = event.target; this.$.workerDescriptor.show(); } preview(event, route) { this.routeSelected = route; this.$.dialogSummaryClaim.show(); event.preventDefault(); event.stopImmediatePropagation(); } } Controller.$inject = ['$scope', 'vnToken']; ngModule.component('vnRouteIndex', { template: require('./index.html'), controller: Controller });