tarea #105 in progress
This commit is contained in:
parent
52503c1015
commit
40e2b73e7c
|
@ -1,7 +1,31 @@
|
||||||
import ngModule from '../module';
|
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', {
|
ngModule.component('vnClientSummary', {
|
||||||
template: require('./client-summary.html'),
|
template: require('./client-summary.html'),
|
||||||
|
controller: ClientSummary,
|
||||||
bindings: {
|
bindings: {
|
||||||
client: '<'
|
client: '<'
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue