import ngModule from '../module'; import Section from 'salix/components/section'; export default class Controller extends Section { constructor($element, $, vnReport) { super($element, $); this.vnReport = vnReport; } preview(route) { this.routeSelected = route; this.$.summary.show(); } get checked() { const rows = this.$.model.data || []; const checkedRows = []; for (let row of rows) { if (row.checked) checkedRows.push(row); } return checkedRows; } get totalChecked() { return this.checked.length; } showRouteReport() { const routes = []; for (let route of this.checked) routes.push(route.id); const routesId = routes.join(','); this.vnReport.show('driver-route', { authorization: this.vnToken.token, routeId: routesId }); } } Controller.$inject = ['$element', '$scope', 'vnReport']; ngModule.vnComponent('vnRouteIndex', { template: require('./index.html'), controller: Controller });