retrieve last patron
authorBill Erickson <berick@esilibrary.com>
Wed, 25 Jun 2014 19:24:36 +0000 (15:24 -0400)
committerBill Erickson <berick@esilibrary.com>
Wed, 25 Jun 2014 19:24:36 +0000 (15:24 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/staff/circ/patron/t_last_patron.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/navbar.tt2
Open-ILS/web/js/ui/default/staff/circ/patron/app.js

diff --git a/Open-ILS/src/templates/staff/circ/patron/t_last_patron.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_last_patron.tt2
new file mode 100644 (file)
index 0000000..9a917d8
--- /dev/null
@@ -0,0 +1,9 @@
+<div class="col-md-6">
+  <div ng-if="no_last" class="alert alert-warning">
+    [% l('No patrons recently accessed.') %]
+    <span class="pad-horiz">
+      <a href='./circ/patron/search'>[% l('Try Patron Search') %]</a>
+    </span>
+  </div>
+  <br/>
+</div>
index ffe08f6..0d1981d 100644 (file)
               [% l('Check In') %]
             </a>
           </li>
+          <li>
+            <a href="./circ/patron/last" target="_self">
+              <span class="glyphicon glyphicon-share-alt"></span>
+              [% l('Retrieve Last Patron') %]
+            </a>
+          </li>
           <li class="divider"></li>
           <li>
             <a href="./circ/patron/credentials" target="_self">
index c831818..faf9203 100644 (file)
@@ -75,6 +75,12 @@ angular.module('egPatronApp', ['ngRoute', 'ui.bootstrap',
         resolve : resolver
     });
 
+    $routeProvider.when('/circ/patron/last', {
+        templateUrl: './circ/patron/t_last_patron',
+        controller: 'PatronFetchLastCtrl',
+        resolve : resolver
+    });
+
     // the following require a patron ID
 
     $routeProvider.when('/circ/patron/:id/alerts', {
@@ -204,6 +210,7 @@ function($q , $timeout , $location , egCore,  egUser , $locale) {
         var user_id = id ? id : (user ? user.id() : null);
 
         console.debug('setting primary user to: ' + user_id);
+        egCore.hatch.setLocalItem('eg.circ.last_patron', user_id);
 
         // avoid running multiple retrievals for the same patron, which
         // can happen during dbl-click by maintaining a single running
@@ -1355,3 +1362,13 @@ function($scope,  $routeParams , $q , egCore , patronSvc) {
     });
 }])
 
+.controller('PatronFetchLastCtrl',
+       ['$scope','$location','egCore',
+function($scope , $location , egCore) {
+
+    var id = egCore.hatch.getLocalItem('eg.circ.last_patron');
+    if (id) return $location.path('/circ/patron/' + id + '/checkout');
+
+    $scope.no_last = true;
+}])