From 778965846a935834d78dcd3381f8e7859048be78 Mon Sep 17 00:00:00 2001 From: Eduardo Pieretti Umpierre Date: Wed, 28 Mar 2018 13:38:23 -0300 Subject: [PATCH] Searchbar result fix --- src/pages/orders/form/order-form.ts | 4 +--- src/pages/orders/modal/order-product-modal.ts | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/pages/orders/form/order-form.ts b/src/pages/orders/form/order-form.ts index ad0b2ed..cecf888 100644 --- a/src/pages/orders/form/order-form.ts +++ b/src/pages/orders/form/order-form.ts @@ -70,9 +70,7 @@ export class OrderFormPage { this.order = []; if (id && id.trim() != '') { - event.component.items = this.customers.filter(item => { - return item.name.toLowerCase().indexOf(id) !== -1 || item.id.toString().indexOf(id) !== -1; - }); + event.component.items = this.customers.filter(item => item.name.toLowerCase().indexOf(id.toLowerCase()) !== -1 || item.id.toString().indexOf(id) !== -1); event.component.isSearching = false; } diff --git a/src/pages/orders/modal/order-product-modal.ts b/src/pages/orders/modal/order-product-modal.ts index f41ffce..7ef1752 100644 --- a/src/pages/orders/modal/order-product-modal.ts +++ b/src/pages/orders/modal/order-product-modal.ts @@ -55,11 +55,11 @@ export class OrderProductModalPage { event.component.isSearching = true; - this.apiProvider.builder('products').get({id: id}).subscribe((products) => { - event.component.items = products; + if (id && id.trim() != '') { + event.component.items = this.products.filter(item => item.name.toLowerCase().indexOf(id.toLowerCase()) !== -1 || item.id.toString().indexOf(id) !== -1); event.component.isSearching = false; - }); + } } /**