From 21f20e432861683bee4fb1bcc6dcde0e89b8dc1d Mon Sep 17 00:00:00 2001 From: mpuebla Date: Fri, 11 Oct 2019 17:25:43 -0300 Subject: [PATCH] Agregada logica para abrir modal de configuracion --- src/app/components/header/header.component.html | 8 +++++- src/app/components/header/header.component.ts | 33 +++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/app/components/header/header.component.html b/src/app/components/header/header.component.html index 5060015..f73a2fb 100644 --- a/src/app/components/header/header.component.html +++ b/src/app/components/header/header.component.html @@ -1,6 +1,12 @@
- +
diff --git a/src/app/components/header/header.component.ts b/src/app/components/header/header.component.ts index 22f995b..ea751d1 100644 --- a/src/app/components/header/header.component.ts +++ b/src/app/components/header/header.component.ts @@ -1,5 +1,7 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, HostListener } from '@angular/core'; import { appSettings } from 'src/etc/AppSettings'; +import { BsModalService } from 'ngx-bootstrap'; +import { ConfiguracionComponent } from '../configuracion/configuracion.component'; @Component({ selector: 'app-header', @@ -9,10 +11,37 @@ import { appSettings } from 'src/etc/AppSettings'; export class HeaderComponent implements OnInit { private apiImagenes : string = appSettings.apiImagenes; + timer: any; + isShowModalConfiguration = false; - constructor() { } + constructor( + private modalService: BsModalService, + ) { } ngOnInit() { } + @HostListener('document:keydown.Control.Shift.A', ['$event']) + openConfigurationScreen(delay: number = 3000) { + + if (this.isShowModalConfiguration) return; + + this.modalService.onHide + .subscribe(() => this.isShowModalConfiguration = false); + + this.timer = setTimeout(() => { + + this.isShowModalConfiguration = true; + this.modalService.show(ConfiguracionComponent, { + class: 'modal-md', + ignoreBackdropClick: true, + }); + }, delay); + } + + resetCountDown() { + + clearTimeout(this.timer); + } + } -- 1.9.1