2018-09-19 13:05:07 +00:00
|
|
|
import ngModule from '../../module';
|
|
|
|
|
|
|
|
class Controller {
|
2018-09-21 10:35:54 +00:00
|
|
|
constructor($http, $stateParams) {
|
2018-09-19 13:05:07 +00:00
|
|
|
this.$http = $http;
|
2018-09-21 10:35:54 +00:00
|
|
|
this.$stateParams = $stateParams;
|
2018-09-19 13:05:07 +00:00
|
|
|
}
|
|
|
|
|
2018-09-21 10:35:54 +00:00
|
|
|
$onInit() {
|
|
|
|
this.getCard();
|
2018-09-19 13:05:07 +00:00
|
|
|
}
|
|
|
|
|
2018-09-21 10:35:54 +00:00
|
|
|
getCard() {
|
|
|
|
let filter = {
|
|
|
|
include: [
|
|
|
|
{relation: 'warehouse', fields: ['name']},
|
|
|
|
{relation: 'agencyMode', fields: ['name']}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
let json = encodeURIComponent(JSON.stringify(filter));
|
|
|
|
let query = `/route/api/Zones/${this.$stateParams.id}?filter=${json}`;
|
2018-09-19 13:05:07 +00:00
|
|
|
this.$http.get(query).then(res => {
|
2018-09-21 10:35:54 +00:00
|
|
|
if (res.data)
|
|
|
|
this.zone = res.data;
|
2018-09-19 13:05:07 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
reload() {
|
2018-09-21 10:35:54 +00:00
|
|
|
this.getCard();
|
|
|
|
}
|
2018-09-19 13:05:07 +00:00
|
|
|
}
|
|
|
|
|
2018-09-21 10:35:54 +00:00
|
|
|
Controller.$inject = ['$http', '$stateParams'];
|
2018-09-19 13:05:07 +00:00
|
|
|
|
|
|
|
ngModule.component('vnZoneCard', {
|
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller
|
|
|
|
});
|