From e4e01c4970335bf66a8934510eeb57d3be2afd72 Mon Sep 17 00:00:00 2001 From: Dani Herrero Date: Wed, 5 Jul 2017 13:02:49 +0200 Subject: [PATCH] =?UTF-8?q?a=C3=B1adida=20id=20ruta=20en=20tabla,=20intern?= =?UTF-8?q?acionalizacion=20y=20mejora=20de=20popover?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/core/src/popover/popover.js | 35 +++++++++++-------- client/production/src/locale/es.json | 1 + .../production-table/production-table.html | 7 ++-- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/client/core/src/popover/popover.js b/client/core/src/popover/popover.js index 9beaa1358..7e5b812ad 100644 --- a/client/core/src/popover/popover.js +++ b/client/core/src/popover/popover.js @@ -16,13 +16,28 @@ export function directive(vnPopover) { module.directive('vnPopover', directive); export class Popover { - constructor($document, $compile, $timeout) { + constructor($document, $compile, $transitions) { this.document = $document[0]; this.$compile = $compile; - this.$timeout = $timeout; + this.$transitions = $transitions; this.removeScope = false; this.popOpens = 0; } + _init() { + this.docMouseDownHandler = e => this.onDocMouseDown(e); + this.document.addEventListener('mousedown', this.docMouseDownHandler); + this.docKeyDownHandler = e => this.onDocKeyDown(e); + this.document.addEventListener('keydown', this.docKeyDownHandler); + this.deregisterCallback = this.$transitions.onStart({}, + () => this.hideAll()); + } + _destroy() { + this.document.removeEventListener('mousedown', this.docMouseDownHandler); + this.document.removeEventListener('keydown', this.docKeyDownHandler); + this.docMouseDownHandler = null; + this.docKeyDownHandler = null; + this.deregisterCallback(); + } show(childElement, parent, popoverId) { this.childElement = childElement; let popover = this.document.createElement('div'); @@ -83,11 +98,7 @@ export class Popover { this.document.body.appendChild(popover); if (this.popOpens === 1) { - this.docMouseDownHandler = e => this.onDocMouseDown(e); - this.document.addEventListener('mousedown', this.docMouseDownHandler); - - this.docKeyDownHandler = e => this.onDocKeyDown(e); - this.document.addEventListener('keydown', this.docKeyDownHandler); + this._init(); } return popoverId; } @@ -103,10 +114,7 @@ export class Popover { _checkOpens() { this.popOpens = this.document.querySelectorAll('*[id^="popover-"]').length; if (this.popOpens === 0) { - this.document.removeEventListener('mousedown', this.docMouseDownHandler); - this.document.removeEventListener('keydown', this.docKeyDownHandler); - this.docMouseDownHandler = null; - this.docKeyDownHandler = null; + this._destroy(); } } _removeElement(val) { @@ -125,7 +133,6 @@ export class Popover { let popover = this.document.querySelector(`#${id}`); if (popover) { this._removeElement(popover); - this.popOpens--; } this._checkOpens(); } @@ -135,7 +142,6 @@ export class Popover { val => { if (angular.element(val).attr('id') != id) { this._removeElement(val); - this.popOpens--; } } ); @@ -146,7 +152,6 @@ export class Popover { popovers.forEach( val => { this._removeElement(val); - this.popOpens--; } ); this._checkOpens(); @@ -184,5 +189,5 @@ export class Popover { this.latTarget = event.target; } } -Popover.$inject = ['$document', '$compile', '$timeout']; +Popover.$inject = ['$document', '$compile', '$transitions']; module.service('vnPopover', Popover); diff --git a/client/production/src/locale/es.json b/client/production/src/locale/es.json index c01b15d77..710681ee8 100644 --- a/client/production/src/locale/es.json +++ b/client/production/src/locale/es.json @@ -15,6 +15,7 @@ "Message" : "Mensaje", "Send" : "Enviar", "Date" : "Fecha", + "Ticket ID" : "ID Ticket", "Route ID": "ID Ruta", "Province" : "Provincia", "Filter" : "Filtrar", diff --git a/client/production/src/production-table/production-table.html b/client/production/src/production-table/production-table.html index dbc230452..4b8539839 100644 --- a/client/production/src/production-table/production-table.html +++ b/client/production/src/production-table/production-table.html @@ -4,8 +4,9 @@ - + + @@ -24,6 +25,7 @@ {{::ticket.ticketFk}} {{::ticket.agency}} + {{::ticket.id}} {{::ticket.salesPerson | ucwords}} {{ticket.hour}} {{ticket.state}} @@ -42,13 +44,12 @@ : {{$ctrl.footer.total}} - + {{$ctrl.footer.lines}} {{$ctrl.footer.meters}} -