Commit 21f20e432861683bee4fb1bcc6dcde0e89b8dc1d
1 parent
2b2243a6a9
Exists in
master
and in
1 other branch
Agregada logica para abrir modal de configuracion
Showing
2 changed files
with
38 additions
and
3 deletions
Show diff stats
src/app/components/header/header.component.html
1 | 1 | <div class="row m-0 bg-light p-3 justify-content-between"> |
2 | 2 | <div class="col-6"> |
3 | - <img class="w-25 float-left" src="{{apiImagenes}}/imagenes/logoempresa.png"> | |
3 | + <img | |
4 | + draggable="false" | |
5 | + ondragstart="return false;" | |
6 | + (contextmenu)="false" | |
7 | + (press)="openConfigurationScreen()" | |
8 | + class="w-25 float-left" | |
9 | + src="{{apiImagenes}}/imagenes/logoempresa.png"> | |
4 | 10 | </div> |
5 | 11 | <div class="col-6"> |
6 | 12 | <img class="w-25 float-right" src="{{apiImagenes}}/imagenes/logodebo.png"> |
src/app/components/header/header.component.ts
1 | -import { Component, OnInit } from '@angular/core'; | |
1 | +import { Component, OnInit, HostListener } from '@angular/core'; | |
2 | 2 | import { appSettings } from 'src/etc/AppSettings'; |
3 | +import { BsModalService } from 'ngx-bootstrap'; | |
4 | +import { ConfiguracionComponent } from '../configuracion/configuracion.component'; | |
3 | 5 | |
4 | 6 | @Component({ |
5 | 7 | selector: 'app-header', |
... | ... | @@ -9,10 +11,37 @@ import { appSettings } from 'src/etc/AppSettings'; |
9 | 11 | export class HeaderComponent implements OnInit { |
10 | 12 | |
11 | 13 | private apiImagenes : string = appSettings.apiImagenes; |
14 | + timer: any; | |
15 | + isShowModalConfiguration = false; | |
12 | 16 | |
13 | - constructor() { } | |
17 | + constructor( | |
18 | + private modalService: BsModalService, | |
19 | + ) { } | |
14 | 20 | |
15 | 21 | ngOnInit() { |
16 | 22 | } |
17 | 23 | |
24 | + @HostListener('document:keydown.Control.Shift.A', ['$event']) | |
25 | + openConfigurationScreen(delay: number = 3000) { | |
26 | + | |
27 | + if (this.isShowModalConfiguration) return; | |
28 | + | |
29 | + this.modalService.onHide | |
30 | + .subscribe(() => this.isShowModalConfiguration = false); | |
31 | + | |
32 | + this.timer = setTimeout(() => { | |
33 | + | |
34 | + this.isShowModalConfiguration = true; | |
35 | + this.modalService.show(ConfiguracionComponent, { | |
36 | + class: 'modal-md', | |
37 | + ignoreBackdropClick: true, | |
38 | + }); | |
39 | + }, delay); | |
40 | + } | |
41 | + | |
42 | + resetCountDown() { | |
43 | + | |
44 | + clearTimeout(this.timer); | |
45 | + } | |
46 | + | |
18 | 47 | } |