2020-02-05 11:44:14 +00:00
|
|
|
import ngModule from '../module';
|
2020-04-25 09:50:04 +00:00
|
|
|
import DescriptorPopover from 'salix/components/descriptor-popover';
|
2020-02-05 11:44:14 +00:00
|
|
|
|
2020-04-25 09:50:04 +00:00
|
|
|
class Controller extends DescriptorPopover {
|
2020-02-05 11:44:14 +00:00
|
|
|
get route() {
|
2020-04-25 09:50:04 +00:00
|
|
|
return this.entity;
|
2020-02-05 11:44:14 +00:00
|
|
|
}
|
|
|
|
|
2020-04-25 09:50:04 +00:00
|
|
|
loadData() {
|
|
|
|
const filter = {
|
2020-02-05 11:44:14 +00:00
|
|
|
fields: [
|
|
|
|
'id',
|
|
|
|
'workerFk',
|
|
|
|
'agencyModeFk',
|
|
|
|
'created',
|
|
|
|
'm3',
|
|
|
|
'warehouseFk',
|
|
|
|
'description',
|
|
|
|
'vehicleFk',
|
|
|
|
'kmStart',
|
|
|
|
'kmEnd',
|
|
|
|
'started',
|
|
|
|
'finished',
|
|
|
|
'cost',
|
|
|
|
'zoneFk'
|
|
|
|
],
|
|
|
|
include: [
|
|
|
|
{
|
|
|
|
relation: 'agencyMode',
|
|
|
|
scope: {
|
|
|
|
fields: ['id', 'name']
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
relation: 'vehicle',
|
|
|
|
scope: {
|
|
|
|
fields: ['id', 'm3']
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
relation: 'zone',
|
|
|
|
scope: {
|
|
|
|
fields: ['id', 'name']
|
|
|
|
}
|
2020-04-25 09:50:04 +00:00
|
|
|
}, {
|
2020-02-05 11:44:14 +00:00
|
|
|
relation: 'worker',
|
|
|
|
scope: {
|
|
|
|
fields: ['userFk'],
|
|
|
|
include: {
|
|
|
|
relation: 'user',
|
|
|
|
scope: {
|
|
|
|
fields: ['id'],
|
|
|
|
include: {
|
|
|
|
relation: 'emailUser',
|
|
|
|
scope: {
|
|
|
|
fields: ['email']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
2020-04-25 09:50:04 +00:00
|
|
|
|
|
|
|
return this.getData(`Routes/${this.id}`, {filter})
|
|
|
|
.then(res => this.entity = res.data);
|
2020-02-05 11:44:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-25 09:50:04 +00:00
|
|
|
ngModule.vnComponent('vnRouteDescriptorPopover', {
|
|
|
|
slotTemplate: require('./index.html'),
|
|
|
|
controller: Controller
|
2020-02-05 11:44:14 +00:00
|
|
|
});
|