Iconos en descriptor de ticket #329

This commit is contained in:
Joan Sanchez 2018-05-31 08:57:25 +02:00
parent c0167edc3e
commit 804218cdae
4 changed files with 79 additions and 36 deletions

View File

@ -25,6 +25,7 @@ class Controller {
}
}
}
Controller.$inject = ['$http'];
ngModule.component('vnClientDescriptor', {

View File

@ -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();
}
}

View File

@ -35,4 +35,26 @@
value="{{$ctrl.ticket.nickname}}">
</vn-label-value>
</div>
<vn-horizontal pad-medium-bottom class="footer">
<vn-icon vn-one
vn-tooltip="Client inactive"
icon="icon-disabled"
ng-class="{bright: $ctrl.ticket.client.isActive == false}">
</vn-icon>
<vn-icon vn-one
vn-tooltip="Client Frozen"
icon="icon-frozen"
ng-class="{bright: $ctrl.ticket.client.isFreezed == true}">
</vn-icon>
<vn-icon vn-one
vn-tooltip="Client has debt"
icon="icon-risk"
ng-class="{bright: $ctrl.clientDebt > 0}">
</vn-icon>
<vn-icon vn-one
vn-tooltip="Client not checked"
icon="icon-no036"
ng-class="{bright: $ctrl.ticket.client.isTaxDataChecked == false}">
</vn-icon>
</vn-horizontal>
</vn-card>

View File

@ -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
});