+<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">
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>
--- /dev/null
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close"
+ ng-click="cancel()" aria-hidden="true">×</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>
+
+
--- /dev/null
+<div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close"
+ ng-click="cancel()" aria-hidden="true">×</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>
+
+
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';
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');
+ }
+
+
}])
}
}
- // 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();
}
}
});
}
+ // 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;
}])
$scope.orgChanged = function(org) {
$scope.selected = egOrg.get(org.id);
}
+
+ if (!$scope.selected)
+ $scope.selected = egOrg.get(egAuth.user().ws_ou());
}]
}
})