salix/modules/route/front/index/index.js

49 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-03-21 12:46:14 +00:00
import ngModule from '../module';
2020-03-17 14:24:55 +00:00
import Section from 'salix/components/section';
2019-03-21 12:46:14 +00:00
2020-03-17 14:24:55 +00:00
export default class Controller extends Section {
2020-08-25 08:00:21 +00:00
constructor($element, $, vnReport) {
super($element, $);
this.vnReport = vnReport;
}
preview(route) {
2019-03-21 12:46:14 +00:00
this.routeSelected = route;
2019-03-22 10:10:23 +00:00
this.$.summary.show();
2019-03-21 12:46:14 +00:00
}
2020-08-25 08:00:21 +00:00
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
});
}
2019-03-21 12:46:14 +00:00
}
2020-08-25 08:00:21 +00:00
Controller.$inject = ['$element', '$scope', 'vnReport'];
ngModule.vnComponent('vnRouteIndex', {
2019-03-21 12:46:14 +00:00
template: require('./index.html'),
controller: Controller
});