Commit fc90983e6bb708c3c5cea10d3046af1bcdfb07ae

Authored by Marcelo Puebla

Merge branch 'master' into 'develop'

Master(benjamin)

See merge request !19
src/app/modules/carrito/carrito.component.ts
... ... @@ -42,16 +42,19 @@ export class CarritoComponent implements OnInit {
42 42  
43 43 deleteArticulo(index: number) {
44 44 this.articuloService.carrito.splice(index, 1);
  45 + this.articuloService.calcularTotal();
45 46 }
46 47  
47 48 substractCant(articulo: IArticulo) {
48 49 if (articulo.cantidad === 1) return;
49 50 articulo.cantidad--;
  51 + this.articuloService.calcularTotal();
50 52 }
51 53  
52 54 addCant(articulo: IArticulo) {
53 55 if (articulo.cantidad >= this.maxCantidad) return;
54 56 articulo.cantidad++;
  57 + this.articuloService.calcularTotal();
55 58 }
56 59  
57 60 goBack() {
src/app/modules/comanda/comanda.component.ts
... ... @@ -58,8 +58,8 @@ export class ComandaComponent implements OnInit {
58 58 observacion: observacionNueva,
59 59 tiempoEspera: `${comanda.hoursPedido}:${comanda.secondsPedido}:${comanda.secondsPedido}`,
60 60 tiempoElaboracion: `${comanda.hoursElaboracion}:${comanda.secondsElaboracion}:${comanda.secondsElaboracion}`,
61   - }
62   - if (data.estado == 3) {
  61 + };
  62 + if (data.estado === 3) {
63 63 this.comandaService.imprimirComandaCocina(parseInt(data.idComanda))
64 64 .subscribe(res => { }, err => console.error(err)
65 65 );
... ... @@ -72,10 +72,10 @@ export class ComandaComponent implements OnInit {
72 72 if (res.data) {
73 73 comanda.estado = estadoNuevo;
74 74 comanda.observacion = observacionNueva;
75   - if (estadoNuevo == 2) {
  75 + if (estadoNuevo === 2) {
76 76 this.startTimerElaboracion(comanda);
77 77 } else if (comanda.timerElaboracion) {
78   - clearInterval(comanda.timerElaboracion)
  78 + clearInterval(comanda.timerElaboracion);
79 79 }
80 80 }
81 81 }, e => console.error(e));
src/app/modules/opcion-pedido/opcion-pedido.component.html
... ... @@ -12,7 +12,7 @@
12 12 <div class="h-85">
13 13 <div class="row mt-5 mx-3 h-auto">
14 14 <div class="col-12 px-0 py-2 align-self-center">
15   - <p class="h6 text-truncate text-center">TÚ PEDIDO ES PARA</p>
  15 + <p class="h6 text-truncate text-center">TU PEDIDO ES PARA</p>
16 16 </div>
17 17 </div>
18 18 <div class="row mt-5 h-auto justify-content-center mx-0">
src/app/modules/pago-tarjeta/pago-tarjeta.component.html
... ... @@ -20,7 +20,7 @@
20 20 src="assets/img/icono-tarjetas.svg">
21 21 <p class="h6 m-0">AHORA</p>
22 22 <p class="h2 mb-3 text-secondary">
23   - introducí o insertá tú tarjeta
  23 + introducí o insertá tu tarjeta
24 24 </p>
25 25 <p class="h6 m-0">Y SEGUÍ LAS INSTRUCCIONES DEL LECTOR</p>
26 26 </div>
src/app/modules/seleccion-articulos/seleccion-articulos.component.html
... ... @@ -192,15 +192,19 @@
192 192 </div>
193 193 </div>
194 194 </div>
195   - <!-- VER CARRITO -->
  195 + <!-- VER CARRITO Y TOTAL-->
196 196 <div
197 197 class="col-auto p-0 mt-2 ml-auto h-20"
198 198 *ngIf="articuloService.carrito.length">
199 199 <div
200 200 class="btn-effect col-auto align-self-center px-0 bg-white"
201 201 [routerLink]="['/carrito']">
202   - <div class="row mx-0 bg-light">
203   - <div class="col-auto align-self-center text-primary">VER CARRITO</div>
  202 + <div class="row justify-content-between mx-0">
  203 + <div class="col-auto align-self-center text-primary">TOTAL</div>
  204 + <div class="col-auto p-0 bg-primary d-none d-sm-block total-background">
  205 + <p class="text-center text-white mt-1 py-1">{{articuloService.subTotal | currency}}</p>
  206 + </div>
  207 + <div class="col-auto align-self-center text-primary ml-2 bg-light">VER CARRITO</div>
204 208 <div class="col-auto p-0 bg-primary d-none d-sm-block">
205 209 <img
206 210 draggable="false"
src/app/modules/seleccion-articulos/seleccion-articulos.component.scss
... ... @@ -37,4 +37,9 @@ $primary: #aa006b;
37 37  
38 38 .line-height-sm {
39 39 line-height: 1.2;
40   -}
41 40 \ No newline at end of file
  41 +}
  42 +
  43 +.total-background {
  44 + width: 110px;
  45 + border-radius: 1.5rem;
  46 +}
src/app/modules/seleccion-articulos/seleccion-articulos.component.ts
... ... @@ -25,6 +25,7 @@ export class SeleccionArticulosComponent implements OnInit {
25 25 ordenandoByVendidos = true;
26 26 allActive = true;
27 27 modalRef: BsModalRef;
  28 + total: number = 0;
28 29  
29 30 constructor(
30 31 public articuloService: ArticuloService,
src/app/modules/splash-screen/splash-screen.component.ts
... ... @@ -11,7 +11,7 @@ export class SplashScreenComponent implements OnInit {
11 11 textWelcome = 'BIENVENIDO A SPOT!';
12 12 textComoEstas = '¿cómo estás?';
13 13 textInvitamos = 'TE INVITAMOS A HACER';
14   - textTuPedido = 'tú pedido acá';
  14 + textTuPedido = 'tu pedido acá';
15 15  
16 16 constructor() { }
17 17  
src/app/services/articulo/articulo.service.ts
... ... @@ -15,6 +15,7 @@ export class ArticuloService {
15 15 urlDeboSuite = APP_SETTINGS.apiDeboSuite;
16 16 medioPago: number;
17 17 idComanda: number;
  18 + subTotal: number = 0;
18 19  
19 20 constructor(
20 21 private http: HttpClient,
... ... @@ -33,6 +34,13 @@ export class ArticuloService {
33 34 return this.http.get(`${this.urlDeboSuite}/articulos/${page}`);
34 35 }
35 36  
  37 + calcularTotal() {
  38 + this.subTotal=0
  39 + this.carrito.forEach(articulo => {
  40 + this.subTotal += (articulo.PreVen * articulo.cantidad);
  41 + });
  42 + }
  43 +
36 44 setArticulo(articulo: IArticulo) {
37 45 for (const articuloCarrito of this.carrito) {
38 46 if (articuloCarrito.id === articulo.id) {
... ... @@ -43,6 +51,7 @@ export class ArticuloService {
43 51 }
44 52 this.setArticulosSinImagen([articulo]);
45 53 this.carrito.unshift(articulo);
  54 + this.calcularTotal();
46 55 }
47 56  
48 57 pay(dataPago: any) {