diff --git a/app/assets/javascripts/admin/customers/controllers/customers_controller.js.coffee b/app/assets/javascripts/admin/customers/controllers/customers_controller.js.coffee index c475f1e4df..8ebe07d456 100644 --- a/app/assets/javascripts/admin/customers/controllers/customers_controller.js.coffee +++ b/app/assets/javascripts/admin/customers/controllers/customers_controller.js.coffee @@ -1,5 +1,5 @@ angular.module("admin.customers").controller "customersCtrl", ($scope, Customers, Columns, pendingChanges, shops) -> - $scope.shop = null + $scope.shop = {} $scope.shops = shops $scope.submitAll = pendingChanges.submitAll @@ -8,8 +8,8 @@ angular.module("admin.customers").controller "customersCtrl", ($scope, Customers code: { name: "Code", visible: true } tags: { name: "Tags", visible: true } - $scope.$watch "shop", -> - if $scope.shop? + $scope.$watch "shop.id", -> + if $scope.shop.id? Customers.loaded = false $scope.customers = Customers.index(enterprise_id: $scope.shop.id) diff --git a/app/views/admin/customers/index.html.haml b/app/views/admin/customers/index.html.haml index f68ad37da1..1b2dc11547 100644 --- a/app/views/admin/customers/index.html.haml +++ b/app/views/admin/customers/index.html.haml @@ -5,7 +5,7 @@ = admin_inject_shops %div{ ng: { app: 'admin.customers', controller: 'customersCtrl' } } - .row{ ng: { hide: "loaded() && filteredCustomers.length > 0" } } + .row{ ng: { hide: "loaded() && customers.length > 0" } } .five.columns.alpha %h3 =t :please_select_hub @@ -13,15 +13,14 @@ %select.select2.fullwidth#shop_id{ 'ng-model' => 'shop.id', name: 'shop_id', 'ng-options' => 'shop.id as shop.name for shop in shops' } .seven.columns.omega   - .row{ 'ng-hide' => '!loaded() || filteredCustomers.length == 0' } + .row{ 'ng-hide' => '!loaded() || customers.length == 0' } .controls.sixteen.columns.alpha.omega .five.columns.alpha %input.fullwidth{ :type => "text", :id => 'quick_search', 'ng-model' => 'quickSearch', :placeholder => 'Quick Search' } .five.columns   - -# =render 'admin/shared/bulk_actions_dropdown' .three.columns   = render 'admin/shared/columns_dropdown' - .row{ 'ng-if' => 'shop && !loaded()' } + .row{ 'ng-if' => 'shop.id && !loaded()' } .sixteen.columns.alpha#loading %img.spinner{ src: "/assets/spinning-circles.svg" } %h1