Commit 160083b90845d4b87ffd6bb28748b8f9a1d6da25
1 parent
338bf710b9
Exists in
master
Agregada data al ticket.
Showing
2 changed files
with
52 additions
and
9 deletions
Show diff stats
src/app/components/confirmacion-carrito/confirmacion-carrito.component.html
... | ... | @@ -56,18 +56,44 @@ |
56 | 56 | </div> |
57 | 57 | </div> |
58 | 58 | |
59 | - <div class="col-sm-5"> | |
59 | + <div class="col-sm-5 pl-0"> | |
60 | 60 | <div class="row ml-3"> |
61 | 61 | <!-- TICKET --> |
62 | - <div class="col-sm-7"> | |
62 | + <div class="col-sm-7 p-0"> | |
63 | 63 | <div class="card rounded-sm shadow"> |
64 | 64 | <div class="card-body"> |
65 | 65 | <p class="h5 card-title">Su Ticket</p> |
66 | - <p class="h6 card-text text-left mt-4 pr-2 vh-60 overflow-scroll"> | |
67 | - Ticket detalle. | |
68 | - </p> | |
69 | - <p class="h4 card-text text-right mt-3 mb-0"> | |
70 | - Total {{230 | currency}} | |
66 | + <div class="row mt-4 m-0"> | |
67 | + <div class="col-12 p-0 mb-2"> | |
68 | + <p class="h6 m-0 card-text text-left"> | |
69 | + <small class="font-weight-bold">DESCRIPCIÓN</small> | |
70 | + </p> | |
71 | + <p class="h6 m-0 card-text text-left"> | |
72 | + <small class="font-weight-bold">CANTIDAD X PRECIO UNITARIO</small> | |
73 | + </p> | |
74 | + </div> | |
75 | + </div> | |
76 | + <div class="row vh-50 overflow-scroll m-0"> | |
77 | + <div class="col-12 p-0 mb-2" *ngFor="let producto of productos"> | |
78 | + <p class="h6 m-0 card-text text-left"> | |
79 | + <small>{{producto.DetArt}}</small> | |
80 | + </p> | |
81 | + <div class="row d-flex justify-content-between m-0"> | |
82 | + <div class="col p-0"> | |
83 | + <p class="h6 m-0 card-text text-left"> | |
84 | + <small>{{producto.cantidad}} x {{producto.PreVen | currency}}</small> | |
85 | + </p> | |
86 | + </div> | |
87 | + <div class="col p-0"> | |
88 | + <p class="h6 m-0 card-text text-right"> | |
89 | + <small>{{(producto.PreVen) * (producto.cantidad) | currency}}</small> | |
90 | + </p> | |
91 | + </div> | |
92 | + </div> | |
93 | + </div> | |
94 | + </div> | |
95 | + <p class="h4 font-weight-bold card-text text-right mt-3 mb-0"> | |
96 | + Total {{getTotal() | currency}} | |
71 | 97 | </p> |
72 | 98 | </div> |
73 | 99 | </div> |
src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts
... | ... | @@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core'; |
2 | 2 | import { appSettings } from 'src/etc/AppSettings'; |
3 | 3 | import { Location } from '@angular/common'; |
4 | 4 | import { ProductoService } from 'src/app/services/producto.service'; |
5 | +import { Producto } from 'src/app/wrappers/producto'; | |
5 | 6 | |
6 | 7 | @Component({ |
7 | 8 | selector: 'app-confirmacion-carrito', |
... | ... | @@ -10,17 +11,33 @@ import { ProductoService } from 'src/app/services/producto.service'; |
10 | 11 | }) |
11 | 12 | export class ConfirmacionCarritoComponent implements OnInit { |
12 | 13 | |
13 | - productos = []; | |
14 | + productos: Producto[] = []; | |
15 | + total: number = 0; | |
14 | 16 | private apiUrl: string = appSettings.apiUrl; |
15 | 17 | |
16 | - constructor(private location: Location, private productoService: ProductoService) { } | |
18 | + constructor( | |
19 | + private location: Location, | |
20 | + private productoService: ProductoService | |
21 | + ) { } | |
17 | 22 | |
18 | 23 | ngOnInit() { |
24 | + | |
19 | 25 | this.productos = this.productoService.productos; |
20 | 26 | } |
21 | 27 | |
22 | 28 | volverPreviousPage() { |
29 | + | |
23 | 30 | this.location.back(); |
24 | 31 | } |
25 | 32 | |
33 | + getTotal() { | |
34 | + | |
35 | + var subTotal = 0; | |
36 | + this.productos.forEach(producto => { | |
37 | + | |
38 | + subTotal = subTotal + (producto.PreVen * producto.cantidad); | |
39 | + }); | |
40 | + return this.total = subTotal; | |
41 | + } | |
42 | + | |
26 | 43 | } |