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

38 lines
959 B
JavaScript
Raw Permalink 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'
},
order: 'itemFk'
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.vnComponent('vnOrderVolume', {
2018-07-24 10:55:10 +00:00
template: require('./index.html'),
controller: Controller,
bindings: {
order: '<'
}
});