From 1460887ca24f635209da69f04d00b33c06b86b04 Mon Sep 17 00:00:00 2001 From: gerard Date: Tue, 8 May 2018 09:30:55 +0200 Subject: [PATCH] =?UTF-8?q?A=C3=B1adido=20metodo=20en=20ticket=20card=20pa?= =?UTF-8?q?ra=20que=20se=20actualicen=20datos=20del=20ticket?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/ticket/src/card/ticket-card.js | 20 ++++++++++---------- client/ticket/src/descriptor/descriptor.html | 2 +- client/ticket/src/tracking/edit/edit.js | 6 +++++- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/client/ticket/src/card/ticket-card.js b/client/ticket/src/card/ticket-card.js index db2dbd9df..291c9c55a 100644 --- a/client/ticket/src/card/ticket-card.js +++ b/client/ticket/src/card/ticket-card.js @@ -1,10 +1,9 @@ import ngModule from '../module'; class TicketCard { - constructor($http, $state, $timeout) { + constructor($http, $state) { this.$http = $http; this.$state = $state; - this.$timeout = $timeout; this.ticket = null; } @@ -25,7 +24,7 @@ class TicketCard { } }, { - relation: 'ticketTracking', + relation: 'tracking', scope: { fields: ['stateFk'], include: { @@ -36,13 +35,11 @@ class TicketCard { } ] }; - this.$http.get(`/ticket/api/Tickets/${this.$state.params.id}?filter=${JSON.stringify(filter)}`) + let json = encodeURIComponent(JSON.stringify(filter)); + this.$http.get(`/ticket/api/Tickets/${this.$state.params.id}?filter=${json}`) .then(res => { - if (res.data && res.data.id) { - this.$timeout(() => { - this.ticket = res.data; - }); - } + if (res.data) + this.ticket = res.data; } ); } @@ -50,8 +47,11 @@ class TicketCard { $onInit() { this._getTicket(); } + reload() { + this._getTicket(); + } } -TicketCard.$inject = ['$http', '$state', '$timeout']; +TicketCard.$inject = ['$http', '$state']; ngModule.component('vnTicketCard', { template: require('./ticket-card.html'), diff --git a/client/ticket/src/descriptor/descriptor.html b/client/ticket/src/descriptor/descriptor.html index 506b88bfd..e71fca331 100644 --- a/client/ticket/src/descriptor/descriptor.html +++ b/client/ticket/src/descriptor/descriptor.html @@ -17,7 +17,7 @@ value="{{$ctrl.ticket.client.name}}"> + value="{{$ctrl.ticket.tracking.state.name}}"> diff --git a/client/ticket/src/tracking/edit/edit.js b/client/ticket/src/tracking/edit/edit.js index 6b92f48ff..1d6c3e4b4 100644 --- a/client/ticket/src/tracking/edit/edit.js +++ b/client/ticket/src/tracking/edit/edit.js @@ -14,6 +14,7 @@ class Controller { onSubmit() { this.$.watcher.submit().then( () => { + this.card.reload(); this.$state.go('ticket.card.tracking.index'); } ); @@ -23,5 +24,8 @@ Controller.$inject = ['$scope', '$state', 'vnApp', '$translate']; ngModule.component('vnTicketTrackingEdit', { template: require('./edit.html'), - controller: Controller + controller: Controller, + require: { + card: '^vnTicketCard' + } });