diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index f37ce3f..1b2461c 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -5,7 +5,6 @@ import { InicioComponent } from './components/inicio/inicio.component'; import { BusquedaProductosComponent } from './components/busqueda-productos/busqueda-productos.component'; import { ConfirmacionCarritoComponent } from './components/confirmacion-carrito/confirmacion-carrito.component'; import { MasterComponent } from './components/master/master.component'; -import { PagoComponent } from './components/pago/pago.component'; import { CancelarCompraComponent } from './components/cancelar-compra/cancelar-compra.component'; import { MensajeFinalComponent } from './components/mensaje-final/mensaje-final.component'; import { ComandaComponent } from './components/comanda/comanda.component'; @@ -14,7 +13,6 @@ const routes: Routes = [ { path: '', component: HomeComponent }, { path: 'home', component: HomeComponent }, { path: 'confirmacion-carrito', component: ConfirmacionCarritoComponent }, - { path: 'pago', component: PagoComponent }, { path: 'cancelar-compra', component: CancelarCompraComponent }, { path: 'mensaje-final', component: MensajeFinalComponent }, { path: 'comanda', component: ComandaComponent }, diff --git a/src/app/app.module.ts b/src/app/app.module.ts index d5985cc..8c3096c 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -27,7 +27,6 @@ import { ConfirmacionCarritoComponent } from './components/confirmacion-carrito/ import { MasterComponent } from './components/master/master.component'; import { PopoverPromosComponent } from './components/popover-promos/popover-promos.component'; import { PopoverSinonimosComponent } from './components/popover-sinonimos/popover-sinonimos.component'; -import { PagoComponent } from './components/pago/pago.component'; import { CancelarCompraComponent } from './components/cancelar-compra/cancelar-compra.component'; import { MensajeFinalComponent } from './components/mensaje-final/mensaje-final.component'; import { ComandaComponent } from './components/comanda/comanda.component'; @@ -45,7 +44,6 @@ import { ComandaComponent } from './components/comanda/comanda.component'; MasterComponent, PopoverPromosComponent, PopoverSinonimosComponent, - PagoComponent, CancelarCompraComponent, MensajeFinalComponent, ComandaComponent diff --git a/src/app/components/confirmacion-carrito/confirmacion-carrito.component.html b/src/app/components/confirmacion-carrito/confirmacion-carrito.component.html index fcc821d..46a0cfe 100644 --- a/src/app/components/confirmacion-carrito/confirmacion-carrito.component.html +++ b/src/app/components/confirmacion-carrito/confirmacion-carrito.component.html @@ -1,8 +1,8 @@
- @@ -16,24 +16,23 @@
-
- +
-
+

Mi Compra

-
+

Por favor, controle y confirme su compra.

-
+
-
-
+
+

- - {{p.cantidad}} {{p.DET_LAR}} + - {{p.cantidad * producto.cantidad}} {{p.DET_LAR}}

@@ -70,57 +69,62 @@
-
-
- -
-
-
-

Su Ticket

-
-
-

- DESCRIPCIÓN -

+ +
+
+ +
+
+ + +
+
+
+

Su Ticket

+
+
+

+ DESCRIPCIÓN +

+

+ CANTIDAD X PRECIO UNITARIO +

+
+
+
+
+

+ {{producto.DET_LAR}} +

+
+

- CANTIDAD X PRECIO UNITARIO + {{producto.cantidad}} x {{producto.PreVen | currency}}

-
-
-
-

- {{producto.DET_LAR}} +

+

+ {{(producto.PreVen) * (producto.cantidad) | currency}}

-
-
-

- {{producto.cantidad}} x {{producto.PreVen | currency}} -

-
-
-

- {{(producto.PreVen) * (producto.cantidad) | currency}} -

-
-
-

- Total {{getTotal() | currency}} -

+

+ Total {{getTotal() | currency}} +

-
+
-
+
-
+
+ +
+

+ Forma de pago +

+ + +
+
+ Efectivo +
+
+ +
+
+ + +
+
+ Tarjeta +
+
+ +
+
+ + +
+
+ Pago Electrónico +
+
+ +
+
+
+
+
+

+ Su pago fue
+ acreditado + exitosamente +

+

Recuerde retirar su ticket

+
+
+ +
+
+

+ Retire su ticket
+ y diríjase a caja para
+ efectuar el pago. +

+
diff --git a/src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts b/src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts index b8bc906..77084a7 100644 --- a/src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts +++ b/src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts @@ -16,6 +16,9 @@ export class ConfirmacionCarritoComponent implements OnInit, OnDestroy { private total: number = 0; private apiImagenes: string = appSettings.apiImagenes; private timerReposo: any; + private compraConEfectivofinalizada: boolean = false; + private compraConQRfinalizada: boolean = false; + private verQR: boolean = false; constructor( private location: Location, @@ -39,6 +42,10 @@ export class ConfirmacionCarritoComponent implements OnInit, OnDestroy { volverPreviousPage() { + if (this.verQR) { + this.verQR = !this.verQR; + return; + } this.location.back(); } @@ -61,4 +68,35 @@ export class ConfirmacionCarritoComponent implements OnInit, OnDestroy { }, 90000) } + //#region METODOS PARA LA FORMA DE PAGO + pagoEfectivo() { + + this.compraConEfectivofinalizada = true; + clearTimeout(this.timerReposo); + setTimeout(() => { + + this.router.navigate(['mensaje-final']); + }, 3000); + } + + pagar(medioPago: string) { + + this.verQR = true; + + this.productoService.pagar(medioPago) + .subscribe(() => { + + clearTimeout(this.timerReposo); + this.compraConQRfinalizada = true; + setTimeout(() => { + + this.router.navigate(['mensaje-final']); + }, 3000); + }, err => { + console.log(err); + alert('algo salió mal'); + }) + } + //#endregion + } diff --git a/src/app/components/pago/pago.component.html b/src/app/components/pago/pago.component.html deleted file mode 100644 index 047bd97..0000000 --- a/src/app/components/pago/pago.component.html +++ /dev/null @@ -1,165 +0,0 @@ -
- -
- - - - -
-
-

- Pagar -

-
-
- -
-
-

Elija forma de pago

-
-
- -
- -
-
-
-
- -
-

Efectivo

-
-
-
-
-
- -
-

Tarjeta

-
-
-
-
-
- -
-

Pago Electrónico

-
-
-
-
-
- -
-
- -
-
-
-

Su Ticket

-
-
-

- DESCRIPCIÓN -

-

- CANTIDAD X PRECIO UNITARIO -

-
-
-
-
-

- {{producto.DET_LAR}} -

-
-
-

- {{producto.cantidad}} x {{producto.PreVen | currency}} -

-
-
-

- {{(producto.PreVen) * (producto.cantidad) | currency}} -

-
-
-
-
-

- Total {{getTotal() | currency}} -

-
-
-
-
-
-
- -
-
- -
-
- - -
-
-
-
-
- - -
-
-
-
-
- -
- -
- -
-
-

- Su pago fue
- acreditado - exitosamente -

-

Recuerde retirar su ticket

-
-
- -
-
-

- Retire su ticket
- y diríjase a caja para
- efectuar el pago. -

-
-
diff --git a/src/app/components/pago/pago.component.scss b/src/app/components/pago/pago.component.scss deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/components/pago/pago.component.spec.ts b/src/app/components/pago/pago.component.spec.ts deleted file mode 100644 index 4565dc8..0000000 --- a/src/app/components/pago/pago.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { PagoComponent } from './pago.component'; - -describe('PagoComponent', () => { - let component: PagoComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ PagoComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PagoComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/components/pago/pago.component.ts b/src/app/components/pago/pago.component.ts deleted file mode 100644 index 67c85ea..0000000 --- a/src/app/components/pago/pago.component.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { Component, OnInit, OnDestroy } from '@angular/core'; -import { appSettings } from 'src/etc/AppSettings'; -import { Location } from '@angular/common'; -import { ProductoService } from 'src/app/services/producto.service'; -import { Router } from '@angular/router'; -import { Producto } from 'src/app/wrappers/producto'; - -@Component({ - selector: 'app-pago', - templateUrl: './pago.component.html', - styleUrls: ['./pago.component.scss'] -}) -export class PagoComponent implements OnInit, OnDestroy { - - private apiImagenes: string = appSettings.apiImagenes; - private verQR: boolean = false; - private productos: Producto[] = []; - private total: number = 0; - - private compraConQRfinalizada: boolean = false; - private compraConEfectivofinalizada: boolean = false; - private timerReposo: any; - - constructor( - private productoService: ProductoService, - private location: Location, - private router: Router, - ) { } - - ngOnInit() { - - this.timerReposo = setTimeout(() => { - - this.router.navigate(['cancelar-compra']); - }, 90000) - this.productos = this.productoService.productos; - } - - ngOnDestroy() { - - clearTimeout(this.timerReposo); - } - - pagoEfectivo() { - - this.compraConEfectivofinalizada = true; - clearTimeout(this.timerReposo); - setTimeout(() => { - - this.router.navigate(['mensaje-final']); - }, 3000); - } - - pagar(medioPago: string) { - - this.verQR = true; - - this.productoService.pagar(medioPago) - .subscribe(() => { - - clearTimeout(this.timerReposo); - this.compraConQRfinalizada = true; - setTimeout(() => { - - this.router.navigate(['mensaje-final']); - }, 3000); - }, err => { - console.log(err); - alert('algo salió mal'); - }) - } - - volverPreviousPage() { - - if (this.verQR) { - this.verQR = false; - return; - } - this.location.back(); - } - - getTotal() { - - var subTotal = 0; - this.productos.forEach(producto => { - - subTotal = subTotal + (producto.PreVen * producto.cantidad); - }); - return this.total = subTotal; - } - - reiniciarTimer() { - - clearTimeout(this.timerReposo); - this.timerReposo = setTimeout(() => { - - this.router.navigate(['cancelar-compra']); - }, 90000) - } - -}