2020-11-16 18:04:37 +00:00
|
|
|
import ngModule from '../module';
|
|
|
|
import Section from 'salix/components/section';
|
|
|
|
import './style.scss';
|
|
|
|
|
|
|
|
class Controller extends Section {
|
|
|
|
constructor($element, $) {
|
|
|
|
super($element, $);
|
|
|
|
}
|
|
|
|
|
2020-11-17 14:54:45 +00:00
|
|
|
get travelId() {
|
|
|
|
return this._travelId;
|
|
|
|
}
|
|
|
|
|
|
|
|
set travelId(value) {
|
|
|
|
this._travelId = value;
|
|
|
|
|
|
|
|
if (value) this.loadData();
|
|
|
|
}
|
|
|
|
|
|
|
|
loadData() {
|
|
|
|
const filter = {
|
|
|
|
fields: [
|
|
|
|
'id',
|
|
|
|
'ref',
|
|
|
|
'shipped',
|
|
|
|
'landed',
|
|
|
|
'totalEntries',
|
|
|
|
'agencyFk',
|
|
|
|
'warehouseInFk',
|
|
|
|
'warehouseOutFk',
|
|
|
|
'cargoSupplierFk'
|
|
|
|
],
|
|
|
|
include: [
|
|
|
|
{
|
|
|
|
relation: 'warehouseIn',
|
|
|
|
scope: {
|
|
|
|
fields: ['name']
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
relation: 'warehouseOut',
|
|
|
|
scope: {
|
|
|
|
fields: ['name']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
return this.$http.get(`Travels/${this.travelId}`, {filter})
|
|
|
|
.then(res => this.travel = res.data);
|
|
|
|
}
|
|
|
|
|
2020-11-16 18:04:37 +00:00
|
|
|
onCloneAccept() {
|
|
|
|
const params = JSON.stringify({
|
|
|
|
ref: this.travel.ref,
|
|
|
|
agencyModeFk: this.travel.agencyFk,
|
|
|
|
shipped: this.travel.shipped,
|
|
|
|
landed: this.travel.landed,
|
|
|
|
warehouseInFk: this.travel.warehouseInFk,
|
|
|
|
warehouseOutFk: this.travel.warehouseOutFk
|
|
|
|
});
|
|
|
|
this.$state.go('travel.create', {q: params});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Controller.$inject = ['$element', '$scope'];
|
|
|
|
|
|
|
|
ngModule.vnComponent('vnTravelDescriptorMenu', {
|
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller,
|
|
|
|
bindings: {
|
2020-11-17 14:54:45 +00:00
|
|
|
travelId: '<',
|
2020-11-16 18:04:37 +00:00
|
|
|
}
|
|
|
|
});
|