confirmacion.component.ts 1.05 KB
import { Component, OnInit, HostListener } from '@angular/core';
import { ArticuloService } from 'src/app/services/articulo/articulo.service';
import { IArticulo } from 'src/app/interfaces/IArticulo';
import { BsModalRef } from 'ngx-bootstrap/modal';
import { InactiveScreenService } from 'src/app/services/inactive-screen/inactive-screen.service';
import { Subject } from 'rxjs';

@Component({
  selector: 'app-confirmacion',
  templateUrl: './confirmacion.component.html',
  styleUrls: ['./confirmacion.component.scss']
})
export class ConfirmacionComponent implements OnInit {
  onClose: Subject<any>;

  constructor(
    public modalRef: BsModalRef,
    private inactiveScreen: InactiveScreenService,
  ) {
    this.onClose = new Subject();
  }

  ngOnInit() {
  }

  confirmarArticulo() {
    this.onClose.next();
    this.modalRef.hide();
  }

  close() {
    this.modalRef.hide();
  }

  @HostListener('document:click', ['$event'])
  eventListener(event: Event) {
    clearTimeout(this.inactiveScreen.timerReposo);
    this.inactiveScreen.startTimeOutInactividad();
  }
}