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

71 lines
2.0 KiB
JavaScript
Raw Normal View History

2019-03-22 10:07:44 +00:00
import ngModule from '../module';
2019-11-10 10:08:44 +00:00
import ModuleCard from 'salix/components/module-card';
2019-03-22 10:07:44 +00:00
2019-11-10 10:08:44 +00:00
class Controller extends ModuleCard {
reload() {
let filter = {
2019-03-23 15:16:47 +00:00
fields: [
'id',
'workerFk',
'agencyModeFk',
'created',
'm3',
'warehouseFk',
'description',
'vehicleFk',
'kmStart',
'kmEnd',
'started',
'finished',
2019-10-16 05:18:05 +00:00
'cost',
'zoneFk'
2019-03-23 15:16:47 +00:00
],
2019-03-22 10:07:44 +00:00
include: [
{
relation: 'agencyMode',
scope: {
fields: ['id', 'name']
}
2019-11-10 10:08:44 +00:00
}, {
2019-03-22 10:07:44 +00:00
relation: 'vehicle',
scope: {
fields: ['id', 'm3']
}
2019-11-10 10:08:44 +00:00
}, {
2019-10-16 05:18:05 +00:00
relation: 'zone',
scope: {
fields: ['id', 'name']
}
},
{
relation: 'worker',
scope: {
fields: ['userFk'],
include: {
relation: 'user',
scope: {
fields: ['id'],
include: {
relation: 'emailUser',
scope: {
fields: ['email']
}
}
}
}
}
2019-03-22 10:07:44 +00:00
}
]
};
2019-11-10 10:08:44 +00:00
this.$http.get(`Routes/${this.$params.id}`, {filter})
.then(res => this.route = res.data);
2019-03-22 10:07:44 +00:00
}
}
ngModule.vnComponent('vnRouteCard', {
2019-03-22 10:07:44 +00:00
template: require('./index.html'),
controller: Controller
});