salix/modules/order/front/volume/index.js

37 lines
930 B
JavaScript
Raw Normal View History

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`)
.then(res => {
this.$.model.data.forEach(order => {
res.data.volumes.forEach(volume => {
if (order.itemFk === volume.itemFk)
order.volume = volume.volume;
2018-07-24 10:55:10 +00:00
});
});
2018-11-06 09:49:38 +00:00
});
2018-07-24 10:55:10 +00:00
}
}
ngModule.component('vnOrderVolume', {
template: require('./index.html'),
controller: Controller,
bindings: {
order: '<'
}
});