Patron reg field validation (WIP) user/berick/patron-reg-field-validation
authorBill Erickson <berickxx@gmail.com>
Sun, 6 Mar 2016 22:06:14 +0000 (17:06 -0500)
committerBill Erickson <berickxx@gmail.com>
Sun, 6 Mar 2016 22:06:14 +0000 (17:06 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/templates/staff/circ/patron/t_patron_cards_dialog.tt2
Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js

index 4ef6b32..5ba4652 100644 (file)
       <div class="row" ng-repeat="card in args.cards">
         <div class="col-md-4">{{card.barcode}}</div>
         <div class="col-md-4">
-          <input type='checkbox' ng-model='card.active'/>
+          <input type='checkbox' ng-model='card.active' 
+            ng-disabled="!perms.UPDATE_PATRON_ACTIVE_CARD"/>
         </div>
         <div class="col-md-4">
-          <input type='radio' name='primary' value='on' ng-model='card._primary'/>
+          <input type='radio' name='primary' value='on' 
+            ng-model='card._primary'
+            ng-disabled="!perms.UPDATE_PATRON_PRIMARY_CARD"/>
         </div>
       </div>
     </div>
     <div class="modal-footer">
-      <input type="submit" class="btn btn-primary" value="[% l('Apply Changes') %]"/>
+      <input type="submit" class="btn btn-primary" value="[% l('Apply Changes') %]"
+        ng-disabled="!perms.UPDATE_PATRON_PRIMARY_CARD && !perms.UPDATE_PATRON_ACTIVE_CARD"/>
       <button class="btn btn-warning" ng-click="cancel()">[% l('Cancel') %]</button>
     </div>
   </div> <!-- modal-content -->
index d0baa68..5fbc9dd 100644 (file)
@@ -165,7 +165,9 @@ angular.module('egCoreMod')
             'CREATE_USER_GROUP_LINK', 
             'UPDATE_PATRON_COLLECTIONS_EXEMPT',
             'UPDATE_PATRON_CLAIM_RETURN_COUNT',
-            'UPDATE_PATRON_CLAIM_NEVER_CHECKED_OUT_COUNT'
+            'UPDATE_PATRON_CLAIM_NEVER_CHECKED_OUT_COUNT',
+            'UPDATE_PATRON_ACTIVE_CARD',
+            'UPDATE_PATRON_PRIMARY_CARD'
         ];
 
         return egCore.perm.hasPermAt(perms_needed, true)
@@ -1346,10 +1348,11 @@ function PatronRegCtrl($scope, $routeParams,
         $modal.open({
             templateUrl: './circ/patron/t_patron_cards_dialog',
             controller: 
-                   ['$scope','$modalInstance','cards',
-            function($scope , $modalInstance , cards) {
+                   ['$scope','$modalInstance','cards', 'perms',
+            function($scope , $modalInstance , cards, perms) {
                 // scope here is the modal-level scope
                 $scope.args = {cards : cards};
+                $scope.perms = perms;
                 $scope.ok = function() { $modalInstance.close($scope.args) }
                 $scope.cancel = function () { $modalInstance.dismiss() }
             }],
@@ -1357,6 +1360,9 @@ function PatronRegCtrl($scope, $routeParams,
                 cards : function() {
                     // scope here is the controller-level scope
                     return $scope.patron.cards;
+                },
+                perms : function() {
+                    return $scope.perms;
                 }
             }
         }).result.then(