salix/modules/travel/front/descriptor-popover/index.js

44 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-02-18 09:33:17 +00:00
import ngModule from '../module';
2020-04-25 09:50:04 +00:00
import DescriptorPopover from 'salix/components/descriptor-popover';
2020-02-18 09:33:17 +00:00
2020-04-25 09:50:04 +00:00
class Controller extends DescriptorPopover {
get travel() {
return this.entity;
2020-02-18 09:33:17 +00:00
}
loadData() {
2020-04-25 09:50:04 +00:00
const filter = {
2020-02-18 09:33:17 +00:00
fields: [
'id',
'ref',
'shipped',
'landed',
'totalEntries',
'warehouseInFk',
'warehouseOutFk'
],
include: [
{
relation: 'warehouseIn',
scope: {
fields: ['name']
}
}, {
relation: 'warehouseOut',
scope: {
fields: ['name']
}
}
]
};
2020-04-25 09:50:04 +00:00
return this.getData(`Travels/${this.id}`, {filter})
.then(res => this.entity = res.data);
2020-02-18 09:33:17 +00:00
}
}
2020-04-25 09:50:04 +00:00
ngModule.vnComponent('vnTravelDescriptorPopover', {
slotTemplate: require('./index.html'),
controller: Controller
2020-02-18 09:33:17 +00:00
});