'use strict';

// Declare app level module which depends on filters, and services
angular.module('usermanagement',
    [
      'ui.router',
     'usermanagement.members',
     'usermanagement.joinRequests',
     'palaso.ui.notice'
    ])
  .config(function($stateProvider, $urlRouterProvider) {

    
    $urlRouterProvider.otherwise('/members');
    // the "projects" route is a hack to redirect to the /app/projects URL.  See "otherwise" route below
    $stateProvider.state('members',
          {
            url: '/members',
            views: {
              '@': { templateUrl: '/angular-app/bellows/apps/usermanagement/views/members.html' }
            }
        })
        .state('joinRequests',
            {
              url: '/joinRequests',
              views: {
                '@': { templateUrl: '/angular-app/bellows/apps/usermanagement/views/joinRequests.html' }
              }
          });
    })
  .controller('MainCtrl', ['$scope', 'projectService', 'silNoticeService', '$route', '$routeParams', '$location',
               function($scope, projectService, noticeService, $route, $routeParams, $location) {
    $scope.roles = {};
    $scope.project = {};
    $scope.route = $route;
    $scope.location = $location;
    $scope.routeParams = $routeParams;
    $scope.isActive = function(route) {
      return route === $location.path();
    }

    $scope.list = {
      visibleUsers: [],
      users: []
    };
    
    $scope.queryUserList = function queryUserList() {
      projectService.listUsers(function(result) {
        if (result.ok) {
          $scope.list.users = result.data.users;
          $scope.list.userCount = result.data.userCount;
          $scope.project = result.data.project;
          $scope.roles = $scope.project.roles;
        }
      });
    };
    
    $scope.joinRequests = [];
    projectService.getJoinRequests(function(result) {
      $scope.joinRequests = result.data;
    })
    
  }])
  ;

@@ -241,16 +241,57 @@
 .config(
+%5B'$stateProvider', '$urlRouterProvider', 
 function
@@ -947,24 +947,25 @@
    %7D);%0A    %7D
+%5D
 )%0A  .control

put back in explicit dependency injection to work on minified site