import ngModule from '../module'; class Controller { constructor($http, $state) { this.$http = $http; this.$state = $state; this.order = {}; this.filter = { include: [ {relation: 'agencyMode', scope: {fields: ['name']}}, {relation: 'address', scope: {fields: ['nickname']}}, {relation: 'rows', scope: {fields: ['id']}}, { relation: 'client', scope: { fields: ['salesPersonFk', 'name', 'isActive', 'isFreezed', 'isTaxDataChecked'], include: { relation: 'salesPerson', fields: ['firstName', 'name'] } } } ] }; } getOrder() { let json = encodeURIComponent(JSON.stringify(this.filter)); let query = `/order/api/Orders/${this.$state.params.id}?filter=${json}`; this.$http.get(query).then(res => { if (res.data) { this.order = res.data; this.getTotal(); } }); } getTotal() { let query = `/order/api/Orders/${this.$state.params.id}/getTotal`; this.$http.get(query).then(res => { if (res.data) { this.order.total = res.data.total; } }); } $onInit() { this.getOrder(); } reload() { this.getOrder(); } } Controller.$inject = ['$http', '$state']; ngModule.component('vnOrderCard', { template: require('./index.html'), controller: Controller });