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;
|
|
|
|
}
|
|
|
|
|
2020-11-16 13:50:03 +00:00
|
|
|
get travelFilter() {
|
|
|
|
let travelFilter;
|
|
|
|
const travel = this.travel;
|
|
|
|
|
|
|
|
if (travel && travel.agencyFk) {
|
|
|
|
travelFilter = this.travel && JSON.stringify({
|
|
|
|
agencyFk: this.travel.agencyFk
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return travelFilter;
|
|
|
|
}
|
|
|
|
|
2020-04-30 10:48:52 +00:00
|
|
|
loadData() {
|
|
|
|
const filter = {
|
|
|
|
fields: [
|
|
|
|
'id',
|
|
|
|
'ref',
|
|
|
|
'shipped',
|
|
|
|
'landed',
|
|
|
|
'totalEntries',
|
|
|
|
'warehouseInFk',
|
2020-11-16 13:50:03 +00:00
|
|
|
'warehouseOutFk',
|
|
|
|
'cargoSupplierFk'
|
2020-04-30 10:48:52 +00:00
|
|
|
],
|
|
|
|
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
|
|
|
});
|