2019-03-21 12:46:14 +00:00
|
|
|
import ngModule from '../module';
|
|
|
|
|
|
|
|
export default class Controller {
|
2019-10-09 22:47:29 +00:00
|
|
|
constructor($scope, vnToken, vnConfig) {
|
2019-03-21 12:46:14 +00:00
|
|
|
this.accessToken = vnToken.token;
|
|
|
|
this.$ = $scope;
|
2019-10-09 22:47:29 +00:00
|
|
|
this.vnConfig = vnConfig;
|
2019-05-02 11:25:41 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2019-10-09 22:47:29 +00:00
|
|
|
this.filter = {from, to, warehouseFk: this.vnConfig.warehouseFk};
|
2019-03-21 12:46:14 +00:00
|
|
|
}
|
|
|
|
|
2019-04-25 06:28:08 +00:00
|
|
|
showWorkerDescriptor(event, workerFk) {
|
2019-03-21 12:46:14 +00:00
|
|
|
if (event.defaultPrevented) return;
|
|
|
|
|
|
|
|
event.preventDefault();
|
2019-04-25 06:28:08 +00:00
|
|
|
event.stopImmediatePropagation();
|
2019-03-21 12:46:14 +00:00
|
|
|
|
2019-04-25 06:28:08 +00:00
|
|
|
this.selectedWorker = workerFk;
|
2019-03-21 12:46:14 +00:00
|
|
|
this.$.workerDescriptor.parent = event.target;
|
|
|
|
this.$.workerDescriptor.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
preview(event, route) {
|
|
|
|
this.routeSelected = route;
|
2019-03-22 10:10:23 +00:00
|
|
|
this.$.summary.show();
|
2019-03-21 12:46:14 +00:00
|
|
|
event.preventDefault();
|
|
|
|
event.stopImmediatePropagation();
|
|
|
|
}
|
2019-04-25 06:28:08 +00:00
|
|
|
|
|
|
|
onSearch(params) {
|
|
|
|
if (params)
|
|
|
|
this.$.model.applyFilter(null, params);
|
|
|
|
else
|
|
|
|
this.$.model.clear();
|
|
|
|
}
|
2019-03-21 12:46:14 +00:00
|
|
|
}
|
|
|
|
|
2019-10-09 22:47:29 +00:00
|
|
|
Controller.$inject = ['$scope', 'vnToken', 'vnConfig'];
|
2019-03-21 12:46:14 +00:00
|
|
|
|
|
|
|
ngModule.component('vnRouteIndex', {
|
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller
|
|
|
|
});
|