Commit fd60509b5dc274e4d6b29298e5a2afaad0248bb5
1 parent
f1d2da7f17
Exists in
master
paginación comprobantes
Showing
3 changed files
with
23 additions
and
74 deletions
Show diff stats
src/app/app.module.ts
src/app/comprobantes/comprobantes.component.html
| ... | ... | @@ -6,8 +6,7 @@ |
| 6 | 6 | <button |
| 7 | 7 | class="btn btn-xs btn-outline-light float-right" |
| 8 | 8 | type="button" |
| 9 | - ng-click="$ctrl.busqueda()" | |
| 10 | - ng-if="$ctrl.busqueda" | |
| 9 | + (click)="busquedaComprobantes()" | |
| 11 | 10 | title="Buscar" |
| 12 | 11 | > |
| 13 | 12 | <i class="fa fa-search"></i> |
| ... | ... | @@ -51,12 +50,12 @@ |
| 51 | 50 | <strong>Cuit: </strong> |
| 52 | 51 | <label>{{cabecera.CUI}}</label> |
| 53 | 52 | </div> |
| 54 | - <div class="col-12 col-sm-3 d-flex"> | |
| 53 | + <div class="col-12 col-sm-6 d-flex"> | |
| 55 | 54 | <strong>Nombre: </strong> |
| 56 | 55 | <label>{{cabecera.NOM}}</label> |
| 57 | 56 | </div> |
| 58 | 57 | </div> |
| 59 | - <div class="row border"> | |
| 58 | + <div class="row border pr-2"> | |
| 60 | 59 | <div class="col-4"> |
| 61 | 60 | <button |
| 62 | 61 | type="button" |
| ... | ... | @@ -108,7 +107,7 @@ |
| 108 | 107 | <th *ngIf="estadoArticulos != 'rechazado'"><button type="button" class="" (click)="articulo.estado = 'rechazado'"> |
| 109 | 108 | <i class="fa fa-window-close"></i> |
| 110 | 109 | </button></th> |
| 111 | - <th>{{articulo.LI0}}</th> | |
| 110 | + <th>{{articulo.TIO}}</th> | |
| 112 | 111 | <th *ngIf="!articulo.input" (click)="articulo.input = true"> |
| 113 | 112 | {{articulo.recibido ? articulo.recibido + '/' : ''}}{{articulo.CAN}}</th> |
| 114 | 113 | <th *ngIf="articulo.input"> |
src/app/comprobantes/comprobantes.component.ts
| 1 | 1 | import { Component, OnInit} from '@angular/core'; |
| 2 | +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; | |
| 3 | +import { BusquedaComprobanteComponent } from '../busqueda-comprobante/busqueda-comprobante.component'; | |
| 2 | 4 | |
| 3 | 5 | @Component({ |
| 4 | 6 | templateUrl: './comprobantes.component.html', |
| ... | ... | @@ -6,12 +8,9 @@ import { Component, OnInit} from '@angular/core'; |
| 6 | 8 | }) |
| 7 | 9 | export class ComprobantesComponent implements OnInit { |
| 8 | 10 | |
| 9 | - constructor() { } | |
| 11 | + constructor(private modalService: NgbModal) { } | |
| 10 | 12 | |
| 11 | - ngOnInit() { | |
| 12 | - | |
| 13 | - this.obtenerConsulta(); | |
| 14 | - } | |
| 13 | + ngOnInit() { } | |
| 15 | 14 | |
| 16 | 15 | filter = ''; |
| 17 | 16 | estadoArticulos = 'pendiente'; |
| ... | ... | @@ -21,7 +20,7 @@ export class ComprobantesComponent implements OnInit { |
| 21 | 20 | articulosFiltro = []; |
| 22 | 21 | paginaActiva = 1; |
| 23 | 22 | paginas = []; |
| 24 | - | |
| 23 | + | |
| 25 | 24 | fecha = new Date(); |
| 26 | 25 | |
| 27 | 26 | paginar() { |
| ... | ... | @@ -37,7 +36,7 @@ export class ComprobantesComponent implements OnInit { |
| 37 | 36 | |
| 38 | 37 | this.articulosFiltro = this.cuerpo.filter((articulo) => { |
| 39 | 38 | return articulo.estado == this.estadoArticulos && |
| 40 | - (articulo.LI0.toLocaleUpperCase().includes(this.filter.toLocaleUpperCase()) || | |
| 39 | + (articulo.TIO.toLocaleUpperCase().includes(this.filter.toLocaleUpperCase()) || | |
| 41 | 40 | articulo.codigoBarras == this.filter); |
| 42 | 41 | }); |
| 43 | 42 | |
| ... | ... | @@ -56,68 +55,18 @@ export class ComprobantesComponent implements OnInit { |
| 56 | 55 | alert('Guardando'); |
| 57 | 56 | } |
| 58 | 57 | |
| 59 | - obtenerConsulta() { | |
| 60 | - | |
| 61 | - setTimeout(() => { | |
| 62 | - this.cabecera = { | |
| 63 | - TIP: 'A', | |
| 64 | - TCO: 'FT', | |
| 65 | - SUC: 623, | |
| 66 | - NCO: 53979, | |
| 67 | - COD: 1, | |
| 68 | - FEC: new Date(), | |
| 69 | - NOM: 'POTIGIAN GOLOCINAS', | |
| 70 | - CUI: '30-54775125-2' | |
| 71 | - }; | |
| 72 | - | |
| 73 | - this.cuerpo = [ | |
| 74 | - { | |
| 75 | - LI0: 'Mantel Combo Bolso CocaCola', | |
| 76 | - CAN: 5, | |
| 77 | - estado: 'pendiente', | |
| 78 | - codigoBarras: '7790667006462' | |
| 79 | - }, | |
| 80 | - { | |
| 81 | - LI0: 'Papas', | |
| 82 | - CAN: 5, | |
| 83 | - estado: 'pendiente', | |
| 84 | - }, | |
| 85 | - { | |
| 86 | - LI0: 'Peras', | |
| 87 | - CAN: 5, | |
| 88 | - estado: 'pendiente', | |
| 89 | - }, | |
| 90 | - { | |
| 91 | - LI0: 'Cafe', | |
| 92 | - CAN: 5, | |
| 93 | - estado: 'pendiente', | |
| 94 | - }, | |
| 95 | - { | |
| 96 | - LI0: 'Cafe capuchino', | |
| 97 | - CAN: 5, | |
| 98 | - estado: 'pendiente', | |
| 99 | - }, | |
| 100 | - { | |
| 101 | - LI0: 'Menta', | |
| 102 | - CAN: 5, | |
| 103 | - estado: 'pendiente', | |
| 104 | - }, | |
| 105 | - { | |
| 106 | - LI0: 'Fernet', | |
| 107 | - CAN: 5, | |
| 108 | - estado: 'pendiente', | |
| 109 | - }, | |
| 110 | - { | |
| 111 | - LI0: 'Andes', | |
| 112 | - CAN: 5, | |
| 113 | - estado: 'pendiente', | |
| 114 | - } | |
| 115 | - ]; | |
| 116 | - | |
| 117 | - this.articulosFiltro = this.cuerpo; | |
| 118 | - | |
| 119 | - this.paginar(); | |
| 120 | - }, 500); | |
| 58 | + busquedaComprobantes() { | |
| 59 | + this.modalService.open(BusquedaComprobanteComponent).result.then(comprobante => { | |
| 60 | + | |
| 61 | + this.cabecera = comprobante.cabecera; | |
| 62 | + this.cuerpo = comprobante.cuerpo; | |
| 63 | + | |
| 64 | + this.cuerpo.forEach(articulo => { | |
| 65 | + articulo['estado'] = 'pendiente'; | |
| 66 | + }); | |
| 67 | + | |
| 68 | + this.getPaginaFiltro(); | |
| 69 | + }, (reason) => { }); | |
| 121 | 70 | } |
| 122 | 71 | |
| 123 | 72 | } |