42 lines
846 B
JavaScript
42 lines
846 B
JavaScript
import ngModule from '../module';
|
|
|
|
class Controller {
|
|
constructor($http) {
|
|
this.$http = $http;
|
|
}
|
|
|
|
get zone() {
|
|
return this._zone;
|
|
}
|
|
|
|
set zone(value) {
|
|
this._zone = value;
|
|
|
|
if (!value) return;
|
|
|
|
this.getSummary();
|
|
}
|
|
|
|
getSummary() {
|
|
let filter = {
|
|
include: {relation: 'agencyMode', fields: ['name']},
|
|
where: {id: this.zone.id}
|
|
};
|
|
filter = encodeURIComponent(JSON.stringify((filter)));
|
|
this.$http.get(`Zones/findOne?filter=${filter}`).then(res => {
|
|
if (res && res.data)
|
|
this.summary = res.data;
|
|
});
|
|
}
|
|
}
|
|
|
|
Controller.$inject = ['$http'];
|
|
|
|
ngModule.component('vnZoneSummary', {
|
|
template: require('./index.html'),
|
|
controller: Controller,
|
|
bindings: {
|
|
zone: '<'
|
|
}
|
|
});
|