webstaff: Wire up statcat filtering in item attribute editor
authorMike Rylander <mrylander@gmail.com>
Mon, 26 Oct 2015 16:13:45 +0000 (12:13 -0400)
committerKathy Lussier <klussier@masslnc.org>
Tue, 2 Feb 2016 19:58:53 +0000 (14:58 -0500)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2
Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js

index 4d1ec8e..553cb25 100644 (file)
 
             <div class="row pad-vert"></div>
 
-            <div class="row" ng-repeat="sc in statcats">
+            <div class="row" ng-repeat="sc in statcats" ng-show="statcat_visible(sc.owner().id())">
                 <div class="col-xs-12">
                     <div class="row bg-info">
                         <div class="col-xs-12">
index b70f81f..dfe8df3 100644 (file)
@@ -1295,6 +1295,15 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
             $scope.workingGridDataProvider.refresh();
         });
 
+        $scope.statcat_visible = function (sc_owner) {
+            var visible = typeof $scope.working.statcat_filter === 'undefined' || !$scope.working.statcat_filter;
+            angular.forEach(egCore.org.ancestors(sc_owner), function (anscestor_org) {
+                if ($scope.working.statcat_filter == anscestor_org.id())
+                    visible = true;
+            });
+            return visible;
+        }
+
         $scope.suffix_list = [];
         itemSvc.get_suffixes(egCore.auth.user().ws_ou()).then(function(list){
             $scope.suffix_list = list;