From 781c8e8aa43e603c70dbf86568ad5eb666be43dc Mon Sep 17 00:00:00 2001 From: Eric Fernandez Date: Tue, 25 Jun 2019 16:51:21 -0300 Subject: [PATCH] =?UTF-8?q?nuevo=20enfoque,=20quito=20paginaci=C3=B3n,=20f?= =?UTF-8?q?ix=20guardar,=20modales=20abiertos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app-routing.module.ts | 14 ++- src/app/comprobantes/comprobantes.component.html | 148 +++++++++++------------ src/app/comprobantes/comprobantes.component.scss | 9 +- src/app/comprobantes/comprobantes.component.ts | 50 ++++---- src/etc/AppSetings.ts | 2 +- 5 files changed, 116 insertions(+), 107 deletions(-) diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 2387f2c..77dec73 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,8 +1,9 @@ import { NgModule } from '@angular/core'; -import { Routes, RouterModule } from '@angular/router'; +import { Routes, RouterModule, Router, NavigationEnd} from '@angular/router'; import { ComprobantesComponent } from './comprobantes/comprobantes.component'; import { AppBotonera } from './botonera/botonera.component'; import { LoginComponent } from './login/login.component'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; const routes: Routes = [ { path: 'comprobantes', component: ComprobantesComponent, pathMatch: 'full' }, @@ -15,4 +16,13 @@ const routes: Routes = [ imports: [RouterModule.forRoot(routes)], exports: [RouterModule] }) -export class AppRoutingModule { } +export class AppRoutingModule { + + constructor(private router: Router, private modalService: NgbModal) { + + router.events.subscribe(() => { + modalService.dismissAll(); + }) + } + +} diff --git a/src/app/comprobantes/comprobantes.component.html b/src/app/comprobantes/comprobantes.component.html index a038a4f..4cf28e1 100644 --- a/src/app/comprobantes/comprobantes.component.html +++ b/src/app/comprobantes/comprobantes.component.html @@ -1,35 +1,28 @@
-
+
Recepción -
Fecha: -  {{ fecha | date: 'dd/MM/yyyy' }} +  {{ fecha | date: 'dd/MM/yyyy' }}
Hora: -  {{ fecha | date: 'shortTime'}} +  {{ fecha | date: 'shortTime'}}
-
+
Letra Factura:  @@ -55,82 +48,77 @@
-
-
-
-
- +
+
+ +
+
+ +
-
- -
-
-
- +
+
- - + - - - - - - + + + - - - - - - + (focus)="$event.target.select();" + (keyup.enter)="articulo.input = false; articulo.recibido = articulo.tempRecibido" + [(ngModel)]="articulo.tempRecibido" + [ngModelOptions]="{standalone: true}" autofocus/> + /{{articulo.CAN}} + + + + + + + + +
Rechazar Producto CantidadAceptar
{{articulo.TIO}} - {{articulo.recibido ? articulo.recibido + '/' : ''}}{{articulo.CAN}} - +
{{articulo.TIO.trim() || articulo.LI0}} + {{articulo.recibido ? articulo.recibido + '/' : ''}}{{articulo.CAN}} + + - /{{articulo.CAN}} - - - -
Por el momento no hay elementos aquí
+ + + +
Por el momento no hay elementos aquí
-
+
\ No newline at end of file diff --git a/src/app/comprobantes/comprobantes.component.scss b/src/app/comprobantes/comprobantes.component.scss index 18fdfee..06c60d3 100644 --- a/src/app/comprobantes/comprobantes.component.scss +++ b/src/app/comprobantes/comprobantes.component.scss @@ -53,4 +53,11 @@ border-top: 2px solid #FFF !important; } } -} \ No newline at end of file +} + +.scroll-tabla { + position: absolute; + max-height: 200%; + overflow: auto; + background-color: #343a40; +} diff --git a/src/app/comprobantes/comprobantes.component.ts b/src/app/comprobantes/comprobantes.component.ts index 84baed0..63799a0 100644 --- a/src/app/comprobantes/comprobantes.component.ts +++ b/src/app/comprobantes/comprobantes.component.ts @@ -19,37 +19,32 @@ export class ComprobantesComponent implements OnInit { ngOnInit() { } filter = ''; - estadoArticulos = 'pendiente'; - comprobantes = [1, 2, 3]; + estadoArticulos : string; + tempRecibido = []; cabecera = {}; cuerpo = []; articulosFiltro = []; - paginaActiva = 1; - paginas = []; saveLoading = false; + showCabecera = true; fecha = new Date(); - paginar() { - - var cantPaginas = Math.ceil(this.articulosFiltro.length / 5); - this.paginas = []; - for (let i = 0; i < cantPaginas; i++) { - this.paginas.push(i + 1); - } - } - getPaginaFiltro() { this.articulosFiltro = this.cuerpo.filter((articulo) => { - return articulo.estado == this.estadoArticulos && - (articulo.TIO.toLocaleUpperCase().includes(this.filter.toLocaleUpperCase()) || - articulo.codigoBarras == this.filter); - }); - this.paginar(); + var tio = articulo.TIO.trim().toLocaleUpperCase().includes(this.filter.toLocaleUpperCase()); + var lio = articulo.LI0.trim().toLocaleUpperCase().includes(this.filter.toLocaleUpperCase()); + var codigoBarras = articulo.codigoBarras == this.filter; + + articulo.recibido && !articulo.estado ? articulo.estado = 'modificado' : false; + + var estado = articulo.estado == this.estadoArticulos; + + return (tio || lio || codigoBarras) && estado; + }); - return this.articulosFiltro.slice((this.paginaActiva - 1) * 5 , this.paginaActiva * 5); + return this.articulosFiltro; } getCantidadArticulosByEstado(estado: String) { @@ -62,15 +57,28 @@ export class ComprobantesComponent implements OnInit { if (this.getCantidadArticulosByEstado('pendiente')) { alert('No deben quedar articulos pendientes'); + return; } + if (!this.cuerpo.length) { + alert('Debe seleccionar un comprobante'); + return; + } + + this.saveLoading = true; + this.comprobanteService .saveComprobantes({cabecera: this.cabecera, cuerpo: this.cuerpo}) .subscribe(data => { + alert('Comprobante guardado con éxito'); + this.saveLoading = false; this.router.navigateByUrl('/home'); + }, err => { + alert('Algo salió mal'); + this.saveLoading = false; console.log(err); }); } @@ -81,10 +89,6 @@ export class ComprobantesComponent implements OnInit { this.cabecera = comprobante.cabecera; this.cuerpo = comprobante.cuerpo; - this.cuerpo.forEach(articulo => { - articulo['estado'] = 'pendiente'; - }); - this.getPaginaFiltro(); }, (reason) => { }); } diff --git a/src/etc/AppSetings.ts b/src/etc/AppSetings.ts index 5366258..4be5f56 100644 --- a/src/etc/AppSetings.ts +++ b/src/etc/AppSetings.ts @@ -1,3 +1,3 @@ export class AppSetings { - public static END_POINT='http://10.231.45.234:6060/gateway-debo'; + public static END_POINT='http://localhost:6060/gateway-debo'; } -- 1.9.1