diff --git a/src/app/components/confirmacion-carrito/confirmacion-carrito.component.html b/src/app/components/confirmacion-carrito/confirmacion-carrito.component.html index c5d66bb..9c1cb17 100644 --- a/src/app/components/confirmacion-carrito/confirmacion-carrito.component.html +++ b/src/app/components/confirmacion-carrito/confirmacion-carrito.component.html @@ -56,18 +56,44 @@ -
+
-
+

Su Ticket

-

- Ticket detalle. -

-

- Total {{230 | currency}} +

+
+

+ DESCRIPCIƓN +

+

+ CANTIDAD X PRECIO UNITARIO +

+
+
+
+
+

+ {{producto.DetArt}} +

+
+
+

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

+
+
+

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

+
+
+
+
+

+ Total {{getTotal() | currency}}

diff --git a/src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts b/src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts index b38d93c..852090f 100644 --- a/src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts +++ b/src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts @@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { appSettings } from 'src/etc/AppSettings'; import { Location } from '@angular/common'; import { ProductoService } from 'src/app/services/producto.service'; +import { Producto } from 'src/app/wrappers/producto'; @Component({ selector: 'app-confirmacion-carrito', @@ -10,17 +11,33 @@ import { ProductoService } from 'src/app/services/producto.service'; }) export class ConfirmacionCarritoComponent implements OnInit { - productos = []; + productos: Producto[] = []; + total: number = 0; private apiUrl: string = appSettings.apiUrl; - constructor(private location: Location, private productoService: ProductoService) { } + constructor( + private location: Location, + private productoService: ProductoService + ) { } ngOnInit() { + this.productos = this.productoService.productos; } volverPreviousPage() { + this.location.back(); } + getTotal() { + + var subTotal = 0; + this.productos.forEach(producto => { + + subTotal = subTotal + (producto.PreVen * producto.cantidad); + }); + return this.total = subTotal; + } + }