2018-12-04 12:18:27 +00:00
|
|
|
import ngModule from '../module';
|
2018-09-25 07:28:55 +00:00
|
|
|
|
|
|
|
class Controller {
|
|
|
|
constructor($http) {
|
|
|
|
this.$http = $http;
|
|
|
|
}
|
|
|
|
|
|
|
|
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 = {
|
|
|
|
include: [
|
|
|
|
{relation: 'warehouse', fields: ['name']},
|
|
|
|
{relation: 'agencyMode', fields: ['name']}
|
|
|
|
],
|
|
|
|
where: {id: this.zone.id}
|
|
|
|
};
|
|
|
|
filter = encodeURIComponent(JSON.stringify((filter)));
|
|
|
|
this.$http.get(`/agency/api/Zones/findOne?filter=${filter}`).then(res => {
|
|
|
|
if (res && res.data)
|
|
|
|
this.summary = res.data;
|
2018-09-25 07:28:55 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Controller.$inject = ['$http'];
|
|
|
|
|
|
|
|
ngModule.component('vnZoneSummary', {
|
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller,
|
|
|
|
bindings: {
|
|
|
|
zone: '<'
|
|
|
|
}
|
|
|
|
});
|