Customers: enable change of hub if no customers

Fix #588.

And show search bar even when no customers are shown. Previously, the
search bar disappeared when you entered a search without results.
This commit is contained in:
Maikel Linke
2016-04-08 09:33:09 +10:00
parent df5b554f24
commit 9e4610f9bd
2 changed files with 6 additions and 7 deletions

View File

@@ -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)

View File

@@ -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