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

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