diff --git a/modules/client/front/descriptor/index.html b/modules/client/front/descriptor/index.html
index f3d1d86b1..c30818226 100644
--- a/modules/client/front/descriptor/index.html
+++ b/modules/client/front/descriptor/index.html
@@ -54,7 +54,7 @@
+ ng-class="{bright: $ctrl.client.debt > $ctrl.client.credit}">
+ ng-class="{bright: $ctrl.ticket.client.debt > $ctrl.ticket.client.credit}">
{
- if (res.data)
+ if (res.data) {
this.ticket = res.data;
+ this.getDebt(res.data.client.id);
+ }
});
}
+ getDebt(id) {
+ const query = `/ticket/api/Clients/${id}/getDebt`;
+ this.$http.get(query).then(res => {
+ if (res.data)
+ this.ticket.client.debt = res.data.debt;
+ });
+ }
reload() {
this.getCard();
}
diff --git a/modules/ticket/front/card/index.spec.js b/modules/ticket/front/card/index.spec.js
index 912815e5d..886b30e53 100644
--- a/modules/ticket/front/card/index.spec.js
+++ b/modules/ticket/front/card/index.spec.js
@@ -21,8 +21,10 @@ describe('Ticket', () => {
filter = encodeURIComponent(JSON.stringify(filter));
- $httpBackend.when('GET', `/ticket/api/Tickets/1?filter=${filter}`).respond({id: 1});
+ $httpBackend.when('GET', `/ticket/api/Tickets/1?filter=${filter}`).respond({id: 1, client: {id: 1}});
$httpBackend.expect('GET', `/ticket/api/Tickets/1?filter=${filter}`);
+ $httpBackend.when('GET', `/ticket/api/Clients/1/getDebt`).respond();
+ $httpBackend.expect('GET', `/ticket/api/Clients/1/getDebt`);
controller.getCard();
$httpBackend.flush();