2019-03-21 12:46:14 +00:00
|
|
|
import ngModule from '../module';
|
|
|
|
|
|
|
|
export default class Controller {
|
|
|
|
constructor($scope, vnToken) {
|
|
|
|
this.accessToken = vnToken.token;
|
|
|
|
this.$ = $scope;
|
|
|
|
|
|
|
|
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;
|
2019-03-22 10:10:23 +00:00
|
|
|
this.$.summary.show();
|
2019-03-21 12:46:14 +00:00
|
|
|
event.preventDefault();
|
|
|
|
event.stopImmediatePropagation();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Controller.$inject = ['$scope', 'vnToken'];
|
|
|
|
|
|
|
|
ngModule.component('vnRouteIndex', {
|
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller
|
|
|
|
});
|