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

57 lines
1.2 KiB
JavaScript
Raw Normal View History

2018-12-04 12:18:27 +00:00
import ngModule from '../module';
2020-03-18 11:55:22 +00:00
import Section from 'salix/components/section';
2018-09-25 07:28:55 +00:00
2020-03-18 11:55:22 +00:00
class Controller extends Section {
2018-09-25 07:28:55 +00:00
get zone() {
return this._zone;
}
set zone(value) {
this._zone = value;
if (!value) return;
this.getSummary();
2019-11-25 07:35:34 +00:00
this.getWarehouses();
2018-09-25 07:28:55 +00:00
}
getSummary() {
2019-11-25 07:35:34 +00:00
const params = {
filter: {
include: {
relation: 'agencyMode',
fields: ['name']
},
where: {
id: this.zone.id
}
}
2019-01-21 10:45:53 +00:00
};
2020-03-18 11:55:22 +00:00
this.$http.get(`Zones/findOne`, {params}).then(res => {
2019-11-25 07:35:34 +00:00
this.summary = res.data;
});
}
getWarehouses() {
const params = {
filter: {
include: {
relation: 'warehouse',
fields: ['name']
}
}
};
2020-03-18 11:55:22 +00:00
this.$http.get(`Zones/${this.zone.id}/warehouses`, {params}).then(res => {
2019-11-25 07:35:34 +00:00
this.zoneWarehouses = res.data;
2018-09-25 07:28:55 +00:00
});
}
}
ngModule.vnComponent('vnZoneSummary', {
2018-09-25 07:28:55 +00:00
template: require('./index.html'),
controller: Controller,
bindings: {
zone: '<'
}
});