Commit 45445a995a143970445fc5d41482a4e49aab849b
1 parent
1bdd0808e7
Exists in
develop
Fix
lint errors
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
src/app/modules/pago-electronico/pago-electronico.component.ts
| 1 | import { Component, OnInit, OnDestroy } from '@angular/core'; | 1 | import { Component, OnInit, OnDestroy } 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 { Router } from '@angular/router'; | 3 | import { Router } from '@angular/router'; |
| 4 | import { APP_SETTINGS } from 'src/etc/AppSettings'; | 4 | import { APP_SETTINGS } from 'src/etc/AppSettings'; |
| 5 | import { BsModalService } from 'ngx-bootstrap/modal'; | 5 | import { BsModalService } from 'ngx-bootstrap/modal'; |
| 6 | import { ErrorFormaPagoComponent } from 'src/app/shared/error-forma-pago/error-forma-pago.component'; | 6 | import { ErrorFormaPagoComponent } from 'src/app/shared/error-forma-pago/error-forma-pago.component'; |
| 7 | import { Subscription } from "rxjs"; | 7 | import { Subscription } from 'rxjs'; |
| 8 | 8 | ||
| 9 | @Component({ | 9 | @Component({ |
| 10 | selector: 'app-pago-electronico', | 10 | selector: 'app-pago-electronico', |
| 11 | templateUrl: './pago-electronico.component.html', | 11 | templateUrl: './pago-electronico.component.html', |
| 12 | styleUrls: ['./pago-electronico.component.scss'] | 12 | styleUrls: ['./pago-electronico.component.scss'] |
| 13 | }) | 13 | }) |
| 14 | export class PagoElectronicoComponent implements OnInit, OnDestroy { | 14 | export class PagoElectronicoComponent implements OnInit, OnDestroy { |
| 15 | urlQr = `${APP_SETTINGS.apiImagenes}/qr/${APP_SETTINGS.deploy}/${APP_SETTINGS.codigoP}/tienda/${APP_SETTINGS.terminal}`; | 15 | urlQr = `${APP_SETTINGS.apiImagenes}/qr/${APP_SETTINGS.deploy}/${APP_SETTINGS.codigoP}/tienda/${APP_SETTINGS.terminal}`; |
| 16 | subscription: Subscription; | 16 | subscription: Subscription; |
| 17 | 17 | ||
| 18 | constructor( | 18 | constructor( |
| 19 | private articuloService: ArticuloService, | 19 | private articuloService: ArticuloService, |
| 20 | private router: Router, | 20 | private router: Router, |
| 21 | private modalService: BsModalService, | 21 | private modalService: BsModalService, |
| 22 | ) { } | 22 | ) { } |
| 23 | 23 | ||
| 24 | ngOnInit() { | 24 | ngOnInit() { |
| 25 | if (!this.articuloService.carrito.length) { | 25 | if (!this.articuloService.carrito.length) { |
| 26 | this.router.navigate(['']); | 26 | this.router.navigate(['']); |
| 27 | return; | 27 | return; |
| 28 | } | 28 | } |
| 29 | const dataPago = { | 29 | const dataPago = { |
| 30 | pedidoAnombreDe: '' | 30 | pedidoAnombreDe: '' |
| 31 | }; | 31 | }; |
| 32 | dataPago.pedidoAnombreDe = ''; | 32 | dataPago.pedidoAnombreDe = ''; |
| 33 | this.subscription = this.articuloService.pay(dataPago) | 33 | this.subscription = this.articuloService.pay(dataPago) |
| 34 | .subscribe((res: any) => { | 34 | .subscribe((res: any) => { |
| 35 | this.articuloService.idComanda = res.data; | 35 | this.articuloService.idComanda = res.data; |
| 36 | this.router.navigate(['mensaje-final']); | 36 | this.router.navigate(['mensaje-final']); |
| 37 | }, (err) => { | 37 | }, (err) => { |
| 38 | this.modalService.show(ErrorFormaPagoComponent, { | 38 | this.modalService.show(ErrorFormaPagoComponent, { |
| 39 | class: 'modal-lg modal-dialog-centered', | 39 | class: 'modal-lg modal-dialog-centered', |
| 40 | ignoreBackdropClick: true, | 40 | ignoreBackdropClick: true, |
| 41 | }); | 41 | }); |
| 42 | }); | 42 | }); |
| 43 | this.mediaPantalla(); | 43 | this.mediaPantalla(); |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | ngOnDestroy() { | 46 | ngOnDestroy() { |
| 47 | if (this.subscription) this.subscription.unsubscribe(); | 47 | if (this.subscription) this.subscription.unsubscribe(); |
| 48 | for (let i = 1; i <= this.modalService.getModalsCount(); i++) { | 48 | for (let i = 1; i <= this.modalService.getModalsCount(); i++) { |
| 49 | this.modalService.hide(i); | 49 | this.modalService.hide(i); |
| 50 | } | 50 | } |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | mediaPantalla() { | 53 | mediaPantalla() { |
| 54 | if ($('body').hasClass('media-pantalla')) { | 54 | if ($('body').hasClass('media-pantalla')) { |
| 55 | $('.qr-mt').addClass('media-pantalla'); | 55 | $('.qr-mt').addClass('media-pantalla'); |
| 56 | } | 56 | } |
| 57 | } | 57 | } |
| 58 | } | 58 | } |
| 59 | 59 |