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

37 lines
932 B
JavaScript

import ngModule from '../module';
import Section from 'salix/components/section';
import './style.scss';
class Controller extends Section {
constructor($element, $) {
super($element, $);
this.filter = {
include: [{
relation: 'item'
}]
};
this.order = {};
this.ticketVolumes = [];
}
onDataChange() {
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;
});
});
});
}
}
ngModule.vnComponent('vnOrderVolume', {
template: require('./index.html'),
controller: Controller,
bindings: {
order: '<'
}
});