Commit 8bebd222c3dabbb7bd7ac15706633a1b5eb5ecc1
Exists in
master
Merge branch 'master' of git.focasoftware.com:angular/autoservicio
Showing
3 changed files
Show diff stats
src/app/components/comanda/comanda.component.html
1 | <div class="container-fluid fade-in p-0"> | 1 | <div class="container-fluid fade-in p-0"> |
2 | 2 | ||
3 | <div class="row m-2"> | 3 | <div class="row m-2"> |
4 | <div class="col-12"> | 4 | <div class="col-12"> |
5 | <p class="m-0 h2 text-center">Pedidos a elaborar</p> | 5 | <p class="m-0 h2 text-center">Pedidos a elaborar</p> |
6 | </div> | 6 | </div> |
7 | </div> | 7 | </div> |
8 | 8 | ||
9 | <div class="card-columns m-1 fade-in disable-user-select"> | 9 | <div class="card-columns m-1 fade-in disable-user-select"> |
10 | <div | 10 | <div |
11 | *ngFor="let comanda of comandas" | 11 | *ngFor="let comanda of comandas" |
12 | class="card fade-in rounded-xs shadow-sm" | 12 | class="card fade-in rounded-xs shadow-sm" |
13 | [ngClass]="{ | 13 | [ngClass]="{ |
14 | 'bg-light': comanda.estado === 1, | 14 | 'bg-light': comanda.estado === 1, |
15 | 'bg-danger': comanda.estado === 2, | 15 | 'bg-danger': comanda.estado === 2, |
16 | 'bg-success swing-out-top-bck': comanda.estado === 3 | 16 | 'bg-success swing-out-top-bck': comanda.estado === 3 |
17 | }"> | 17 | }"> |
18 | <div class="card-body p-2"> | 18 | <div class="card-body p-2"> |
19 | <p class="h5 card-title text-center mb-1">{{comanda.id}}.</p> | 19 | <p class="h5 card-title text-center mb-1">{{comanda.id.toString().slice(comanda.id.toString().length - 2)}}.</p> |
20 | <p | 20 | <p |
21 | *ngFor="let detalle of comanda.detalles" | 21 | *ngFor="let detalle of comanda.detalles" |
22 | [ngClass]=" | 22 | [ngClass]=" |
23 | { | 23 | { |
24 | 'border-secondary': comanda.estado === 1, | 24 | 'border-secondary': comanda.estado === 1, |
25 | 'border-light': comanda.estado != 1 | 25 | 'border-light': comanda.estado != 1 |
26 | }" | 26 | }" |
27 | class="card-text border-top pt-2 mb-2"> | 27 | class="card-text border-top pt-2 mb-2"> |
28 | <small> | 28 | <small> |
29 | {{detalle.articulo.DET_LAR}} | 29 | {{detalle.articulo.DET_LAR}} |
30 | </small> | 30 | </small> |
31 | </p> | 31 | </p> |
32 | <button | 32 | <button |
33 | *ngIf="comanda.estado === 1" | 33 | *ngIf="comanda.estado === 1" |
34 | class="btn btn-block btn-danger shadow-sm" | 34 | class="btn btn-block btn-danger shadow-sm" |
35 | (click)="updateComanda(comanda, 2, 'En elaboracion')"> | 35 | (click)="updateComanda(comanda, 2, 'En elaboracion')"> |
36 | Elaborar | 36 | Elaborar |
37 | </button> | 37 | </button> |
38 | <button | 38 | <button |
39 | *ngIf="comanda.estado === 2" | 39 | *ngIf="comanda.estado === 2" |
40 | class="btn btn-block btn-success shadow-sm" | 40 | class="btn btn-block btn-success shadow-sm" |
41 | (click)="updateComanda(comanda, 3, 'Terminado')"> | 41 | (click)="updateComanda(comanda, 3, 'Terminado')"> |
42 | Terminado | 42 | Terminado |
43 | </button> | 43 | </button> |
44 | <button | 44 | <button |
45 | *ngIf="comanda.estado === 2" | 45 | *ngIf="comanda.estado === 2" |
46 | class="btn btn-block btn-light btn-sm shadow-sm p-0" | 46 | class="btn btn-block btn-light btn-sm shadow-sm p-0" |
47 | (click)="updateComanda(comanda, 1, 'Pagado')"> | 47 | (click)="updateComanda(comanda, 1, 'Pagado')"> |
48 | <span class="pr-1 h6"><small>En espera</small></span> | 48 | <span class="pr-1 h6"><small>En espera</small></span> |
49 | <i class="fa fa-undo text-warning" aria-hidden="true"></i> | 49 | <i class="fa fa-undo text-warning" aria-hidden="true"></i> |
50 | </button> | 50 | </button> |
51 | </div> | 51 | </div> |
52 | </div> | 52 | </div> |
53 | </div> | 53 | </div> |
54 | </div> | 54 | </div> |
55 | 55 |
src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts
1 | import { Component, OnInit, OnDestroy } from '@angular/core'; | 1 | import { Component, OnInit, OnDestroy } from '@angular/core'; |
2 | import { appSettings } from 'src/etc/AppSettings'; | 2 | import { appSettings } from 'src/etc/AppSettings'; |
3 | import { Location } from '@angular/common'; | 3 | import { Location } from '@angular/common'; |
4 | import { ProductoService } from 'src/app/services/producto.service'; | 4 | import { ProductoService } from 'src/app/services/producto.service'; |
5 | import { Producto } from 'src/app/wrappers/producto'; | 5 | import { Producto } from 'src/app/wrappers/producto'; |
6 | import { Router } from '@angular/router'; | 6 | import { Router } from '@angular/router'; |
7 | 7 | ||
8 | @Component({ | 8 | @Component({ |
9 | selector: 'app-confirmacion-carrito', | 9 | selector: 'app-confirmacion-carrito', |
10 | templateUrl: './confirmacion-carrito.component.html', | 10 | templateUrl: './confirmacion-carrito.component.html', |
11 | styleUrls: ['./confirmacion-carrito.component.scss'] | 11 | styleUrls: ['./confirmacion-carrito.component.scss'] |
12 | }) | 12 | }) |
13 | export class ConfirmacionCarritoComponent implements OnInit, OnDestroy { | 13 | export class ConfirmacionCarritoComponent implements OnInit, OnDestroy { |
14 | 14 | ||
15 | private productos: Producto[] = []; | 15 | private productos: Producto[] = []; |
16 | private total: number = 0; | 16 | private total: number = 0; |
17 | private apiImagenes: string = appSettings.apiImagenes; | 17 | private apiImagenes: string = appSettings.apiImagenes; |
18 | private timerReposo: any; | 18 | private timerReposo: any; |
19 | private compraConEfectivofinalizada: boolean = false; | 19 | private compraConEfectivofinalizada: boolean = false; |
20 | private compraConQRfinalizada: boolean = false; | 20 | private compraConQRfinalizada: boolean = false; |
21 | private verQR: boolean = false; | 21 | private verQR: boolean = false; |
22 | 22 | ||
23 | constructor( | 23 | constructor( |
24 | private location: Location, | 24 | private location: Location, |
25 | private productoService: ProductoService, | 25 | private productoService: ProductoService, |
26 | private router: Router | 26 | private router: Router |
27 | ) { } | 27 | ) { } |
28 | 28 | ||
29 | ngOnInit() { | 29 | ngOnInit() { |
30 | 30 | ||
31 | this.timerReposo = setTimeout(() => { | 31 | this.timerReposo = setTimeout(() => { |
32 | 32 | ||
33 | this.router.navigate(['cancelar-compra']); | 33 | this.router.navigate(['cancelar-compra']); |
34 | }, 90000) | 34 | }, 90000) |
35 | this.productos = this.productoService.productos; | 35 | this.productos = this.productoService.productos; |
36 | } | 36 | } |
37 | 37 | ||
38 | ngOnDestroy() { | 38 | ngOnDestroy() { |
39 | 39 | ||
40 | clearTimeout(this.timerReposo); | 40 | clearTimeout(this.timerReposo); |
41 | } | 41 | } |
42 | 42 | ||
43 | volverPreviousPage() { | 43 | volverPreviousPage() { |
44 | 44 | ||
45 | if (this.verQR) { | 45 | if (this.verQR) { |
46 | this.verQR = !this.verQR; | 46 | this.verQR = !this.verQR; |
47 | return; | 47 | return; |
48 | } | 48 | } |
49 | this.location.back(); | 49 | this.location.back(); |
50 | } | 50 | } |
51 | 51 | ||
52 | getTotal() { | 52 | getTotal() { |
53 | 53 | ||
54 | var subTotal = 0; | 54 | var subTotal = 0; |
55 | this.productos.forEach(producto => { | 55 | this.productos.forEach(producto => { |
56 | 56 | ||
57 | subTotal = subTotal + (producto.PreVen * producto.cantidad); | 57 | subTotal = subTotal + (producto.PreVen * producto.cantidad); |
58 | }); | 58 | }); |
59 | return this.total = subTotal; | 59 | return this.total = subTotal; |
60 | } | 60 | } |
61 | 61 | ||
62 | reiniciarTimer() { | 62 | reiniciarTimer() { |
63 | 63 | ||
64 | clearTimeout(this.timerReposo); | 64 | clearTimeout(this.timerReposo); |
65 | this.timerReposo = setTimeout(() => { | 65 | this.timerReposo = setTimeout(() => { |
66 | 66 | ||
67 | this.router.navigate(['cancelar-compra']); | 67 | this.router.navigate(['cancelar-compra']); |
68 | }, 90000) | 68 | }, 90000) |
69 | } | 69 | } |
70 | 70 | ||
71 | //#region METODOS PARA LA FORMA DE PAGO | 71 | //#region METODOS PARA LA FORMA DE PAGO |
72 | pagoEfectivo() { | 72 | pagoEfectivo() { |
73 | 73 | ||
74 | this.compraConEfectivofinalizada = true; | 74 | this.compraConEfectivofinalizada = true; |
75 | clearTimeout(this.timerReposo); | 75 | clearTimeout(this.timerReposo); |
76 | setTimeout(() => { | 76 | setTimeout(() => { |
77 | 77 | ||
78 | this.router.navigate(['mensaje-final']); | 78 | this.router.navigate(['mensaje-final']); |
79 | }, 3000); | 79 | }, 3000); |
80 | } | 80 | } |
81 | 81 | ||
82 | pagar(medioPago: string) { | 82 | pagar(medioPago: string) { |
83 | 83 | ||
84 | if (medioPago == 'electronico') { | ||
85 | |||
86 | this.verQR = true; | ||
87 | } | ||
88 | |||
84 | this.productoService.pagar(medioPago) | 89 | this.productoService.pagar(medioPago) |
85 | .subscribe(() => { | 90 | .subscribe(() => { |
86 | 91 | ||
87 | clearTimeout(this.timerReposo); | 92 | clearTimeout(this.timerReposo); |
88 | 93 | ||
89 | if (medioPago == 'efectivo') { | 94 | if (medioPago == 'efectivo') { |
90 | 95 | ||
91 | this.compraConEfectivofinalizada = true; | 96 | this.compraConEfectivofinalizada = true; |
92 | } else if (medioPago == 'electronico') { | 97 | } else if (medioPago == 'electronico') { |
93 | 98 | ||
94 | this.compraConQRfinalizada = true; | 99 | this.compraConQRfinalizada = true; |
95 | this.verQR = true; | ||
96 | } | 100 | } |
97 | 101 | ||
98 | setTimeout(() => { | 102 | setTimeout(() => { |
99 | 103 | ||
100 | this.router.navigate(['mensaje-final']); | 104 | this.router.navigate(['mensaje-final']); |
101 | }, 3000); | 105 | }, 3000); |
102 | }, err => { | 106 | }, err => { |
103 | console.log(err); | 107 | console.log(err); |
104 | alert('algo salió mal'); | 108 | alert('algo salió mal'); |
105 | }) | 109 | }) |
106 | } | 110 | } |
107 | //#endregion | 111 | //#endregion |
108 | 112 | ||
109 | } | 113 | } |
src/app/components/inicio/inicio.component.ts
1 | import { Component, OnInit, ViewChild, HostListener, AfterViewInit } from '@angular/core'; | 1 | import { Component, OnInit, ViewChild, HostListener, AfterViewInit } from '@angular/core'; |
2 | import { PopoverDirective } from 'ngx-bootstrap'; | 2 | import { PopoverDirective } from 'ngx-bootstrap'; |
3 | import { appSettings } from 'src/etc/AppSettings'; | 3 | import { appSettings } from 'src/etc/AppSettings'; |
4 | import { Router } from '@angular/router'; | 4 | import { Router } from '@angular/router'; |
5 | import { ProductoService } from 'src/app/services/producto.service'; | 5 | import { ProductoService } from 'src/app/services/producto.service'; |
6 | import { Producto } from 'src/app/wrappers/producto'; | 6 | import { Producto } from 'src/app/wrappers/producto'; |
7 | import { Sinonimo } from 'src/app/wrappers/sinonimo'; | 7 | import { Sinonimo } from 'src/app/wrappers/sinonimo'; |
8 | 8 | ||
9 | @Component({ | 9 | @Component({ |
10 | selector: 'app-inicio', | 10 | selector: 'app-inicio', |
11 | templateUrl: './inicio.component.html', | 11 | templateUrl: './inicio.component.html', |
12 | styleUrls: ['./inicio.component.scss'] | 12 | styleUrls: ['./inicio.component.scss'] |
13 | }) | 13 | }) |
14 | export class InicioComponent implements OnInit, AfterViewInit { | 14 | export class InicioComponent implements OnInit, AfterViewInit { |
15 | 15 | ||
16 | private tienePromo = false; | 16 | private tienePromo = false; |
17 | private productoEsPromo = false; | 17 | private productoEsPromo = false; |
18 | private busqueda: string = ''; | 18 | private busqueda: string = ''; |
19 | private productoAcargar: Producto; | 19 | private productoAcargar: Producto; |
20 | private promoAcargar: Producto; | 20 | private promoAcargar: Producto; |
21 | private productos: Producto[] = []; | 21 | private productos: Producto[] = []; |
22 | private promociones: Producto[] = []; | 22 | private promociones: Producto[] = []; |
23 | private sinonimos: Sinonimo[] = []; | 23 | private sinonimos: Sinonimo[] = []; |
24 | private apiImagenes: string = appSettings.apiImagenes; | 24 | private apiImagenes: string = appSettings.apiImagenes; |
25 | 25 | ||
26 | @ViewChild('pop', { static: false }) popoverDirective: PopoverDirective; | 26 | @ViewChild('pop', { static: false }) popoverDirective: PopoverDirective; |
27 | 27 | ||
28 | @HostListener('document:keypress', ["$event"]) catchInput(e: KeyboardEvent) { | 28 | @HostListener('document:keypress', ["$event"]) catchInput(e: KeyboardEvent) { |
29 | 29 | ||
30 | if (e.keyCode == 13) { | 30 | if (e.keyCode == 13) { |
31 | this.buscarByCodigoBarras(this.busqueda); | 31 | this.buscarByCodigoBarras(this.busqueda); |
32 | this.busqueda = ''; | 32 | this.busqueda = ''; |
33 | } else { | 33 | } else { |
34 | this.busqueda += e.key; | 34 | this.busqueda += e.key; |
35 | } | 35 | } |
36 | 36 | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | constructor( | 39 | constructor( |
40 | private router: Router, | 40 | private router: Router, |
41 | private productoService: ProductoService | 41 | private productoService: ProductoService |
42 | ) { } | 42 | ) { } |
43 | 43 | ||
44 | ngOnInit() { | 44 | ngOnInit() { |
45 | 45 | ||
46 | this.productoAcargar = this.productoService.productoAcargar; | 46 | this.productoAcargar = this.productoService.productoAcargar; |
47 | this.getProductos(); | 47 | this.getProductos(); |
48 | } | 48 | } |
49 | 49 | ||
50 | ngAfterViewInit() { | 50 | ngAfterViewInit() { |
51 | 51 | ||
52 | setTimeout(() => { | 52 | setTimeout(() => { |
53 | if (!this.productoAcargar) return; | 53 | if (!this.productoAcargar) return; |
54 | 54 | ||
55 | if (this.productoAcargar.PRO) { | 55 | if (this.productoAcargar.PRO) { |
56 | this.promociones.push(this.productoAcargar); | 56 | this.promociones.push(this.productoAcargar); |
57 | this.promoSeleccionada(this.productoAcargar, true); | 57 | this.promoSeleccionada(this.productoAcargar, true); |
58 | } | 58 | } |
59 | else { | 59 | else { |
60 | this.getPromociones(); | 60 | this.getPromociones(); |
61 | } | 61 | } |
62 | }) | 62 | }) |
63 | } | 63 | } |
64 | 64 | ||
65 | getProductos() { | 65 | getProductos() { |
66 | 66 | ||
67 | this.productoService.getAll() | 67 | this.productoService.getAll() |
68 | .subscribe((productos: Producto[]) => { | 68 | .subscribe((productos: Producto[]) => { |
69 | this.productos = productos; | 69 | this.productos = productos; |
70 | }); | 70 | }); |
71 | } | 71 | } |
72 | 72 | ||
73 | getPromociones() { | 73 | getPromociones() { |
74 | 74 | ||
75 | var sector = this.productoAcargar.CodSec; | 75 | var sector = this.productoAcargar.CodSec; |
76 | var codigo = this.productoAcargar.CodArt; | 76 | var codigo = this.productoAcargar.CodArt; |
77 | this.productoService.getPromociones(sector, codigo) | 77 | this.productoService.getPromociones(sector, codigo) |
78 | .subscribe((res: Producto[]) => { | 78 | .subscribe((res: Producto[]) => { |
79 | 79 | ||
80 | if (res.length === 0) { | 80 | if (res.length === 0) { |
81 | 81 | ||
82 | this.productoAcargar.cantidad = 1; | 82 | this.productoAcargar.cantidad = 1; |
83 | this.productoService.setProductos(this.productoAcargar); | 83 | this.productoService.setProductos(this.productoAcargar); |
84 | this.productoAcargar = this.productoService.productoAcargar = undefined; | 84 | this.productoAcargar = this.productoService.productoAcargar = undefined; |
85 | } else { | 85 | } else { |
86 | 86 | ||
87 | this.promociones = res; | 87 | this.promociones = res; |
88 | this.popoverDirective.show(); | 88 | this.popoverDirective.show(); |
89 | } | 89 | } |
90 | }, error => { console.error(error); }) | 90 | }, error => { console.error(error); }) |
91 | } | 91 | } |
92 | 92 | ||
93 | confirmarProducto() { | 93 | confirmarProducto() { |
94 | 94 | ||
95 | var producto = this.promoAcargar ? this.promoAcargar : this.productoAcargar; | 95 | let producto = this.promoAcargar ? this.promoAcargar : this.productoAcargar; |
96 | |||
96 | producto.cantidad = producto.cantidad ? producto.cantidad : 1; | 97 | producto.cantidad = producto.cantidad ? producto.cantidad : 1; |
98 | |||
97 | this.productoService.setProductos(producto); | 99 | this.productoService.setProductos(producto); |
98 | this.productoService.productoAcargar = this.promoAcargar = this.productoAcargar = undefined; | 100 | this.productoService.productoAcargar = this.promoAcargar = this.productoAcargar = undefined; |
99 | this.productoService.esPromoPersonalizada = false; | 101 | this.productoService.esPromoPersonalizada = false; |
100 | this.promociones = []; | 102 | this.promociones = []; |
101 | this.popoverDirective.hide(); | 103 | this.popoverDirective.hide(); |
102 | } | 104 | } |
103 | 105 | ||
104 | promoSeleccionada($event: Producto, showPopover: boolean) { | 106 | promoSeleccionada($event: Producto, showPopover: boolean) { |
105 | 107 | ||
106 | this.productoService.getProductoById($event.id) | 108 | this.productoService.getProductoById($event.id) |
107 | .subscribe((res: Producto) => { | 109 | .subscribe((res: Producto) => { |
108 | 110 | ||
109 | $event.imagenes = res.imagenes.length == 0 ? [{ imagen: 'noImage.jpg' }] : res.imagenes; | 111 | $event.imagenes = res.imagenes.length == 0 ? [{ imagen: 'noImage.jpg' }] : res.imagenes; |
110 | this.promoAcargar = $event; | 112 | this.promoAcargar = $event; |
111 | 113 | ||
112 | if ($event.tieneSinonimos) { | 114 | if ($event.tieneSinonimos) { |
113 | this.getSinonimos(this.promoAcargar.CodSec, this.promoAcargar.CodArt); | 115 | this.getSinonimos(this.promoAcargar.CodSec, this.promoAcargar.CodArt); |
114 | } else if (showPopover) { | 116 | } else if (showPopover) { |
115 | this.popoverDirective.show(); | 117 | this.popoverDirective.show(); |
116 | } else { | 118 | } else { |
117 | this.popoverDirective.hide(); | 119 | this.popoverDirective.hide(); |
118 | } | 120 | } |
119 | 121 | ||
120 | }, | 122 | }, |
121 | error => { console.log(error); }) | 123 | error => { console.log(error); }) |
122 | } | 124 | } |
123 | 125 | ||
124 | getSinonimos(sector, codigo) { | 126 | getSinonimos(sector, codigo) { |
125 | 127 | ||
126 | this.productoService.getPromocionSinonimos(sector, codigo) | 128 | this.productoService.getPromocionSinonimos(sector, codigo) |
127 | .subscribe((res: Sinonimo[]) => { | 129 | .subscribe((res: Sinonimo[]) => { |
128 | 130 | ||
129 | res.forEach(sinonimo => { | 131 | res.forEach(sinonimo => { |
130 | 132 | ||
131 | sinonimo.cantidad = 0; | 133 | sinonimo.cantidad = 0; |
132 | this.promoAcargar.productos.forEach(productoPromo => { | 134 | this.promoAcargar.productos.forEach(productoPromo => { |
133 | 135 | ||
134 | sinonimo.productos.forEach(productoSinonimo => { | 136 | sinonimo.productos.forEach(productoSinonimo => { |
135 | 137 | ||
136 | if (productoSinonimo.id === productoPromo.id) { | 138 | if (productoSinonimo.id === productoPromo.id) { |
137 | productoSinonimo.cantidad = productoPromo.cantidad; | 139 | productoSinonimo.cantidad = productoPromo.cantidad; |
138 | sinonimo.cantidad += productoPromo.cantidad; | 140 | sinonimo.cantidad += productoPromo.cantidad; |
139 | } | 141 | } |
140 | }) | 142 | }) |
141 | }) | 143 | }) |
142 | }) | 144 | }) |
143 | this.sinonimos = res; | 145 | this.sinonimos = res; |
144 | (this.sinonimos.length > 0) ? this.popoverDirective.show() : this.popoverDirective.hide(); | 146 | (this.sinonimos.length > 0) ? this.popoverDirective.show() : this.popoverDirective.hide(); |
145 | }) | 147 | }) |
146 | } | 148 | } |
147 | 149 | ||
148 | productosPersonalizados($event: Producto[]) { | 150 | productosPersonalizados($event: Producto[]) { |
149 | 151 | ||
150 | var productosPersonalizados = $event; | 152 | let productosPersonalizados = $event; |
151 | this.promoAcargar.productos = productosPersonalizados; | 153 | |
154 | productosPersonalizados.forEach(productoElegido => { | ||
155 | |||
156 | this.promoAcargar.productos = this.promoAcargar.productos.filter(productoPromo => { | ||
157 | return productoPromo.idSinonimo != productoElegido.idSinonimo; | ||
158 | }); | ||
159 | }); | ||
160 | |||
161 | this.promoAcargar.productos = this.promoAcargar.productos.concat(productosPersonalizados); | ||
162 | |||
152 | this.confirmarProducto(); | 163 | this.confirmarProducto(); |
153 | } | 164 | } |
154 | 165 | ||
155 | buscarByCodigoBarras(busqueda) { | 166 | buscarByCodigoBarras(busqueda) { |
156 | 167 | ||
157 | let producto = this.productos.filter(producto => { | 168 | let producto = this.productos.filter(producto => { |
158 | return producto.codigoBarra == busqueda; | 169 | return producto.codigoBarra == busqueda; |
159 | }); | 170 | }); |
160 | 171 | ||
161 | if (producto.length) { | 172 | if (producto.length) { |
162 | 173 | ||
163 | this.productoAcargar = producto[0]; | 174 | this.productoAcargar = producto[0]; |
164 | this.getPromociones(); | 175 | this.getPromociones(); |
165 | 176 | ||
166 | } else { | 177 | } else { |
167 | alert('No se encuentra el producto'); | 178 | alert('No se encuentra el producto'); |
168 | } | 179 | } |
169 | 180 | ||
170 | } | 181 | } |
171 | 182 | ||
172 | irBusquedaProductos(value) { | 183 | irBusquedaProductos(value) { |
173 | 184 | ||
174 | this.productoService.mostrar = value; | 185 | this.productoService.mostrar = value; |
175 | this.router.navigate(['busqueda-productos']); | 186 | this.router.navigate(['busqueda-productos']); |
176 | } | 187 | } |
177 | 188 | ||
178 | deshacerCarga() { | 189 | deshacerCarga() { |
179 | 190 | ||
180 | if (this.sinonimos.length > 0) { | 191 | if (this.sinonimos.length > 0) { |
181 | this.sinonimos = []; | 192 | this.sinonimos = []; |
182 | this.productoService.esPromoPersonalizada = false; | 193 | this.productoService.esPromoPersonalizada = false; |
183 | this.popoverDirective.hide(); | 194 | this.popoverDirective.hide(); |
184 | } | 195 | } |
185 | 196 | ||
186 | if (this.promoAcargar) { | 197 | if (this.promoAcargar) { |
187 | this.promoAcargar = undefined; | 198 | this.promoAcargar = undefined; |
188 | if (this.productoAcargar.PRO) { | 199 | if (this.productoAcargar.PRO) { |
189 | this.productoAcargar = undefined; | 200 | this.productoAcargar = undefined; |
190 | this.promociones = []; | 201 | this.promociones = []; |
191 | this.popoverDirective.hide(); | 202 | this.popoverDirective.hide(); |
192 | } else { | 203 | } else { |
193 | this.popoverDirective.show(); | 204 | this.popoverDirective.show(); |
194 | } | 205 | } |
195 | } else { | 206 | } else { |
196 | this.productoAcargar = undefined; | 207 | this.productoAcargar = undefined; |
197 | this.promociones = []; | 208 | this.promociones = []; |
198 | this.popoverDirective.hide(); | 209 | this.popoverDirective.hide(); |
199 | } | 210 | } |
200 | } | 211 | } |
201 | 212 | ||
202 | } | 213 | } |
203 | 214 |