From 2cf61e38e642da4d99a38996e60caa81868a7a9b Mon Sep 17 00:00:00 2001 From: Eric Fernandez Date: Tue, 3 Sep 2019 12:08:20 -0300 Subject: [PATCH] =?UTF-8?q?busqueda=20de=20art=C3=ADculos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../abm-imagenes/abm-imagenes.component.html | 16 ++++++----- .../abm-imagenes/abm-imagenes.component.scss | 5 ++-- .../abm-imagenes/abm-imagenes.component.ts | 31 ++++++++++++++-------- src/app/services/imagenes.service.ts | 7 +++-- 4 files changed, 38 insertions(+), 21 deletions(-) diff --git a/src/app/components/abm-imagenes/abm-imagenes.component.html b/src/app/components/abm-imagenes/abm-imagenes.component.html index c16ac02..fb322d2 100644 --- a/src/app/components/abm-imagenes/abm-imagenes.component.html +++ b/src/app/components/abm-imagenes/abm-imagenes.component.html @@ -6,19 +6,23 @@

Configuración de imágenes

- + - +
Productos
@@ -30,7 +34,7 @@ - +

{{articulo.DET_LAR}}

Descripción: {{articulo.DET_LAR}}

@@ -88,7 +92,7 @@ [rotate]="false" [(ngModel)]="paginationData.page" [totalItems]="paginationData.rowCount" - [maxSize]="paginationData.pageCount" + [maxSize]="10" [itemsPerPage]="paginationData.pageSize" (pageChanged)="pageChanged($event)" [boundaryLinks]="true" diff --git a/src/app/components/abm-imagenes/abm-imagenes.component.scss b/src/app/components/abm-imagenes/abm-imagenes.component.scss index 12762a1..f56a3a1 100644 --- a/src/app/components/abm-imagenes/abm-imagenes.component.scss +++ b/src/app/components/abm-imagenes/abm-imagenes.component.scss @@ -3,9 +3,10 @@ z-index: 2; display: block; text-align: center; - pointer-events: none; - color: #aaa; line-height: inherit; + &:hover{ + cursor: pointer; + } } .custom-file-input:lang(es) ~ .custom-file-label::after { diff --git a/src/app/components/abm-imagenes/abm-imagenes.component.ts b/src/app/components/abm-imagenes/abm-imagenes.component.ts index 7f3629a..21fe5df 100644 --- a/src/app/components/abm-imagenes/abm-imagenes.component.ts +++ b/src/app/components/abm-imagenes/abm-imagenes.component.ts @@ -18,18 +18,27 @@ export class AbmImagenesComponent implements OnInit { private searchTerm: string = ''; private paginationData: any; private disabledPaginador: boolean = false; + private buscando: boolean = false; constructor(private imagenService: ImagenesService, private http: HttpClient) { } ngOnInit() { - this.imagenService.getAllWithPaginator() + this.search(); + } + + search() { + + this.buscando = true; + + this.imagenService.getAllWithPaginator(this.searchTerm) .subscribe((res) => { this.articulos = res.data; this.paginationData = res.pagination; - this.filterItems(); + this.buscando = false; }, error => console.error(error)); + } onFileSelected(event, articulo: Producto) { @@ -60,14 +69,14 @@ export class AbmImagenesComponent implements OnInit { }) } - filterItems() { + // filterItems() { - this.auxProductos = this.articulos.filter(x => { - return x.DET_LAR.toLowerCase().includes(this.searchTerm.toLowerCase()) || - x.CodArt.toString().includes(this.searchTerm.toLowerCase()) || - x.CodSec.toString().includes(this.searchTerm.toLowerCase()); - }); - } + // this.auxProductos = this.articulos.filter(x => { + // return x.DET_LAR.toLowerCase().includes(this.searchTerm.toLowerCase()) || + // x.CodArt.toString().includes(this.searchTerm.toLowerCase()) || + // x.CodSec.toString().includes(this.searchTerm.toLowerCase()); + // }); + // } saveInBase(imagenAguardar) { @@ -112,12 +121,12 @@ export class AbmImagenesComponent implements OnInit { pageChanged(event: any): void { this.disabledPaginador = true; - this.imagenService.getAllWithPaginator(event.page) + this.imagenService.getAllWithPaginator('', event.page) .subscribe((res) => { this.disabledPaginador = false; this.articulos = res.data; this.paginationData = res.pagination; - this.filterItems(); + // this.filterItems(); }, error => console.error(error)); } diff --git a/src/app/services/imagenes.service.ts b/src/app/services/imagenes.service.ts index f7e254c..4f28eb5 100644 --- a/src/app/services/imagenes.service.ts +++ b/src/app/services/imagenes.service.ts @@ -10,9 +10,12 @@ export class ImagenesService { constructor(private http: HttpClient) { } - getAllWithPaginator(page: number = 1): Observable { + getAllWithPaginator(search: string = '', page: number = 1): Observable { - return this.http.get(`${appSettings.apiImagenes}/articulos/${page}`); + return this.http.post(`${appSettings.apiImagenes}/articulos`, { + page: page, + search: search + }); } saveInBase(body): Observable { -- 1.9.1