2018-07-24 10:55:10 +00:00
|
|
|
import ngModule from '../module';
|
2020-03-17 14:18:02 +00:00
|
|
|
import Section from 'salix/components/section';
|
2018-07-24 10:55:10 +00:00
|
|
|
import './style.scss';
|
|
|
|
|
2020-03-17 14:18:02 +00:00
|
|
|
class Controller extends Section {
|
|
|
|
constructor($element, $) {
|
|
|
|
super($element, $);
|
2018-07-24 10:55:10 +00:00
|
|
|
this.filter = {
|
|
|
|
include: [{
|
2018-11-06 09:49:38 +00:00
|
|
|
relation: 'item'
|
2018-07-24 10:55:10 +00:00
|
|
|
}]
|
|
|
|
};
|
|
|
|
this.order = {};
|
|
|
|
this.ticketVolumes = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
onDataChange() {
|
2020-03-17 14:18:02 +00:00
|
|
|
this.$http.get(`Orders/${this.$params.id}/getVolumes`)
|
2018-11-06 09:49:38 +00:00
|
|
|
.then(response => {
|
2020-03-17 14:18:02 +00:00
|
|
|
if (response.data) {
|
|
|
|
this.$.model.data.forEach(order => {
|
2018-11-06 09:49:38 +00:00
|
|
|
response.data.volumes.forEach(volume => {
|
|
|
|
if (order.itemFk === volume.itemFk)
|
|
|
|
order.volume = volume.volume;
|
|
|
|
});
|
2018-07-24 10:55:10 +00:00
|
|
|
});
|
2020-03-17 14:18:02 +00:00
|
|
|
}
|
2018-11-06 09:49:38 +00:00
|
|
|
});
|
2018-07-24 10:55:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
showDescriptor(event, itemFk) {
|
2020-03-17 14:18:02 +00:00
|
|
|
this.$.descriptor.itemFk = itemFk;
|
|
|
|
this.$.descriptor.parent = event.target;
|
|
|
|
this.$.descriptor.show();
|
2018-07-24 10:55:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
onDescriptorLoad() {
|
2020-03-17 14:18:02 +00:00
|
|
|
this.$.popover.relocate();
|
2018-07-24 10:55:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ngModule.component('vnOrderVolume', {
|
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller,
|
|
|
|
bindings: {
|
|
|
|
order: '<'
|
|
|
|
}
|
|
|
|
});
|