Commit bfc48cd1658b6125d518e0e3322b06bf50e9bb3e
1 parent
358235858a
Exists in
develop
arreglo identacion
Showing
1 changed file
with
5 additions
and
1 deletions
Show diff stats
src/app/shared/confirmacion/confirmacion.component.ts
1 | import { Component, OnInit, HostListener } from '@angular/core'; | 1 | import { Component, OnInit, HostListener } from '@angular/core'; |
2 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; | 2 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; |
3 | import { IArticulo } from 'src/app/interfaces/IArticulo'; | 3 | import { IArticulo } from 'src/app/interfaces/IArticulo'; |
4 | import { BsModalRef } from 'ngx-bootstrap/modal'; | 4 | import { BsModalRef } from 'ngx-bootstrap/modal'; |
5 | import { InactiveScreenService } from 'src/app/services/inactive-screen/inactive-screen.service'; | 5 | import { InactiveScreenService } from 'src/app/services/inactive-screen/inactive-screen.service'; |
6 | import { Subject } from 'rxjs'; | ||
6 | 7 | ||
7 | @Component({ | 8 | @Component({ |
8 | selector: 'app-confirmacion', | 9 | selector: 'app-confirmacion', |
9 | templateUrl: './confirmacion.component.html', | 10 | templateUrl: './confirmacion.component.html', |
10 | styleUrls: ['./confirmacion.component.scss'] | 11 | styleUrls: ['./confirmacion.component.scss'] |
11 | }) | 12 | }) |
12 | export class ConfirmacionComponent implements OnInit { | 13 | export class ConfirmacionComponent implements OnInit { |
13 | idArticulo: number; | 14 | idArticulo: number; |
14 | articulo: IArticulo; | 15 | articulo: IArticulo; |
16 | onClose: Subject<any>; | ||
15 | 17 | ||
16 | constructor( | 18 | constructor( |
17 | public modalRef: BsModalRef, | 19 | public modalRef: BsModalRef, |
18 | private articuloService: ArticuloService, | 20 | private articuloService: ArticuloService, |
19 | private inactiveScreen: InactiveScreenService, | 21 | private inactiveScreen: InactiveScreenService, |
20 | ) { } | 22 | ) { |
23 | this.onClose = new Subject(); | ||
24 | } | ||
21 | 25 | ||
22 | ngOnInit() { | 26 | ngOnInit() { |
23 | this.articuloService.getById(this.idArticulo) | 27 | this.articuloService.getById(this.idArticulo) |
24 | .subscribe((res: IArticulo) => { | 28 | .subscribe((res: IArticulo) => { |
25 | this.articulo = res; | 29 | this.articulo = res; |
26 | }, err => console.error(err)); | 30 | }, err => console.error(err)); |
27 | } | 31 | } |
28 | 32 | ||
29 | elegirArticulo(articulo: IArticulo) { | 33 | elegirArticulo(articulo: IArticulo) { |
30 | articulo.cantidad = 1; | 34 | articulo.cantidad = 1; |
31 | this.articuloService.setArticulo(articulo); | 35 | this.articuloService.setArticulo(articulo); |
32 | this.modalRef.hide(); | 36 | this.modalRef.hide(); |
33 | } | 37 | } |
34 | 38 | ||
35 | close() { | 39 | close() { |
36 | this.modalRef.hide(); | 40 | this.modalRef.hide(); |
37 | } | 41 | } |
38 | 42 | ||
39 | @HostListener('document:click', ['$event']) | 43 | @HostListener('document:click', ['$event']) |
40 | eventListener(event: Event) { | 44 | eventListener(event: Event) { |
41 | clearTimeout(this.inactiveScreen.timerReposo); | 45 | clearTimeout(this.inactiveScreen.timerReposo); |
42 | this.inactiveScreen.startTimeOutInactividad(); | 46 | this.inactiveScreen.startTimeOutInactividad(); |
43 | } | 47 | } |
44 | } | 48 | } |
45 | 49 |