LP#1402797 Be explicit about which direction users are moving between groups, and...
authorMike Rylander <mrylander@gmail.com>
Fri, 30 Jan 2015 18:05:26 +0000 (13:05 -0500)
committerBill Erickson <berickxx@gmail.com>
Wed, 25 Feb 2015 16:16:06 +0000 (11:16 -0500)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/templates/staff/circ/patron/t_move_to_group_dialog.tt2
Open-ILS/web/js/ui/default/staff/circ/patron/app.js

index 96e9733..ee04de0 100644 (file)
@@ -6,7 +6,8 @@
       [% l('Move user into this group?') %]
     </h4>
     <h4 ng-if="outbound" class="modal-title">
-      [% l("Move selected users to the following user's group?") %]
+      <span ng-show="selected.length">[% l("Move selected users to the following user's group?") %]</span>
+      <span ng-hide="selected.length">[% l("No users selected for move.") %]</span>
     </h4>
   </div>
   <div class="modal-body">
@@ -21,7 +22,7 @@
     </a>
   </div>
   <div class="modal-footer">
-    <button class="btn btn-primary" ng-click="ok()">[% l('Move User') %]</button>
+    <button ng-disabled="outbound && !selected.length" class="btn btn-primary" ng-click="ok()">[% l('Move User') %]</button>
     <button class="btn btn-warning" ng-click="cancel()">[% l('Cancel') %]</button>
   </div>
 </div>
index d3c0add..e6b22c0 100644 (file)
@@ -1411,7 +1411,7 @@ function($scope,  $routeParams , $q , $window , $location , egCore ,
         $q.all(promises).then(function() {grid.refresh()});
     }
 
-    function showMoveToGroupConfirm(barcode, selected) {
+    function showMoveToGroupConfirm(barcode, selected, outbound) {
 
         // find the user
         egCore.pcrud.search('ac', {barcode : barcode})
@@ -1430,7 +1430,8 @@ function($scope,  $routeParams , $q , $window , $location , egCore ,
                                 '$scope','$modalInstance',
                         function($scope , $modalInstance) {
                             $scope.user = user;
-                            $scope.outbound = Boolean(selected);
+                            $scope.selected = selected;
+                            $scope.outbound = outbound;
                             $scope.ok = 
                                 function(count) { $modalInstance.close() }
                             $scope.cancel = 
@@ -1438,7 +1439,7 @@ function($scope,  $routeParams , $q , $window , $location , egCore ,
                         }
                     ]
                 }).result.then(function() {
-                    if (selected) {
+                    if (outbound) {
                         moveUsersToGroup(user, selected);
                     } else {
                         addUserToGroup(user);
@@ -1450,18 +1451,18 @@ function($scope,  $routeParams , $q , $window , $location , egCore ,
 
     // selected == move selected patrons to another patron's group
     // !selected == patron from a different group moves into our group
-    function moveToGroup(selected) {
+    function moveToGroup(selected, outbound) {
         egPromptDialog.open(
             egCore.strings.GROUP_ADD_USER, '',
             {ok : function(value) {
                 if (value) 
-                    showMoveToGroupConfirm(value, selected);
+                    showMoveToGroupConfirm(value, selected, outbound);
             }}
         );
     }
 
-    $scope.moveToGroup = function() { moveToGroup() };
-    $scope.moveToAnotherGroup = function(selected) { moveToGroup(selected) };
+    $scope.moveToGroup = function() { moveToGroup([], false) };
+    $scope.moveToAnotherGroup = function(selected) { moveToGroup(selected, true) };
 
     $scope.cloneUser = function(selected) {
         if (!selected.length) return;