diff --git a/client/client/src/summary/client-summary.js b/client/client/src/summary/client-summary.js index 0557c418f..4109b1b77 100644 --- a/client/client/src/summary/client-summary.js +++ b/client/client/src/summary/client-summary.js @@ -1,7 +1,31 @@ import ngModule from '../module'; +class ClientSummary { + constructor($http) { + this.$http = $http; + } + getRelations() { + let filter = { + include: ['account', 'salesPerson', 'province'] + }; + let url = `/client/api/Clients/${this.client.id}?filter=${JSON.stringify(filter)}`; + + this.$http.get(encodeURIComponent(url)).then(res => { + if (res.data) + this.client = res.data; + }); + } + $onChanges(changesObj) { + if (this.client && this.client.id && !this.client.salesPerson) { + this.getRelations(); + } + } +} +ClientSummary.$inject = ['$http']; + ngModule.component('vnClientSummary', { template: require('./client-summary.html'), + controller: ClientSummary, bindings: { client: '<' }