añadida id ruta en tabla, internacionalizacion y mejora de popover

This commit is contained in:
Dani Herrero 2017-07-05 13:02:49 +02:00
parent ffe21e6947
commit e4e01c4970
3 changed files with 25 additions and 18 deletions

View File

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

View File

@ -15,6 +15,7 @@
"Message" : "Mensaje",
"Send" : "Enviar",
"Date" : "Fecha",
"Ticket ID" : "ID Ticket",
"Route ID": "ID Ruta",
"Province" : "Provincia",
"Filter" : "Filtrar",

View File

@ -4,8 +4,9 @@
<vn-colum-header vn-none min-none>
<vn-multi-check models="$ctrl.tickets" options="[{id:'all',name:'Todos'},{id:'any',name:'Ninguno'},{id:'problem',name:'Con incidencia'},{id:'no-problem',name:'Sin incidencia'}]"></vn-multi-check>
</vn-colum-header>
<vn-colum-header vn-one pad-medium-h field="ticketFk" text="ID Ticket"></vn-colum-header>
<vn-colum-header vn-one pad-medium-h field="ticketFk" text="Ticket ID"></vn-colum-header>
<vn-colum-header vn-two pad-medium-h field="agency" text="Agency"></vn-colum-header>
<vn-colum-header vn-one pad-medium-h field="id" text="Route ID"></vn-colum-header>
<vn-colum-header vn-two pad-medium-h field="salesPerson" text="Commercial"></vn-colum-header>
<vn-colum-header vn-one pad-medium-h field="hour" text="Hour"></vn-colum-header>
<vn-colum-header vn-one pad-medium-h field="state" text="State"></vn-colum-header>
@ -24,6 +25,7 @@
</vn-none>
<vn-one pad-medium-h>{{::ticket.ticketFk}}</vn-one>
<vn-two pad-medium-h>{{::ticket.agency}}</vn-two>
<vn-one pad-medium-h>{{::ticket.id}}</vn-one>
<vn-two pad-medium-h>{{::ticket.salesPerson | ucwords}}</vn-two>
<vn-one pad-medium-h>{{ticket.hour}}</vn-one>
<vn-one pad-medium-h>{{ticket.state}}</vn-one>
@ -42,13 +44,12 @@
<span translate="Resultados"></span>:
<span>{{$ctrl.footer.total}}</span>
</vn-one>
<vn-six></vn-six>
<vn-seven pad-medium-h></vn-seven>
<vn-one pad-medium-h text-center>{{$ctrl.footer.lines}}</vn-one>
<vn-one pad-medium-h text-center>{{$ctrl.footer.meters}}</vn-one>
<vn-one></vn-one>
<vn-none></vn-none>
</vn-horizontal>
<vn-one>
<vn-paging page-change="$ctrl.pageTickets()" index="$ctrl.pageTable" total="$ctrl.totalFilter"></vn-paging>
</vn-one>