Commit 041b572f22c094f2eea393837db5d4d380d7afcd
1 parent
b034142316
Exists in
master
and in
1 other branch
se agrega validar pve si está seteado, sino oculta el componente inicio
Showing
3 changed files
with
15 additions
and
1 deletions
Show diff stats
src/app/components/configuracion/configuracion.component.ts
| ... | ... | @@ -5,6 +5,7 @@ import { PuntoVenta } from 'src/app/wrappers/puntoVenta'; |
| 5 | 5 | import { ImpresoraService } from 'src/app/services/impresora.service'; |
| 6 | 6 | import { Impresora } from 'src/app/wrappers/impresora'; |
| 7 | 7 | import { FormGroup, FormControl } from '@angular/forms'; |
| 8 | +import { Router } from '@angular/router'; | |
| 8 | 9 | |
| 9 | 10 | @Component({ |
| 10 | 11 | selector: 'app-configuracion', |
| ... | ... | @@ -16,11 +17,13 @@ export class ConfiguracionComponent implements OnInit { |
| 16 | 17 | puntosVenta: PuntoVenta[] = []; |
| 17 | 18 | impresoras: Impresora[] = []; |
| 18 | 19 | form: FormGroup; |
| 20 | + reiniciar: boolean = false; | |
| 19 | 21 | |
| 20 | 22 | constructor( |
| 21 | 23 | private activeModal: BsModalRef, |
| 22 | 24 | private puntoVentaService: PuntoVentaService, |
| 23 | 25 | private impresoraService: ImpresoraService, |
| 26 | + private router: Router | |
| 24 | 27 | ) { } |
| 25 | 28 | |
| 26 | 29 | ngOnInit() { |
| ... | ... | @@ -50,9 +53,13 @@ export class ConfiguracionComponent implements OnInit { |
| 50 | 53 | close() { |
| 51 | 54 | |
| 52 | 55 | this.activeModal.hide(); |
| 56 | + if (this.reiniciar) { | |
| 57 | + this.router.navigate(['inicio']); | |
| 58 | + } | |
| 53 | 59 | } |
| 54 | 60 | |
| 55 | 61 | acept() { |
| 62 | + this.reiniciar = !localStorage.getItem('impresoraPVE') ? true : false; | |
| 56 | 63 | |
| 57 | 64 | let auxPuntoVenta = this.puntosVenta.find(p => p.ID === this.form.get('puntoVenta').value); |
| 58 | 65 | let auxImpresora = this.impresoras.find(p => p.PVE === this.form.get('impresora').value); |
src/app/components/inicio/inicio.component.html
| 1 | -<div class="row m-0 fade-in"> | |
| 1 | +<div class="row m-0 fade-in" [hidden]="!mostrarPantalla"> | |
| 2 | 2 | <div class="col-12 p-0"> |
| 3 | 3 | |
| 4 | 4 | <!-- NOMBRE DE SECCION --> |
| ... | ... | @@ -209,3 +209,7 @@ |
| 209 | 209 | |
| 210 | 210 | </div> |
| 211 | 211 | </div> |
| 212 | + | |
| 213 | +<div class="row m-0 fade-in" [hidden]="mostrarPantalla"> | |
| 214 | + <p class="w-100 text-center">No esá configurado el punto de venta</p> | |
| 215 | +</div> | |
| 212 | 216 | \ No newline at end of file |
src/app/components/inicio/inicio.component.ts
| ... | ... | @@ -22,6 +22,7 @@ export class InicioComponent implements OnInit, AfterViewInit { |
| 22 | 22 | private promociones: Producto[] = []; |
| 23 | 23 | private sinonimos: Sinonimo[] = []; |
| 24 | 24 | private apiImagenes: string = APP_SETTINGS.apiImagenes; |
| 25 | + private mostrarPantalla : boolean = false; | |
| 25 | 26 | |
| 26 | 27 | @ViewChild('pop', { static: false }) popoverDirective: PopoverDirective; |
| 27 | 28 | |
| ... | ... | @@ -42,8 +43,10 @@ export class InicioComponent implements OnInit, AfterViewInit { |
| 42 | 43 | |
| 43 | 44 | ngOnInit() { |
| 44 | 45 | |
| 46 | + localStorage.removeItem('pve') | |
| 45 | 47 | this.productoAcargar = this.productoService.productoAcargar; |
| 46 | 48 | this.getProductos(); |
| 49 | + this.mostrarPantalla = localStorage.getItem('impresoraPVE') ? true : false; | |
| 47 | 50 | } |
| 48 | 51 | |
| 49 | 52 | ngAfterViewInit() { |