LP#1452950 patron reg barcodes dialog
authorBill Erickson <berickxx@gmail.com>
Wed, 2 Sep 2015 01:02:56 +0000 (21:02 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Thu, 25 Feb 2016 22:31:56 +0000 (17:31 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Open-ILS/src/templates/staff/circ/patron/t_edit.tt2
Open-ILS/src/templates/staff/circ/patron/t_patron_cards_dialog.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/css/circ.css.tt2
Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js

index 2aa6d57..f9abc18 100644 (file)
@@ -78,7 +78,8 @@
     [% IF field == 'barcode' %]
 
       <button class="btn btn-default">[% l('Replace Barcode') %]</button>
-      <button class="btn btn-default">[% l('See All') %]</button>
+      <button class="btn btn-default" 
+        ng-click="cards_dialog()">[% l('See All') %]</button>
 
     [% ELSIF field == 'passwd' %]
 
diff --git a/Open-ILS/src/templates/staff/circ/patron/t_patron_cards_dialog.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_patron_cards_dialog.tt2
new file mode 100644 (file)
index 0000000..4ef6b32
--- /dev/null
@@ -0,0 +1,34 @@
+<form ng-submit="ok(args)" role="form">
+    <div class="modal-header">
+      <button type="button" class="close" ng-click="cancel()" 
+        aria-hidden="true">&times;</button>
+      <h4 class="modal-title">[% l('Patron Barcodes') %]</h4>
+    </div>
+    <div class="modal-body patron-reg-barcodes">
+      <div class="row header">
+        <div class="col-md-4">
+          <label>[% l('Barcode') %]</label>
+        </div>
+        <div class="col-md-4">
+          <label>[% l('Active') %]</label>
+        </div>
+        <div class="col-md-4">
+          <label>[% l('Primary') %]</label>
+        </div>
+      </div>
+      <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'/>
+        </div>
+        <div class="col-md-4">
+          <input type='radio' name='primary' value='on' ng-model='card._primary'/>
+        </div>
+      </div>
+    </div>
+    <div class="modal-footer">
+      <input type="submit" class="btn btn-primary" value="[% l('Apply Changes') %]"/>
+      <button class="btn btn-warning" ng-click="cancel()">[% l('Cancel') %]</button>
+    </div>
+  </div> <!-- modal-content -->
+</form>
index 05cea1b..efc04f7 100644 (file)
@@ -141,6 +141,10 @@ but the ones I'm finding aren't quite cutting it..*/
   font-weight: bold;
 }
 
+.patron-reg-barcodes > .header {
+  font-weight: bold;
+}
+
 /* -- end patron registration -- */
 
 [%# 
index 09a4e57..5fd2273 100644 (file)
@@ -298,6 +298,12 @@ angular.module('egCoreMod')
             function(field) { patron[field] = patron[field] == 't'; }
         );
 
+        angular.forEach(patron.cards, function(card) {
+            card.active = card.active == 't'
+            if (card.id == patron.card.id)
+                card._primary = 'on';
+        });
+
         angular.forEach(patron.addresses, 
             function(addr) { service.ingest_address(patron, addr) });
 
@@ -328,7 +334,7 @@ angular.module('egCoreMod')
 
 
 function PatronRegCtrl($scope, $routeParams, 
-    $q, egCore, patronSvc, patronRegSvc) {
+    $q, $modal, egCore, patronSvc, patronRegSvc) {
 
 
     $scope.clone_id = $routeParams.clone_id;
@@ -495,7 +501,6 @@ function PatronRegCtrl($scope, $routeParams,
     } 
 
     $scope.post_code_changed = function(addr) { 
-        console.log('post code ' + addr.post_code);
         egCore.net.request(
             'open-ils.search', 'open-ils.search.zip', addr.post_code)
         .then(function(resp) {
@@ -506,6 +511,37 @@ function PatronRegCtrl($scope, $routeParams,
             if (resp.alert) alert(resp.alert);
         });
     }
+
+    $scope.cards_dialog = function() {
+        $modal.open({
+            templateUrl: './circ/patron/t_patron_cards_dialog',
+            controller: 
+                   ['$scope','$modalInstance','cards',
+            function($scope , $modalInstance , cards) {
+                // scope here is the modal-level scope
+                $scope.args = {cards : cards};
+                $scope.ok = function() { $modalInstance.close($scope.args) }
+                $scope.cancel = function () { $modalInstance.dismiss() }
+            }],
+            resolve : {
+                cards : function() {
+                    // scope here is the controller-level scope
+                    return $scope.patron.cards;
+                }
+            }
+        }).result.then(
+            function(args) {
+                angular.forEach(args.cards, function(card) {
+                    card.ischanged = true; // assume cards need updating, OK?
+                    if (card._primary == 'on' && 
+                        card.id != $scope.patron.card.id) {
+                        $scope.patron.card = card;
+                    }
+                });
+            }
+        );
+    }
+
 }