diff --git a/client/client/src/descriptor/index.js b/client/client/src/descriptor/index.js index d71a336d6f..7dfb443478 100644 --- a/client/client/src/descriptor/index.js +++ b/client/client/src/descriptor/index.js @@ -25,6 +25,7 @@ class Controller { } } } + Controller.$inject = ['$http']; ngModule.component('vnClientDescriptor', { diff --git a/client/ticket/src/card/index.js b/client/ticket/src/card/index.js index 22c1269600..643156965b 100644 --- a/client/ticket/src/card/index.js +++ b/client/ticket/src/card/index.js @@ -4,11 +4,9 @@ class Controller { constructor($http, $state) { this.$http = $http; this.$state = $state; - - this.ticket = null; } - _getTicket() { + getTicket() { let filter = { include: [ {relation: 'warehouse', scope: {fields: ['name']}}, @@ -16,7 +14,7 @@ class Controller { { relation: 'client', scope: { - fields: ['salesPersonFk', 'name'], + fields: ['salesPersonFk', 'name', 'isActive', 'isFreezed', 'isTaxDataChecked'], include: { relation: 'salesPerson', fields: ['firstName', 'name'] @@ -35,9 +33,10 @@ class Controller { } ] }; + let json = encodeURIComponent(JSON.stringify(filter)); - this.$http.get(`/ticket/api/Tickets/${this.$state.params.id}?filter=${json}`) - .then(res => { + let query = `/ticket/api/Tickets/${this.$state.params.id}?filter=${json}`; + this.$http.get(query).then(res => { if (res.data) this.ticket = res.data; } @@ -45,11 +44,11 @@ class Controller { } $onInit() { - this._getTicket(); + this.getTicket(); } reload() { - this._getTicket(); + this.getTicket(); } } diff --git a/client/ticket/src/descriptor/index.html b/client/ticket/src/descriptor/index.html index 2f00e811aa..2b09180fc3 100644 --- a/client/ticket/src/descriptor/index.html +++ b/client/ticket/src/descriptor/index.html @@ -8,31 +8,53 @@ -
-
{{$ctrl.client.name}}
- - - - - - - - - - - - - - - - -
+
+
{{$ctrl.client.name}}
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + diff --git a/client/ticket/src/descriptor/index.js b/client/ticket/src/descriptor/index.js index ee40fdd948..a1364bda8e 100644 --- a/client/ticket/src/descriptor/index.js +++ b/client/ticket/src/descriptor/index.js @@ -1,8 +1,29 @@ import ngModule from '../module'; +class Controller { + + constructor($http) { + this.$http = $http; + } + + getClientDebt(clientFk) { + this.$http.get(`/client/api/Clients/${clientFk}/getDebt`).then(response => { + this.clientDebt = response.data.debt; + }); + } + + $onChanges() { + if (this.ticket) + this.getClientDebt(this.ticket.clientFk); + } +} + +Controller.$inject = ['$http']; + ngModule.component('vnTicketDescriptor', { template: require('./index.html'), bindings: { ticket: '<' - } + }, + controller: Controller });