65 lines
1.5 KiB
JavaScript
65 lines
1.5 KiB
JavaScript
import ngModule from '../module';
|
|
|
|
export default class Controller {
|
|
constructor($stateParams, $http) {
|
|
this.$http = $http;
|
|
this.$stateParams = $stateParams;
|
|
this.route = null;
|
|
this.filter = {
|
|
fields: [
|
|
'id',
|
|
'workerFk',
|
|
'agencyModeFk',
|
|
'created',
|
|
'm3',
|
|
'warehouseFk',
|
|
'description',
|
|
'vehicleFk',
|
|
'kmStart',
|
|
'kmEnd',
|
|
'started',
|
|
'finished',
|
|
'cost'
|
|
],
|
|
|
|
where: {id: $stateParams.id},
|
|
include: [
|
|
{
|
|
relation: 'agencyMode',
|
|
scope: {
|
|
fields: ['id', 'name']
|
|
}
|
|
},
|
|
{
|
|
relation: 'vehicle',
|
|
scope: {
|
|
fields: ['id', 'm3']
|
|
}
|
|
}
|
|
]
|
|
};
|
|
}
|
|
|
|
$onInit() {
|
|
this.getCard();
|
|
}
|
|
|
|
getCard() {
|
|
let json = encodeURIComponent(JSON.stringify(this.filter));
|
|
this.$http.get(`/client/api/Routes?filter=${json}`).then(response => {
|
|
this.route = response.data[0];
|
|
});
|
|
}
|
|
|
|
reload() {
|
|
this.getCard();
|
|
}
|
|
}
|
|
Controller.$inject = ['$stateParams', '$http'];
|
|
|
|
ngModule.component('vnRouteCard', {
|
|
template: require('./index.html'),
|
|
controller: Controller
|
|
});
|
|
|