SO Index: User must select a shop first in order to load relevant standing orders

This commit is contained in:
Rob Harrington
2016-10-07 14:46:15 +11:00
parent a94742e4db
commit bbd43f7026
6 changed files with 58 additions and 32 deletions

View File

@@ -1,3 +1,9 @@
angular.module("admin.standingOrders").controller "StandingOrdersController", ($scope, StandingOrders, Columns) ->
$scope.standingOrders = StandingOrders.index({ams_prefix: 'index'}) # {enterprise_id: $scope.shop_id}
angular.module("admin.standingOrders").controller "StandingOrdersController", ($scope, StandingOrders, Columns, shops) ->
$scope.columns = Columns.columns
$scope.shops = shops
$scope.shop_id = if shops.length == 1 then shops[0].id else null
$scope.$watch "shop_id", ->
if $scope.shop_id?
# CurrentShop.shop = $filter('filter')($scope.shops, {id: $scope.shop_id})[0]
$scope.standingOrders = StandingOrders.index("q[shop_id_eq]": $scope.shop_id, ams_prefix: 'index')