| @@ -0,0 +1,40 @@ | ||
|
|
||
| <ion-view view-title="Team Namer"> | ||
|
|
||
| <div backstretch backstretch-images="'http://www.ironman.today/wp-content/uploads/2015/03/walking-1.jpg'"></div> | ||
|
|
||
| <ion-content class="padding-top shadowstyle" style="margin-left:20%; margin-right:20%; background-color:rgba(250, 250, 250, 0.92)"> | ||
| <div class="text-center padding-top"> | ||
| <label class="item item-input item-floating-label" ng-if="user.admin"> | ||
| <span class="input-label has-input">Org Unit</span> | ||
| <select style="text-align:center;margin:auto;" name="ou" type="text" ng-model="query.ou" ng-change="onOuSelect()" ng-options="ou for ou in ous track by ou" required></select> | ||
| </label> | ||
|
|
||
| <!-- {{ouTotal}} /// {{numOuUsers}} --> | ||
| <label class="item item-input item-floating-label"> | ||
| <span class="input-label has-input">User</span> | ||
| <select style="text-align:center;margin:auto;" name="user" type="text" ng-model="query.user" ng-change="onUserSelect()" ng-options="(user.firstname + ' ' + user.lastname) for user in users track by user.id" required></select><!-- + ' '+user.registered_in --> | ||
| </label> | ||
| <div> | ||
| <md-button class="md-raised" ng-click="selectPreviousUser()"> | ||
| <i class="ion-chevron-left small"></i> | ||
| </md-button> | ||
| | ||
| | ||
| <md-button class="md-raised" ng-click="selectNextUser()"> | ||
| <i class="ion-chevron-right small"></i> | ||
| </md-button> | ||
| </div> | ||
|
|
||
| <br> | ||
|
|
||
| <form ng-submit="teamnamer()"> | ||
| <center> | ||
| <input type="text" ng-model="users[userIndex].team" /> | ||
| </center> | ||
| <input type="submit" value="yolo" /> | ||
| </form> | ||
|
|
||
| </div> | ||
| </ion-content> | ||
| </ion-view> |
| @@ -0,0 +1,54 @@ | ||
| 'Use Strict'; | ||
| angular.module('App').controller('teamnamerController', function (Auth, $state, $scope, StepLog, Admin, user) { | ||
|
|
||
| if(user.ouadmin){ | ||
| $scope.users = Admin.getUsersFromOu(user.ou); | ||
| } | ||
|
|
||
|
|
||
| $scope.ous = ['Audit Services','CEHS','Corp Comm','EIX','Eithics & Compliance', 'Finance','Government Affairs', 'Human Resources', 'Legal', 'EPM/Generation', 'Reg Affairs & SIPP', 'Edison Material Supply','Transportation Services']; | ||
|
|
||
| $scope.query = {}; | ||
|
|
||
| $scope.onOuSelect = function(){ | ||
| $scope.users = Admin.getUsersFromOu($scope.query.ou); | ||
| }; | ||
|
|
||
| $scope.onUserSelect = function(){ | ||
| console.log($scope.query.user) | ||
|
|
||
|
|
||
| $scope.users.forEach(function(user, i){ | ||
| if(angular.equals($scope.query.user, user)){ | ||
| $scope.userIndex = i; | ||
| } | ||
| }); | ||
|
|
||
| console.log($scope.query.user.team); | ||
| }; | ||
|
|
||
| $scope.teamnamer = function(){ | ||
| $scope.users.$save($scope.userIndex); | ||
| } | ||
|
|
||
| $scope.selectNextUser = function(){ | ||
|
|
||
| if($scope.users.length > $scope.userIndex + 1){ | ||
| $scope.query.user = $scope.users[$scope.userIndex + 1]; | ||
| } else { | ||
| $scope.query.user = $scope.users[0]; | ||
| } | ||
|
|
||
| $scope.onUserSelect(); | ||
| } | ||
|
|
||
| $scope.selectPreviousUser = function(){ | ||
| if(0 < $scope.userIndex){ | ||
| $scope.query.user = $scope.users[$scope.userIndex - 1]; | ||
| } else { | ||
| $scope.query.user = $scope.users[$scope.users.length - 1]; | ||
| } | ||
|
|
||
| $scope.onUserSelect(); | ||
| } | ||
| }); |