salix/modules/agency/front/card/index.js

39 lines
846 B
JavaScript
Raw Normal View History

2018-12-04 12:18:27 +00:00
import ngModule from '../module';
2018-09-19 13:05:07 +00:00
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 = {
2019-09-25 18:06:42 +00:00
include: {
relation: 'agencyMode',
scope: {fields: ['name']}
}
2018-09-21 10:35:54 +00:00
};
let json = encodeURIComponent(JSON.stringify(filter));
let query = `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
});