Commit ec3cacdb87fb2ddcb4ec78f091520290f700bd59
1 parent
ab1def30d4
Exists in
master
and in
1 other branch
función innecesaria
Showing
1 changed file
with
0 additions
and
8 deletions
 
Show diff stats
src/app/comprobantes/comprobantes.component.ts
| 1 | import { Component, OnInit} from '@angular/core'; | 1 | import { Component, OnInit} from '@angular/core'; | 
| 2 | 2 | ||
| 3 | @Component({ | 3 | @Component({ | 
| 4 | templateUrl: './comprobantes.component.html', | 4 | templateUrl: './comprobantes.component.html', | 
| 5 | styleUrls: ['./comprobantes.component.scss'] | 5 | styleUrls: ['./comprobantes.component.scss'] | 
| 6 | }) | 6 | }) | 
| 7 | export class ComprobantesComponent implements OnInit { | 7 | export class ComprobantesComponent implements OnInit { | 
| 8 | 8 | ||
| 9 | constructor() { } | 9 | constructor() { } | 
| 10 | 10 | ||
| 11 | ngOnInit() { | 11 | ngOnInit() { | 
| 12 | 12 | ||
| 13 | this.obtenerConsulta(); | 13 | this.obtenerConsulta(); | 
| 14 | } | 14 | } | 
| 15 | 15 | ||
| 16 | filter = ''; | 16 | filter = ''; | 
| 17 | estadoArticulos = 'pendiente'; | 17 | estadoArticulos = 'pendiente'; | 
| 18 | comprobantes = [1, 2, 3]; | 18 | comprobantes = [1, 2, 3]; | 
| 19 | cabecera = {}; | 19 | cabecera = {}; | 
| 20 | cuerpo = []; | 20 | cuerpo = []; | 
| 21 | articulosFiltro = []; | 21 | articulosFiltro = []; | 
| 22 | paginaActiva = 1; | 22 | paginaActiva = 1; | 
| 23 | paginas = []; | 23 | paginas = []; | 
| 24 | 24 | ||
| 25 | fecha = new Date(); | 25 | fecha = new Date(); | 
| 26 | 26 | ||
| 27 | filtrar(event: any) { | ||
| 28 | this.articulosFiltro = this.cuerpo.filter((param)=> { | ||
| 29 | return | ||
| 30 | }); | ||
| 31 | |||
| 32 | this.paginar(); | ||
| 33 | } | ||
| 34 | |||
| 35 | paginar() { | 27 | paginar() { | 
| 36 | 28 | ||
| 37 | var cantPaginas = Math.ceil(this.articulosFiltro.length / 5); | 29 | var cantPaginas = Math.ceil(this.articulosFiltro.length / 5); | 
| 38 | this.paginas = []; | 30 | this.paginas = []; | 
| 39 | for (let i = 0; i < cantPaginas; i++) { | 31 | for (let i = 0; i < cantPaginas; i++) { | 
| 40 | this.paginas.push(i + 1); | 32 | this.paginas.push(i + 1); | 
| 41 | } | 33 | } | 
| 42 | } | 34 | } | 
| 43 | 35 | ||
| 44 | getPaginaFiltro() { | 36 | getPaginaFiltro() { | 
| 45 | 37 | ||
| 46 | this.articulosFiltro = this.cuerpo.filter((articulo) => { | 38 | this.articulosFiltro = this.cuerpo.filter((articulo) => { | 
| 47 | return articulo.estado == this.estadoArticulos && | 39 | return articulo.estado == this.estadoArticulos && | 
| 48 | (articulo.LI0.toLocaleUpperCase().includes(this.filter.toLocaleUpperCase()) || | 40 | (articulo.LI0.toLocaleUpperCase().includes(this.filter.toLocaleUpperCase()) || | 
| 49 | articulo.codigoBarras == this.filter); | 41 | articulo.codigoBarras == this.filter); | 
| 50 | }); | 42 | }); | 
| 51 | 43 | ||
| 52 | this.paginar(); | 44 | this.paginar(); | 
| 53 | 45 | ||
| 54 | return this.articulosFiltro.slice((this.paginaActiva - 1) * 5 , this.paginaActiva * 5); | 46 | return this.articulosFiltro.slice((this.paginaActiva - 1) * 5 , this.paginaActiva * 5); | 
| 55 | } | 47 | } | 
| 56 | 48 | ||
| 57 | getCantidadArticulosByEstado(estado: String) { | 49 | getCantidadArticulosByEstado(estado: String) { | 
| 58 | return this.cuerpo.filter((articulo) => { | 50 | return this.cuerpo.filter((articulo) => { | 
| 59 | return articulo.estado == estado; | 51 | return articulo.estado == estado; | 
| 60 | }).length; | 52 | }).length; | 
| 61 | } | 53 | } | 
| 62 | 54 | ||
| 63 | obtenerConsulta() { | 55 | obtenerConsulta() { | 
| 64 | 56 | ||
| 65 | setTimeout(() => { | 57 | setTimeout(() => { | 
| 66 | this.cabecera = { | 58 | this.cabecera = { | 
| 67 | TIP: 'A', | 59 | TIP: 'A', | 
| 68 | TCO: 'FT', | 60 | TCO: 'FT', | 
| 69 | SUC: 623, | 61 | SUC: 623, | 
| 70 | NCO: 53979, | 62 | NCO: 53979, | 
| 71 | COD: 1, | 63 | COD: 1, | 
| 72 | FEC: new Date(), | 64 | FEC: new Date(), | 
| 73 | NOM: 'POTIGIAN GOLOCINAS', | 65 | NOM: 'POTIGIAN GOLOCINAS', | 
| 74 | CUI: '30-54775125-2' | 66 | CUI: '30-54775125-2' | 
| 75 | }; | 67 | }; | 
| 76 | 68 | ||
| 77 | this.cuerpo = [ | 69 | this.cuerpo = [ | 
| 78 | { | 70 | { | 
| 79 | LI0: 'Mantel Combo Bolso CocaCola', | 71 | LI0: 'Mantel Combo Bolso CocaCola', | 
| 80 | CAN: 5, | 72 | CAN: 5, | 
| 81 | estado: 'pendiente', | 73 | estado: 'pendiente', | 
| 82 | codigoBarras: '7790667006462' | 74 | codigoBarras: '7790667006462' | 
| 83 | }, | 75 | }, | 
| 84 | { | 76 | { | 
| 85 | LI0: 'Papas', | 77 | LI0: 'Papas', | 
| 86 | CAN: 5, | 78 | CAN: 5, | 
| 87 | estado: 'pendiente', | 79 | estado: 'pendiente', | 
| 88 | }, | 80 | }, | 
| 89 | { | 81 | { | 
| 90 | LI0: 'Peras', | 82 | LI0: 'Peras', | 
| 91 | CAN: 5, | 83 | CAN: 5, | 
| 92 | estado: 'pendiente', | 84 | estado: 'pendiente', | 
| 93 | }, | 85 | }, | 
| 94 | { | 86 | { | 
| 95 | LI0: 'Cafe', | 87 | LI0: 'Cafe', | 
| 96 | CAN: 5, | 88 | CAN: 5, | 
| 97 | estado: 'pendiente', | 89 | estado: 'pendiente', | 
| 98 | }, | 90 | }, | 
| 99 | { | 91 | { | 
| 100 | LI0: 'Cafe capuchino', | 92 | LI0: 'Cafe capuchino', | 
| 101 | CAN: 5, | 93 | CAN: 5, | 
| 102 | estado: 'pendiente', | 94 | estado: 'pendiente', | 
| 103 | }, | 95 | }, | 
| 104 | { | 96 | { | 
| 105 | LI0: 'Menta', | 97 | LI0: 'Menta', | 
| 106 | CAN: 5, | 98 | CAN: 5, | 
| 107 | estado: 'pendiente', | 99 | estado: 'pendiente', | 
| 108 | }, | 100 | }, | 
| 109 | { | 101 | { | 
| 110 | LI0: 'Fernet', | 102 | LI0: 'Fernet', | 
| 111 | CAN: 5, | 103 | CAN: 5, | 
| 112 | estado: 'pendiente', | 104 | estado: 'pendiente', | 
| 113 | }, | 105 | }, | 
| 114 | { | 106 | { | 
| 115 | LI0: 'Andes', | 107 | LI0: 'Andes', | 
| 116 | CAN: 5, | 108 | CAN: 5, | 
| 117 | estado: 'pendiente', | 109 | estado: 'pendiente', | 
| 118 | } | 110 | } | 
| 119 | ]; | 111 | ]; | 
| 120 | 112 | ||
| 121 | this.articulosFiltro = this.cuerpo; | 113 | this.articulosFiltro = this.cuerpo; | 
| 122 | 114 | ||
| 123 | this.paginar(); | 115 | this.paginar(); | 
| 124 | }, 500); | 116 | }, 500); | 
| 125 | } | 117 | } | 
| 126 | 118 | ||
| 127 | } | 119 | } | 
| 128 | 120 |