import ngModule from '../module'; class Controller { constructor($http, $state) { this.$http = $http; this.$state = $state; this.filter = { include: [ {relation: 'warehouse', scope: {fields: ['name']}}, {relation: 'agencyMode', scope: {fields: ['name']}}, { relation: 'client', scope: { fields: ['salesPersonFk', 'name', 'isActive', 'isFreezed', 'isTaxDataChecked'], include: { relation: 'salesPerson', fields: ['firstName', 'name'], }, }, }, { relation: 'tracking', scope: { fields: ['stateFk'], include: { relation: 'state', fields: ['name'], }, }, }, ], }; } $onInit() { this.getCard(); } getCard() { const json = encodeURIComponent(JSON.stringify(this.filter)); const query = `/ticket/api/Tickets/${this.$state.params.id}?filter=${json}`; this.$http.get(query).then((res) => { if (res.data) { this.ticket = res.data; } }); } reload() { this.getCard(); } } Controller.$inject = ['$http', '$state']; ngModule.component('vnTicketCard', { template: require('./index.html'), controller: Controller, });