patron holds; copy quality; pickup lib; show circs
authorBill Erickson <berick@esilibrary.com>
Thu, 3 Jul 2014 14:24:58 +0000 (10:24 -0400)
committerBill Erickson <berick@esilibrary.com>
Thu, 3 Jul 2014 14:24:58 +0000 (10:24 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/staff/cat/item/t_circ_list_pane.tt2
Open-ILS/src/templates/staff/circ/patron/t_holds.tt2
Open-ILS/src/templates/staff/circ/share/t_hold_copy_quality_dialog.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/circ/share/t_hold_edit_pickup_lib.tt2 [new file with mode: 0644]
Open-ILS/web/js/ui/default/staff/circ/patron/holds.js
Open-ILS/web/js/ui/default/staff/circ/renew/app.js
Open-ILS/web/js/ui/default/staff/circ/services/holds.js
Open-ILS/web/js/ui/default/staff/services/ui.js

index 94abc3f..9f7bbb5 100644 (file)
@@ -1,5 +1,10 @@
+<div class="col-md-12" ng-show="!circ_list.length">
+  <div class="alert alert-info">
+    [% l('Item has not circulated.') %]
+  </div>
+</div>
+
 <div class="row" ng-repeat="circ in circ_list">
-  
   <div class="flex-row">
     <div class="flex-cell well">
       <a href="./circ/patron/{{circ.usr().id()}}/checkout" target="_self">
index cce13f5..069af7d 100644 (file)
   items-provider="gridDataProvider"
   persist-key="circ.patron.holds">
 
+  <eg-grid-action handler="show_recent_circs"
+    label="[% l('Show Last Few Circulations') %]"></eg-grid-action>
+  <eg-grid-action handler="set_copy_quality"
+    label="[% l('Set Desired Copy Quality') %]"></eg-grid-action>
+  <eg-grid-action handler="edit_pickup_lib"
+    label="[% l('Edit Pickup Library') %]"></eg-grid-action>
   <eg-grid-action handler="cancel_hold"
     label="[% l('Cancel Hold') %]"></eg-grid-action>
 
   <eg-grid-field label="[% l('Hold ID') %]" path='hold.id'></eg-grid-field>
-  <eg-grid-field label="[% l('Current Copy') %]" path='hold.current_copy.barcode'></eg-grid-field>
+  <eg-grid-field label="[% l('Current Copy') %]" 
+    path='hold.current_copy.barcode'>
+    <a href="./cat/item/{{item.hold.current_copy().id()}}/summary" target="_self">
+      {{item.hold.current_copy().barcode()}}
+    </a>
+  </eg-grid-field>
+
   <eg-grid-field label="[% l('Request Date') %]" path='hold.request_time'></eg-grid-field>
   <eg-grid-field label="[% l('Capture Date') %]" path='hold.capture_time'></eg-grid-field>
   <eg-grid-field label="[% l('Available Date') %]" path='hold.shelf_time'></eg-grid-field>
   <eg-grid-field label="[% l('Hold Type') %]" path='hold.hold_type'></eg-grid-field>
   <eg-grid-field label="[% l('Pickup Library') %]" path='hold.pickup_lib.shortname'></eg-grid-field>
-  <eg-grid-field label="[% l('Title') %]" path='mvr.title'></eg-grid-field>
+
+  <eg-grid-field label="[% l('Title') %]" path='mvr.title'>
+    <a href="[% ctx.base_path %]/opac/record/{{item.mvr.doc_id()}}">
+      {{item.mvr.title()}}
+    </a>
+  </eg-grid-field>
+
   <eg-grid-field label="[% l('Author') %]" path='mvr.author'></eg-grid-field>
   <eg-grid-field label="[% l('Potential Copies') %]" path='potential_copies'></eg-grid-field>
   <eg-grid-field label="[% l('Status') %]" path='status_string'></eg-grid-field>
diff --git a/Open-ILS/src/templates/staff/circ/share/t_hold_copy_quality_dialog.tt2 b/Open-ILS/src/templates/staff/circ/share/t_hold_copy_quality_dialog.tt2
new file mode 100644 (file)
index 0000000..c193646
--- /dev/null
@@ -0,0 +1,24 @@
+  <div class="modal-content">
+    <div class="modal-header">
+      <button type="button" class="close" 
+        ng-click="cancel()" aria-hidden="true">&times;</button>
+      <h4 class="modal-title">
+        [% l('Accept only "Good Quality" copies?') %]
+      </h4>
+    </div>
+    <div class="modal-body">
+      <div class="form-group">
+        <div class="col-md-4">
+          <button class="btn btn-default" ng-click="good()">[% l('Good Condition') %]</button>
+        </div>
+        <div class="col-md-4">
+          <button class="btn btn-default" ng-click="any()">[% l('Any Condition') %]</button>
+        </div>
+      </div>
+    </div>
+    <div class="modal-footer">
+      <button class="btn btn-warning" ng-click="cancel()">[% l('Cancel') %]</button>
+    </div>
+  </div>
+
+
diff --git a/Open-ILS/src/templates/staff/circ/share/t_hold_edit_pickup_lib.tt2 b/Open-ILS/src/templates/staff/circ/share/t_hold_edit_pickup_lib.tt2
new file mode 100644 (file)
index 0000000..895cda0
--- /dev/null
@@ -0,0 +1,23 @@
+<div class="modal-content">
+  <div class="modal-header">
+    <button type="button" class="close" 
+      ng-click="cancel()" aria-hidden="true">&times;</button>
+    <h4 class="modal-title">
+      [% l('Edit hold pickup library') %]
+    </h4>
+  </div>
+  <div class="modal-body">
+    <div class="form-group">
+      <div class="col-md-4">[% l('Select Library:') %]</div>
+      <div class="col-md-8">
+        <eg-org-selector selected="args.org_unit"></eg-org-selector>
+      </div>
+    </div>
+  </div>
+  <div class="modal-footer">
+    <button class="btn btn-default" ng-click="ok()">[% l('Submit') %]</button>
+    <button class="btn btn-warning" ng-click="cancel()">[% l('Cancel') %]</button>
+  </div>
+</div>
+
+
index da66ef8..11ff507 100644 (file)
@@ -4,8 +4,11 @@
 
 angular.module('egPatronApp').controller('PatronHoldsCtrl',
 
-       ['$scope','$q','$routeParams','egCore','egUser','patronSvc','egGridDataProvider','egHolds',
-function($scope,  $q,  $routeParams,  egCore,  egUser,  patronSvc,  egGridDataProvider , egHolds) {
+       ['$scope','$q','$routeParams','egCore','egUser','patronSvc',
+        'egGridDataProvider','egHolds','$window','$location',
+function($scope,  $q,  $routeParams,  egCore,  egUser,  patronSvc,  
+        egGridDataProvider , egHolds , $window , $location) {
+
     $scope.initTab('holds', $routeParams.id);
     $scope.holds_display = 'main';
 
@@ -100,6 +103,32 @@ function($scope,  $q,  $routeParams,  egCore,  egUser,  patronSvc,  egGridDataPr
 
         return egHolds.cancel_holds(hold_ids).then(refresh_all);
     }
+
+    // jump to circ list for either 1) the targeted copy or
+    // 2) the hold target copy for copy-level holds
+    $scope.show_recent_circs = function(items) {
+        if (items.length && (copy = items[0].copy)) {
+            var url = $location.path(
+                '/cat/item/' + copy.id() + '/circ_list').absUrl();
+            $window.open(url, '_blank').focus();
+        }
+    }
+
+    function generic_update(items, action) {
+        if (!items.length) return $q.when();
+        var hold_ids = items.map(function(item) {return item.hold.id()});
+        return egHolds[action](hold_ids).then(refresh_all);
+    }
+
+    $scope.set_copy_quality = function(items) {
+        generic_update(items, 'set_copy_quality');
+    }
+
+    $scope.edit_pickup_lib = function(items) {
+        generic_update(items, 'edit_pickup_lib');
+    }
+
+
 }])
 
 
index 47a3184..c64c66c 100644 (file)
@@ -168,12 +168,11 @@ function($scope , $window , $location , egCore , egGridDataProvider , egCirc) {
         }
     }
 
-    // TODO: add URL-based grid actions support for ctrl-click
     $scope.showLastFewCircs = function(items) {
         if (items.length && (copy = items[0].acp)) {
-            $window.location.href = $location
-                .path('/cat/item/' + copy.id() + '/circ_list')
-                .absUrl();
+            var url = $location.path(
+                '/cat/item/' + copy.id() + '/circ_list').absUrl();
+            $window.open(url, '_blank').focus();
         }
     }
 
index e9535ef..36896e7 100644 (file)
@@ -71,6 +71,65 @@ function($modal , $q , egCore , egAlertDialog , egConfirmDialog) {
         });
     }
 
+    // Updates a batch of holds, notifies on each response.
+    // new_values = array of hashes describing values to change,
+    // including the id of the hold to change.
+    // e.g. {id : 1, mint_condition : true}
+    service.update_holds = function(new_values) {
+        return egCore.net.request(
+            'open-ils.circ',
+            'open-ils.circ.hold.update.batch',
+            egCore.auth.token(), null, new_values);
+    }
+
+    service.set_copy_quality = function(hold_ids) {
+        if (!hold_ids.length) return $q.when();
+        return $modal.open({
+            templateUrl : './circ/share/t_hold_copy_quality_dialog',
+            controller : 
+                ['$scope', '$modalInstance',
+                function($scope, $modalInstance) {
+
+                    function update(val) {
+                        var vals = hold_ids.map(function(hold_id) {
+                            return {id : hold_id, mint_condition : val}})
+                        service.update_holds(vals).finally(function() {
+                            $modalInstance.close();
+                        });
+                    }
+                    $scope.good = function() { update(true) }
+                    $scope.any = function() { update(false) }
+                    $scope.cancel = function() { $modalInstance.dismiss() }
+                }
+            ]
+        }).result;
+    }
+
+    service.edit_pickup_lib = function(hold_ids) {
+        if (!hold_ids.length) return $q.when();
+        return $modal.open({
+            templateUrl : './circ/share/t_hold_edit_pickup_lib',
+            controller : 
+                ['$scope', '$modalInstance',
+                function($scope, $modalInstance) {
+                    $scope.args = {}
+                    $scope.ok = function() { 
+                        var vals = hold_ids.map(function(hold_id) {
+                            return {
+                                id : hold_id, 
+                                pickup_lib : $scope.args.org_unit.id()
+                            }
+                        });
+                        service.update_holds(vals).finally(function() {
+                            $modalInstance.close();
+                        });
+                    }
+                    $scope.cancel = function() { $modalInstance.dismiss() }
+                }
+            ]
+        }).result;
+    }
+
     return service;
 }])
 
index f5602cb..91dc54f 100644 (file)
@@ -241,6 +241,9 @@ function($modal, $interpolate) {
             $scope.orgChanged = function(org) {
                 $scope.selected = egOrg.get(org.id);
             }
+
+            if (!$scope.selected)
+                $scope.selected = egOrg.get(egAuth.user().ws_ou());
         }]
     }
 })