diff --git a/src/app/modules/carrito/carrito.component.ts b/src/app/modules/carrito/carrito.component.ts
index 4a9a2e9..4edec1f 100644
--- a/src/app/modules/carrito/carrito.component.ts
+++ b/src/app/modules/carrito/carrito.component.ts
@@ -4,6 +4,7 @@ import { ArticuloService } from 'src/app/services/articulo/articulo.service';
import { APP_SETTINGS } from 'src/etc/AppSettings';
import { trigger, state, style, transition, animate } from '@angular/animations';
import { IArticulo } from 'src/app/interfaces/IArticulo';
+import { Router } from '@angular/router';
@Component({
selector: 'app-carrito',
@@ -27,11 +28,17 @@ export class CarritoComponent implements OnInit {
maxCantidad = 50;
constructor(
- private location: Location,
public articuloService: ArticuloService,
+ private location: Location,
+ private router: Router,
) { }
- ngOnInit() { }
+ ngOnInit() {
+ if (!this.articuloService.carrito.length) {
+ this.router.navigate(['']);
+ return;
+ }
+ }
deleteArticulo(index: number) {
this.articuloService.carrito.splice(index, 1);
diff --git a/src/app/modules/forma-pago/forma-pago.component.html b/src/app/modules/forma-pago/forma-pago.component.html
index dcdf9a9..afc9869 100644
--- a/src/app/modules/forma-pago/forma-pago.component.html
+++ b/src/app/modules/forma-pago/forma-pago.component.html
@@ -22,7 +22,7 @@
+ (click)="medioPago(9)">

+ [src]="urlQr">
diff --git a/src/app/modules/pago-electronico/pago-electronico.component.ts b/src/app/modules/pago-electronico/pago-electronico.component.ts
index df90555..dac18ac 100644
--- a/src/app/modules/pago-electronico/pago-electronico.component.ts
+++ b/src/app/modules/pago-electronico/pago-electronico.component.ts
@@ -1,4 +1,7 @@
import { Component, OnInit } from '@angular/core';
+import { ArticuloService } from 'src/app/services/articulo/articulo.service';
+import { Router } from '@angular/router';
+import { APP_SETTINGS } from 'src/etc/AppSettings';
@Component({
selector: 'app-pago-electronico',
@@ -6,10 +9,26 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./pago-electronico.component.scss']
})
export class PagoElectronicoComponent implements OnInit {
+ urlQr = `${APP_SETTINGS.apiDeboSuite}/qr/dev/${APP_SETTINGS.codigoP}/tienda/${APP_SETTINGS.terminal}`;
- constructor() { }
+ constructor(
+ private articuloService: ArticuloService,
+ private router: Router,
+ ) { }
ngOnInit() {
+ if (!this.articuloService.carrito.length) {
+ this.router.navigate(['']);
+ return;
+ }
+ let dataPago = {
+ pedidoAnombreDe: ''
+ }
+ this.articuloService.pay(dataPago)
+ .subscribe((res: any) => {
+ this.articuloService.idComanda = res.data;
+ this.router.navigate(['mensaje-final']);
+ }, err => console.error(err));
}
}
diff --git a/src/app/modules/pago-tarjeta/pago-tarjeta.component.ts b/src/app/modules/pago-tarjeta/pago-tarjeta.component.ts
index 4c78640..2d98636 100644
--- a/src/app/modules/pago-tarjeta/pago-tarjeta.component.ts
+++ b/src/app/modules/pago-tarjeta/pago-tarjeta.component.ts
@@ -15,6 +15,10 @@ export class PagoTarjetaComponent implements OnInit {
) { }
ngOnInit() {
+ if (!this.articuloService.carrito.length) {
+ this.router.navigate(['']);
+ return;
+ }
let dataPago = {
pedidoAnombreDe: ''
}
diff --git a/src/app/services/articulo/articulo.service.ts b/src/app/services/articulo/articulo.service.ts
index 234b8d7..8678526 100644
--- a/src/app/services/articulo/articulo.service.ts
+++ b/src/app/services/articulo/articulo.service.ts
@@ -48,7 +48,7 @@ export class ArticuloService {
return new Observable((observer) => {
this.clienteService.getById(-1)
.subscribe(cliente => {
- let puntoVenta = 9998;
+ let puntoVenta = APP_SETTINGS.puntoVenta;
this.markArticuloInPromoAsRemoved();
this.http.post(`${this.urlDeboSuite}/comprobante/guardar/${this.medioPago}`, {
productos: this.carrito,
@@ -57,7 +57,7 @@ export class ArticuloService {
codigoVendedor: 5,
puntoVenta: this.medioPago === 9 ? -1 * puntoVenta : puntoVenta,
pedidoAnombreDe: dataPago.pedidoAnombreDe,
- numeroPlanilla: '11111',
+ numeroPlanilla: APP_SETTINGS.numeroPlanilla,
})
.subscribe((data) => {
observer.next(data);
diff --git a/src/etc/AppSettings.ejemplo.ts b/src/etc/AppSettings.ejemplo.ts
index 437d505..b436197 100644
--- a/src/etc/AppSettings.ejemplo.ts
+++ b/src/etc/AppSettings.ejemplo.ts
@@ -1,3 +1,7 @@
// export const APP_SETTINGS = {
-// apiDeboSuite: 'http://localhost:9900'
+ // apiDeboSuite: 'http://localhost:9900',
+ // puntoVenta: 9998,
+ // numeroPlanilla: '1111',
+ // codigoP: 99996,
+ // terminal: 101
// }