<!-- items out list -->
-<div ng-if="show_alt_circs">
+<div>
<!-- only show the main vs. alt circ list tabs if the alt
circ list is meant to display -->
<ul class="nav nav-tabs">
[% l('Items Checked Out') %] ({{main_list.length}})
</a>
</li>
- <li ng-class="{active : items_out_display == 'alt'}">
+ <li ng-if="show_alt_circs" ng-class="{active : items_out_display == 'alt'}">
<a href ng-click="show_alt_list()">
[% l('Other/Special Circulations') %] ({{alt_list.length}})
</a>
</li>
+ <li ng-class="{active : items_out_display == 'noncat'}">
+ <a href ng-click="show_noncat_list()">
+ [% l('Non-Cataloged Circulations') %] ({{noncat_list.length}})
+ </a>
+ </li>
</ul>
</div>
-<div ng-if="!show_alt_circs" class="strong-text-2">
- [% l('Items Checked Out') %]
-</div>
<div class="tab-content">
<div class="tab-pane active">
+
+<eg-grid
+ ng-if="items_out_display == 'noncat'"
+ idl-class="ancc"
+ id-field="id"
+ features="-sort,-multisort"
+ items-provider="gridDataProvider"
+ persist-key="circ.patron.items_out.noncat">
+
+ <eg-grid-field label="[% l('Circ ID') %]" path='id'></eg-grid-field>
+ <eg-grid-field label="[% l('Item Type') %]" path='item_type.name'></eg-grid-field>
+ <eg-grid-field label="[% l('Checkout Library') %]" path='circ_lib.shortname'></eg-grid-field>
+ <eg-grid-field label="[% l('Checkout Date') %]" path='circ_time' dateformat='short'></eg-grid-field>
+ <eg-grid-field label="[% l('Due Date') %]" path='duedate' dateformat='short'></eg-grid-field>
+ <eg-grid-field label="[% l('Checkout Staff') %]" path='staff.usrname'></eg-grid-field>
+</eg-grid>
+
<eg-grid
+ ng-if="items_out_display != 'noncat'"
idl-class="circ"
id-field="id"
features="-sort,-multisort"
<eg-grid-field path="target_copy.call_number.record.*" hidden></eg-grid-field>
<eg-grid-field path="target_copy.call_number.record.simple_record.*" hidden></eg-grid-field>
</eg-grid>
+</div>
+
</div>
</div>
'egGridDataProvider','$modal','egCirc','egConfirmDialog','egBilling',
function($scope, $q, $routeParams, egCore , egUser, patronSvc ,
egGridDataProvider , $modal , egCirc , egConfirmDialog , egBilling) {
- $scope.initTab('items_out', $routeParams.id);
+
+ // list of noncatatloged circulations. Define before initTab to
+ // avoid any possibility of race condition, since they are loaded
+ // during init, but may be referenced before init completes.
+ $scope.noncat_list = [];
+
+ $scope.initTab('items_out', $routeParams.id).then(function() {
+ // sort inline to support paging
+ $scope.noncat_list = patronSvc.noncat_ids.sort();
+ });
// cache of circ objects for grid display
patronSvc.items_out = [];
provider.refresh();
}
+ $scope.show_noncat_list = function() {
+ // don't need a full reset_page() to swap tabs
+ $scope.items_out_display = 'noncat';
+ patronSvc.items_out = [];
+ provider.refresh();
+ }
+
// Reload the user to pick up changes in items out, fines, etc.
// Reload circs since the contents of the main vs. alt list may
// have changed.
});
}
+ function fetch_noncat_circs(id_list, offset, count) {
+ if (!id_list.length) return $q.when();
+
+ return egCore.pcrud.search('ancc', {id : id_list},
+ { flesh : 1,
+ flesh_fields : {ancc : ['item_type','staff']},
+ limit : count,
+ offset : offset,
+ // we need an order-by to support paging
+ order_by : {circ : ['circ_time']}
+
+ }).then(null, null, function(noncat_circ) {
+
+ // calculate the virtual due date from the item type duration
+ var seconds = egCore.date.intervalToSeconds(
+ noncat_circ.item_type().circ_duration());
+ var d = new Date(Date.parse(noncat_circ.circ_time()));
+ d.setSeconds(d.getSeconds() + seconds);
+ noncat_circ.duedate(d.toISOString());
+
+ // local flesh org unit
+ noncat_circ.circ_lib(egCore.org.get(noncat_circ.circ_lib()));
+
+ patronSvc.items_out.push(noncat_circ); // cache it
+ return noncat_circ;
+ });
+ }
+
+
// decide which list each circ belongs to
function promote_circs(list, display_code, open) {
if (open) {
patronSvc.items_out, offset, count);
}
+ if ($scope.items_out_display == 'noncat') {
+ // if there are any noncat circ IDs, we already have them
+ return fetch_noncat_circs(id_list, offset, count);
+ }
+
// See if we have the circ IDs for this range already loaded.
// this would happen navigating to a subsequent page.
if (id_list[offset]) {