tarea #105 in progress

This commit is contained in:
Daniel Herrero 2018-03-01 14:48:02 +01:00
parent 52503c1015
commit 40e2b73e7c
1 changed files with 24 additions and 0 deletions

View File

@ -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: '<'
}