Commit d0db3326b51ccb20a3a6880153ed331feb4b2994

Authored by Marcelo Puebla
Exists in develop

Merge branch 'develop' of git.focasoftware.com:angular/autoservicio-axion into develop

src/app/app-routing.module.ts
... ... @@ -51,6 +51,10 @@ const routes: Routes = [
51 51 path: 'comanda',
52 52 loadChildren: () => import('./modules/comanda/comanda.module').then(m => m.ComandaModule)
53 53 },
  54 + {
  55 + path: 'cancelar-compra',
  56 + loadChildren: () => import('./modules/cancelar-compra/cancelar-compra.module').then(m => m.CancelarCompraModule)
  57 + },
54 58 { path: '**', redirectTo: '', pathMatch: 'full' },
55 59 ];
56 60  
src/app/modules/admin/admin.component.ts
1   -import { Component, OnInit } from '@angular/core';
  1 +import { Component, OnInit, HostListener } from '@angular/core';
  2 +import { Router } from '@angular/router';
2 3  
3 4 @Component({
4 5 selector: 'app-admin',
5 6 templateUrl: './admin.component.html',
6 7 styleUrls: ['./admin.component.scss']
7 8 })
  9 +
8 10 export class AdminComponent implements OnInit {
  11 + timerReposo: any;
  12 +
  13 + constructor(
  14 + private router: Router,
  15 + ) { }
  16 +
  17 + ngOnInit() {
  18 + this.startTimeOutInactividad();
  19 + }
  20 +
  21 + @HostListener('document:click', ['$event'])
  22 +
  23 + documentClick(event: MouseEvent) {
  24 + if (event) {
  25 + this.restartTimer();
  26 + }
  27 + }
9 28  
10   - constructor() { }
  29 + restartTimer() {
  30 + clearTimeout(this.timerReposo);
  31 + this.startTimeOutInactividad();
  32 + }
11 33  
12   - ngOnInit() { }
  34 + startTimeOutInactividad() {
  35 + this.timerReposo = setTimeout(() => {
  36 + this.router.navigate(['cancelar-compra']);
  37 + }, 90000);
  38 + }
13 39  
14 40 }
src/app/modules/cancelar-compra/cancelar-compra-routing.module.ts
... ... @@ -0,0 +1,14 @@
  1 +import { NgModule, Component } from '@angular/core';
  2 +import { Routes, RouterModule } from '@angular/router';
  3 +import { CancelarCompraComponent } from './cancelar-compra.component';
  4 +
  5 +
  6 +const routes: Routes = [
  7 + { path: '', component: CancelarCompraComponent }
  8 +];
  9 +
  10 +@NgModule({
  11 + imports: [RouterModule.forChild(routes)],
  12 + exports: [RouterModule]
  13 +})
  14 +export class CancelarCompraRoutingModule { }
src/app/modules/cancelar-compra/cancelar-compra.component.html
... ... @@ -0,0 +1,51 @@
  1 +<div class="row justify-content-center mt-2 h-15">
  2 + <img class="w-20 my-auto" src="../../../assets/img/logo-spot.svg">
  3 +</div>
  4 +<div class="row mt-5 mx-0 justify-content-around h-30">
  5 + <div class="col-5 col-md-6 col-lg-3 h-100">
  6 + <div class="p-3 bg-white text-center shadow-lg rounded h-100">
  7 + <h4 class="pt-3 mt-5">NECESITA</h4>
  8 + <h2 class="font-weight-bold text-secondary mt-4">más tiempo</h2>
  9 + <h4 class="mt-4">PARA SU PEDIDO?</h4>
  10 + </div>
  11 + </div>
  12 +</div>
  13 +<!-- BUTTONS -->
  14 +<div class="row mt-5 h-auto justify-content-center mx-0">
  15 + <div class="col-auto px-0 h-auto align-self-start">
  16 + <div
  17 + class="btn-effect col-auto align-self-center px-0 bg-white"
  18 + (click)="volverPreviousPage()">
  19 + <div class="row mx-0 bg-primary badge-pill">
  20 + <div class="col-auto align-self-center text-white">continuar compra</div>
  21 + <div class="col-auto align-self-center p-0">
  22 + <img
  23 + draggable="false"
  24 + ondragstart="return false;"
  25 + (contextmenu)="false"
  26 + class="p-1 icon-30"
  27 + src="assets/img/ir.svg">
  28 + </div>
  29 + </div>
  30 + </div>
  31 + </div>
  32 +</div>
  33 +<div class="row mt-4 h-auto justify-content-center mx-0">
  34 + <div class="col-auto px-0 h-auto align-self-start">
  35 + <div
  36 + class="btn-effect col-auto align-self-center px-0 bg-white"
  37 + (click)="limpiarCarritoYvolver()">
  38 + <div class="row mx-0 bg-grey badge-pill">
  39 + <div class="col-auto align-self-center">cancelar compra</div>
  40 + <div class="col-auto align-self-center p-0">
  41 + <img
  42 + draggable="false"
  43 + ondragstart="return false;"
  44 + (contextmenu)="false"
  45 + class="p-1 icon-30"
  46 + src="assets/img/icono-cancelar-color.svg">
  47 + </div>
  48 + </div>
  49 + </div>
  50 + </div>
  51 +</div>
src/app/modules/cancelar-compra/cancelar-compra.component.scss
... ... @@ -0,0 +1,3 @@
  1 +.bg-grey {
  2 + background-color: rgb(212, 212, 212);
  3 +}
src/app/modules/cancelar-compra/cancelar-compra.component.spec.ts
... ... @@ -0,0 +1,25 @@
  1 +import { async, ComponentFixture, TestBed } from '@angular/core/testing';
  2 +
  3 +import { CancelarCompraComponent } from './cancelar-compra.component';
  4 +
  5 +describe('CancelarCompraComponent', () => {
  6 + let component: CancelarCompraComponent;
  7 + let fixture: ComponentFixture<CancelarCompraComponent>;
  8 +
  9 + beforeEach(async(() => {
  10 + TestBed.configureTestingModule({
  11 + declarations: [ CancelarCompraComponent ]
  12 + })
  13 + .compileComponents();
  14 + }));
  15 +
  16 + beforeEach(() => {
  17 + fixture = TestBed.createComponent(CancelarCompraComponent);
  18 + component = fixture.componentInstance;
  19 + fixture.detectChanges();
  20 + });
  21 +
  22 + it('should create', () => {
  23 + expect(component).toBeTruthy();
  24 + });
  25 +});
src/app/modules/cancelar-compra/cancelar-compra.component.ts
... ... @@ -0,0 +1,33 @@
  1 +import { Component, OnInit } from '@angular/core';
  2 +import { Location } from '@angular/common';
  3 +import { ArticuloService } from 'src/app/services/articulo/articulo.service';
  4 +import { Router } from '@angular/router';
  5 +
  6 +@Component({
  7 + selector: 'app-cancelar-compra',
  8 + templateUrl: './cancelar-compra.component.html',
  9 + styleUrls: ['./cancelar-compra.component.scss']
  10 +})
  11 +export class CancelarCompraComponent implements OnInit {
  12 +
  13 + constructor(
  14 + private location: Location,
  15 + private router: Router,
  16 + private articuloService: ArticuloService
  17 + ) { }
  18 +
  19 + ngOnInit() {
  20 + setTimeout(() => {
  21 + this.limpiarCarritoYvolver();
  22 + }, 90000);
  23 + }
  24 +
  25 + volverPreviousPage() {
  26 + this.location.back();
  27 + }
  28 +
  29 + limpiarCarritoYvolver() {
  30 + this.articuloService.carrito = undefined;
  31 + this.router.navigate(['/']);
  32 + }
  33 +}
src/app/modules/cancelar-compra/cancelar-compra.module.ts
... ... @@ -0,0 +1,15 @@
  1 +import { NgModule } from '@angular/core';
  2 +import { CommonModule } from '@angular/common';
  3 +
  4 +import { CancelarCompraRoutingModule } from './cancelar-compra-routing.module';
  5 +import { CancelarCompraComponent } from './cancelar-compra.component';
  6 +
  7 +
  8 +@NgModule({
  9 + declarations: [CancelarCompraComponent],
  10 + imports: [
  11 + CommonModule,
  12 + CancelarCompraRoutingModule
  13 + ]
  14 +})
  15 +export class CancelarCompraModule { }
src/app/modules/carrito/carrito.component.html
... ... @@ -121,6 +121,13 @@
121 121 </div>
122 122 </div>
123 123 </div>
  124 + <!-- TOTAL -->
  125 + <div class="row mx-3 mt-2 h-auto justify-content-end">
  126 + <div class="col-auto align-self-center text-primary"><small>TOTAL</small></div>
  127 + <div class="col-auto p-0 bg-primary d-none d-sm-block bg-total">
  128 + <p class="text-center text-white mt-1 py-1">{{articuloService.subTotal | currency}}</p>
  129 + </div>
  130 + </div>
124 131 <!-- CONTINUAR -->
125 132 <div
126 133 *ngIf="articuloService.carrito.length"
... ... @@ -140,7 +147,7 @@
140 147 </div>
141 148 </div>
142 149 <!-- SEGUIR COMPRANDO -->
143   - <div class="row mx-3 mt-2 h-auto justify-content-end">
  150 + <!-- <div class="row mx-3 mt-2 h-auto justify-content-end">
144 151 <div
145 152 class="col-auto py-2 px-3 align-self-center btn-effect bg-primary badge-pill text-white"
146 153 (click)="goBack()">
... ... @@ -154,7 +161,7 @@
154 161 src="assets/img/ir.svg">
155 162 </span>
156 163 </div>
157   - </div>
  164 + </div> -->
158 165 </div>
159 166  
160 167 </div>
src/app/modules/carrito/carrito.component.scss
... ... @@ -0,0 +1,4 @@
  1 +.bg-total {
  2 + width: 75px;
  3 + border-radius: 1.5rem;
  4 + }
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
... ... @@ -52,14 +52,14 @@ export class ComandaComponent implements OnInit {
52 52 }
53 53  
54 54 updateComanda(comanda: IComanda, estadoNuevo: number, observacionNueva: string) {
55   - let data = {
  55 + const data = {
56 56 idComanda: comanda.id,
57 57 estado: estadoNuevo,
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
... ... @@ -89,8 +89,8 @@
89 89 onerror="this.src='assets/img/image-not-found.jpg'"
90 90 class="card-img-top h-55 rounded-sm">
91 91 <div class="row mx-0 py-1 h-auto justify-content-center">
92   - <p class="col-12 px-1 h6 h-auto text-primary text-center">{{articulo.DetArt}}</p>
93   - <p class="col-12 px-1 h-auto text-center line-height-sm">
  92 + <p class="col-12 px-1 h6 h-auto text-primary text-center min-h-60">{{articulo.DetArt}}</p>
  93 + <p class="col-12 px-1 h-auto text-center line-height-sm min-h-50">
94 94 <small>{{articulo.DET_LAR}}</small>
95 95 </p>
96 96 <div class="col-12 px-1 align-self-end btn-effect h-auto">
... ... @@ -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 bg-total">
  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 +.bg-total {
  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) {
src/assets/img/icono-cancelar-color.svg
... ... @@ -0,0 +1,19 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
  3 +<!-- Creator: CorelDRAW X7 -->
  4 +<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="19.8306mm" height="19.8306mm" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
  5 +viewBox="0 0 1652 1652"
  6 + xmlns:xlink="http://www.w3.org/1999/xlink">
  7 + <defs>
  8 + <style type="text/css">
  9 + <![CDATA[
  10 + .fil0 {fill:#AA006B;fill-rule:nonzero}
  11 + ]]>
  12 + </style>
  13 + </defs>
  14 + <g id="Capa_x0020_1">
  15 + <metadata id="CorelCorpID_0Corel-Layer"/>
  16 + <polygon class="fil0" points="494,409 826,766 1158,409 1214,457 882,826 1214,1196 1158,1244 826,886 494,1244 439,1196 770,826 439,457 "/>
  17 + <path class="fil0" d="M1360 292c-136,-137 -325,-221 -534,-221 -208,0 -397,84 -534,221 -137,137 -221,326 -221,534 0,209 84,398 221,534 137,137 326,222 534,222 209,0 398,-85 534,-222 137,-136 222,-325 222,-534 0,-208 -85,-397 -222,-534zm-534 -292c228,0 435,92 584,242 150,149 242,356 242,584 0,228 -92,435 -242,584 -149,150 -356,242 -584,242 -228,0 -435,-92 -584,-242 -150,-149 -242,-356 -242,-584 0,-228 92,-435 242,-584 149,-150 356,-242 584,-242z"/>
  18 + </g>
  19 +</svg>
src/scss/styles-bootstrap.scss
... ... @@ -41,3 +41,11 @@ $border-radius-sm: 0.5rem;
41 41 }
42 42  
43 43 @import "node_modules/bootstrap/scss/bootstrap";
  44 +
  45 +.min-h-50 {
  46 + min-height: 50px;
  47 +}
  48 +
  49 +.min-h-60 {
  50 + min-height: 60px;
  51 +}