From 041b572f22c094f2eea393837db5d4d380d7afcd Mon Sep 17 00:00:00 2001 From: Mauricio Cattafi Date: Thu, 17 Oct 2019 17:44:20 -0300 Subject: [PATCH] =?UTF-8?q?se=20agrega=20validar=20pve=20si=20est=C3=A1=20?= =?UTF-8?q?seteado,=20sino=20oculta=20el=20componente=20inicio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/components/configuracion/configuracion.component.ts | 7 +++++++ src/app/components/inicio/inicio.component.html | 6 +++++- src/app/components/inicio/inicio.component.ts | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/app/components/configuracion/configuracion.component.ts b/src/app/components/configuracion/configuracion.component.ts index 39ee282..4727147 100644 --- a/src/app/components/configuracion/configuracion.component.ts +++ b/src/app/components/configuracion/configuracion.component.ts @@ -5,6 +5,7 @@ import { PuntoVenta } from 'src/app/wrappers/puntoVenta'; import { ImpresoraService } from 'src/app/services/impresora.service'; import { Impresora } from 'src/app/wrappers/impresora'; import { FormGroup, FormControl } from '@angular/forms'; +import { Router } from '@angular/router'; @Component({ selector: 'app-configuracion', @@ -16,11 +17,13 @@ export class ConfiguracionComponent implements OnInit { puntosVenta: PuntoVenta[] = []; impresoras: Impresora[] = []; form: FormGroup; + reiniciar: boolean = false; constructor( private activeModal: BsModalRef, private puntoVentaService: PuntoVentaService, private impresoraService: ImpresoraService, + private router: Router ) { } ngOnInit() { @@ -50,9 +53,13 @@ export class ConfiguracionComponent implements OnInit { close() { this.activeModal.hide(); + if (this.reiniciar) { + this.router.navigate(['inicio']); + } } acept() { + this.reiniciar = !localStorage.getItem('impresoraPVE') ? true : false; let auxPuntoVenta = this.puntosVenta.find(p => p.ID === this.form.get('puntoVenta').value); let auxImpresora = this.impresoras.find(p => p.PVE === this.form.get('impresora').value); diff --git a/src/app/components/inicio/inicio.component.html b/src/app/components/inicio/inicio.component.html index b92d7ac..a3a449f 100644 --- a/src/app/components/inicio/inicio.component.html +++ b/src/app/components/inicio/inicio.component.html @@ -1,4 +1,4 @@ -
+
@@ -209,3 +209,7 @@
+ +
+

No esá configurado el punto de venta

+
\ No newline at end of file diff --git a/src/app/components/inicio/inicio.component.ts b/src/app/components/inicio/inicio.component.ts index 1c89467..f61f22d 100644 --- a/src/app/components/inicio/inicio.component.ts +++ b/src/app/components/inicio/inicio.component.ts @@ -22,6 +22,7 @@ export class InicioComponent implements OnInit, AfterViewInit { private promociones: Producto[] = []; private sinonimos: Sinonimo[] = []; private apiImagenes: string = APP_SETTINGS.apiImagenes; + private mostrarPantalla : boolean = false; @ViewChild('pop', { static: false }) popoverDirective: PopoverDirective; @@ -42,8 +43,10 @@ export class InicioComponent implements OnInit, AfterViewInit { ngOnInit() { + localStorage.removeItem('pve') this.productoAcargar = this.productoService.productoAcargar; this.getProductos(); + this.mostrarPantalla = localStorage.getItem('impresoraPVE') ? true : false; } ngAfterViewInit() { -- 1.9.1