info-formas-pago.component.ts 967 Bytes
import { Component, OnInit, TemplateRef, OnDestroy } from '@angular/core';
import { BsModalService } from 'ngx-bootstrap/modal';

@Component({
  selector: 'app-formas-pago',
  templateUrl: './info-formas-pago.component.html',
  styleUrls: ['./info-formas-pago.component.scss']
})
export class InfoFormasPagoComponent implements OnInit, OnDestroy {
  timer: any;

  constructor(
    private modalService: BsModalService,
  ) { }

  ngOnInit() {
    this.mediaPantalla();
  }

  ngOnDestroy() {
    if (this.timer) clearTimeout(this.timer);
  }

  openGoCaja(templateRef: TemplateRef<any>) {
    const modalRef = this.modalService.show(templateRef, { class: 'modal-promo modal-dialog-centered' });
    this.timer = setTimeout(() => {
      modalRef.hide();
    }, 3000);
  }

  mediaPantalla() {
    if ($('body').hasClass('media-pantalla')) {
      $('.reduce-card-1,.reduce-card-2')
        .addClass('media-pantalla')
        .addBack('media-pantalla');
    }
  }
}