Bug #976
This commit is contained in:
parent
175926d7fb
commit
f7cf8cd656
|
@ -54,7 +54,7 @@
|
|||
<vn-icon
|
||||
vn-tooltip="Client has debt"
|
||||
icon="icon-risk"
|
||||
ng-class="{bright: $ctrl.client.debt > 0}">
|
||||
ng-class="{bright: $ctrl.client.debt > $ctrl.client.credit}">
|
||||
</vn-icon>
|
||||
<vn-icon
|
||||
vn-tooltip="Client not checked"
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
<vn-icon vn-one
|
||||
vn-tooltip="Client has debt"
|
||||
icon="icon-risk"
|
||||
ng-class="{bright: $ctrl.clientDebt > 0}">
|
||||
ng-class="{bright: $ctrl.ticket.client.debt > $ctrl.ticket.client.credit}">
|
||||
</vn-icon>
|
||||
<vn-icon vn-one
|
||||
vn-tooltip="Client not checked"
|
||||
|
|
|
@ -58,7 +58,6 @@ class Controller {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
get ticket() {
|
||||
return this._ticket;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ class Controller {
|
|||
{
|
||||
relation: 'client',
|
||||
scope: {
|
||||
fields: ['salesPersonFk', 'name', 'isActive', 'isFreezed', 'isTaxDataChecked'],
|
||||
fields: ['salesPersonFk', 'name', 'isActive', 'isFreezed', 'isTaxDataChecked', 'credit'],
|
||||
include: {
|
||||
relation: 'salesPerson',
|
||||
fields: ['firstName', 'name'],
|
||||
|
@ -40,11 +40,20 @@ class Controller {
|
|||
const json = encodeURIComponent(JSON.stringify(this.filter));
|
||||
const query = `/ticket/api/Tickets/${this.$state.params.id}?filter=${json}`;
|
||||
this.$http.get(query).then(res => {
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue