Skip to content

Commit

Permalink
PT-13362: use default search or indexed search (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
basilkot authored Nov 7, 2023
1 parent d5a1ac9 commit 3587be7
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ function ($rootScope, $scope, $localStorage, customerOrders, bladeUtils, dialogS
var blade = $scope.blade;
var bladeNavigationService = bladeUtils.bladeNavigationService;
$scope.uiGridConstants = uiGridConstants;
$scope.useIndexedSearch = false;

$scope.getPricesVisibility = () => authService.checkPermission('order:read_prices');

Expand Down Expand Up @@ -70,7 +71,9 @@ function ($rootScope, $scope, $localStorage, customerOrders, bladeUtils, dialogS
angular.extend(criteria, filter.current);
}

customerOrders.search(criteria, function (data) {
var endpoint = $scope.useIndexedSearch ? customerOrders.indexedSearch : customerOrders.search;

endpoint(criteria, function (data) {
blade.isLoading = false;

$scope.pageSettings.totalItems = data.totalCount;
Expand Down Expand Up @@ -229,6 +232,10 @@ function ($rootScope, $scope, $localStorage, customerOrders, bladeUtils, dialogS
return gridOptions;
};

customerOrders.indexedSearchEnabled(function (data) {
$scope.useIndexedSearch = data.result;
});


// actions on load
//No need to call this because page 'pageSettings.currentPage' is watched!!! It would trigger subsequent duplicated req...
Expand Down

0 comments on commit 3587be7

Please sign in to comment.