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']; Controller.$inject = ['$http'];
ngModule.component('vnClientDescriptor', { ngModule.component('vnClientDescriptor', {

View File

@ -4,11 +4,9 @@ class Controller {
constructor($http, $state) { constructor($http, $state) {
this.$http = $http; this.$http = $http;
this.$state = $state; this.$state = $state;
this.ticket = null;
} }
_getTicket() { getTicket() {
let filter = { let filter = {
include: [ include: [
{relation: 'warehouse', scope: {fields: ['name']}}, {relation: 'warehouse', scope: {fields: ['name']}},
@ -16,7 +14,7 @@ class Controller {
{ {
relation: 'client', relation: 'client',
scope: { scope: {
fields: ['salesPersonFk', 'name'], fields: ['salesPersonFk', 'name', 'isActive', 'isFreezed', 'isTaxDataChecked'],
include: { include: {
relation: 'salesPerson', relation: 'salesPerson',
fields: ['firstName', 'name'] fields: ['firstName', 'name']
@ -35,9 +33,10 @@ class Controller {
} }
] ]
}; };
let json = encodeURIComponent(JSON.stringify(filter)); let json = encodeURIComponent(JSON.stringify(filter));
this.$http.get(`/ticket/api/Tickets/${this.$state.params.id}?filter=${json}`) let query = `/ticket/api/Tickets/${this.$state.params.id}?filter=${json}`;
.then(res => { this.$http.get(query).then(res => {
if (res.data) if (res.data)
this.ticket = res.data; this.ticket = res.data;
} }
@ -45,11 +44,11 @@ class Controller {
} }
$onInit() { $onInit() {
this._getTicket(); this.getTicket();
} }
reload() { reload() {
this._getTicket(); this.getTicket();
} }
} }

View File

@ -8,31 +8,53 @@
<vn-icon icon="desktop_windows"></vn-icon> <vn-icon icon="desktop_windows"></vn-icon>
</a> </a>
</vn-horizontal> </vn-horizontal>
<div pad-medium> <div pad-medium>
<h5>{{$ctrl.client.name}}</h5> <h5>{{$ctrl.client.name}}</h5>
<vn-label-value label="Id" <vn-label-value label="Id"
value="{{$ctrl.ticket.id}}"> value="{{$ctrl.ticket.id}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Client" <vn-label-value label="Client"
value="{{$ctrl.ticket.client.name}}"> value="{{$ctrl.ticket.client.name}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="State" <vn-label-value label="State"
value="{{$ctrl.ticket.tracking.state.name}}"> value="{{$ctrl.ticket.tracking.state.name}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Sales person" <vn-label-value label="Sales person"
value="{{$ctrl.ticket.client.salesPerson.firstName}} {{$ctrl.ticket.client.salesPerson.name}}"> value="{{$ctrl.ticket.client.salesPerson.firstName}} {{$ctrl.ticket.client.salesPerson.name}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Shipped" <vn-label-value label="Shipped"
value="{{$ctrl.ticket.shipped | date: 'dd/MM/yyyy HH:mm' }}"> value="{{$ctrl.ticket.shipped | date: 'dd/MM/yyyy HH:mm' }}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Agency" <vn-label-value label="Agency"
value="{{$ctrl.ticket.agencyMode.name}}"> value="{{$ctrl.ticket.agencyMode.name}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Warehouse" <vn-label-value label="Warehouse"
value="{{$ctrl.ticket.warehouse.name}}"> value="{{$ctrl.ticket.warehouse.name}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Alias" <vn-label-value label="Alias"
value="{{$ctrl.ticket.nickname}}"> value="{{$ctrl.ticket.nickname}}">
</vn-label-value> </vn-label-value>
</div> </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> </vn-card>

View File

@ -1,8 +1,29 @@
import ngModule from '../module'; 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', { ngModule.component('vnTicketDescriptor', {
template: require('./index.html'), template: require('./index.html'),
bindings: { bindings: {
ticket: '<' ticket: '<'
} },
controller: Controller
}); });