Skip to content

Commit

Permalink
fix case insensitive search in bin locations, categories and suppliers
Browse files Browse the repository at this point in the history
  • Loading branch information
panic-coder authored and kamal0808 committed Jan 13, 2020
1 parent c864c7a commit 897df2a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,11 @@ export class BinLocationsComponent implements OnInit {
*/
searchSKU() {
this.loading = true;
var pattern = new RegExp('.*'+this.searchSKUText+'.*', "i"); /* case-insensitive RegExp search */
var filterData = pattern.toString();
let filter = {
where: {
sku: this.searchSKUText
sku: { "regexp": filterData }
}
};
this.orgModelApi.getProductModels(this.userProfile.orgModelId, filter)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,16 @@ export class CategoriesComponent implements OnInit {
where: {}
};
if (searchText) {
var pattern = new RegExp('.*'+searchText+'.*', "i"); /* case-insensitive RegExp search */
var filterData = pattern.toString();
filter.where = {
name: {
like: searchText
}
name: { "regexp": filterData }
}
}
let fetchCategories = combineLatest(
this.orgModelApi.getCategoryModels(this.userProfile.orgModelId, filter),
this.orgModelApi.countCategoryModels(this.userProfile.orgModelId));
fetchCategories.subscribe((data: any) => {
fetchCategories.subscribe((data: any) => {
this.loading = false;
this.categories = data[0];
this.totalCategories = data[1].count;
Expand Down
6 changes: 3 additions & 3 deletions admin/src/app/home/suppliers/suppliers.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ export class SuppliersComponent implements OnInit {
*/
searchSupplier() {
this.loading = true;
var pattern = new RegExp('.*'+this.searchSupplierText+'.*', "i"); /* case-insensitive RegExp search */
var filterData = pattern.toString();
let filter = {
where: {
name: {
like: this.searchSupplierText
}
name: { "regexp": filterData }
}
};
this.orgModelApi.getSupplierModels(this.userProfile.orgModelId, filter)
Expand Down

0 comments on commit 897df2a

Please sign in to comment.