salix/modules/zone/front/summary/index.js

57 lines
1.2 KiB
JavaScript

import ngModule from '../module';
import Section from 'salix/components/section';
class Controller extends Section {
get zone() {
return this._zone;
}
set zone(value) {
this._zone = value;
if (!value) return;
this.getSummary();
this.getWarehouses();
}
getSummary() {
const params = {
filter: {
include: {
relation: 'agencyMode',
fields: ['name']
},
where: {
id: this.zone.id
}
}
};
this.$http.get(`Zones/findOne`, {params}).then(res => {
this.summary = res.data;
});
}
getWarehouses() {
const params = {
filter: {
include: {
relation: 'warehouse',
fields: ['name']
}
}
};
this.$http.get(`Zones/${this.zone.id}/warehouses`, {params}).then(res => {
this.zoneWarehouses = res.data;
});
}
}
ngModule.vnComponent('vnZoneSummary', {
template: require('./index.html'),
controller: Controller,
bindings: {
zone: '<'
}
});