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

51 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-10-24 10:49:18 +00:00
import ngModule from '../module';
2020-04-25 09:50:04 +00:00
import Descriptor from 'salix/components/descriptor';
2019-10-24 10:49:18 +00:00
class Controller extends Descriptor {
get travel() {
return this.entity;
}
set travel(value) {
this.entity = value;
}
loadData() {
const filter = {
fields: [
'id',
'ref',
'shipped',
'landed',
'totalEntries',
'warehouseInFk',
'warehouseOutFk'
],
include: [
{
relation: 'warehouseIn',
scope: {
fields: ['name']
}
}, {
relation: 'warehouseOut',
scope: {
fields: ['name']
}
}
]
};
return this.getData(`Travels/${this.id}`, {filter})
.then(res => this.entity = res.data);
}
}
2020-04-25 09:50:04 +00:00
ngModule.vnComponent('vnTravelDescriptor', {
2019-10-24 10:49:18 +00:00
template: require('./index.html'),
controller: Controller,
2019-10-24 10:49:18 +00:00
bindings: {
travel: '<'
}
2019-10-24 10:49:18 +00:00
});