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
|
|
|
|
2020-04-30 10:48:52 +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'),
|
2020-04-30 10:48:52 +00:00
|
|
|
controller: Controller,
|
2019-10-24 10:49:18 +00:00
|
|
|
bindings: {
|
|
|
|
travel: '<'
|
2020-04-30 10:48:52 +00:00
|
|
|
}
|
2019-10-24 10:49:18 +00:00
|
|
|
});
|