2018-12-04 12:18:27 +00:00
|
|
|
import ngModule from '../module';
|
2019-11-15 06:35:51 +00:00
|
|
|
import Component from 'core/lib/component';
|
2018-09-25 07:28:55 +00:00
|
|
|
|
2019-11-15 06:35:51 +00:00
|
|
|
class Controller extends Component {
|
2018-09-25 07:28:55 +00:00
|
|
|
get zone() {
|
|
|
|
return this._zone;
|
|
|
|
}
|
|
|
|
|
|
|
|
set zone(value) {
|
|
|
|
this._zone = value;
|
|
|
|
|
|
|
|
if (!value) return;
|
|
|
|
|
|
|
|
this.getSummary();
|
|
|
|
}
|
|
|
|
|
|
|
|
getSummary() {
|
2019-01-21 10:45:53 +00:00
|
|
|
let filter = {
|
2019-09-25 18:06:42 +00:00
|
|
|
include: {relation: 'agencyMode', fields: ['name']},
|
2019-01-21 10:45:53 +00:00
|
|
|
where: {id: this.zone.id}
|
|
|
|
};
|
|
|
|
filter = encodeURIComponent(JSON.stringify((filter)));
|
2019-10-24 22:53:53 +00:00
|
|
|
this.$http.get(`Zones/findOne?filter=${filter}`).then(res => {
|
2019-01-21 10:45:53 +00:00
|
|
|
if (res && res.data)
|
|
|
|
this.summary = res.data;
|
2018-09-25 07:28:55 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ngModule.component('vnZoneSummary', {
|
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller,
|
|
|
|
bindings: {
|
|
|
|
zone: '<'
|
|
|
|
}
|
|
|
|
});
|