</div>
</div>
+[%
+# define the full set of columns here for ease of sharing
+# the data between the template and the JS env.
+COLUMNS = [
+ {name => 'index', label => l('#'), extra => ' + 1'},
+ {name => 'hold_id', label => l('Request ID'), tabs => 'tab_pending'},
+ {name => 'transit_id', label => l('Transit ID'), tabs => 'tab_inbound || tab_outbound'},
+ {name => 'circ_id', label => l('Circ ID'), tabs => 'tab_circulating'},
+ {name => 'copy_barcode', label => l('Item Barcode')},
+ {name => 'copy_circ_lib', label => l('Copy Library')},
+ {name => 'request_time', label => l('Request Date'), tabs => 'tab_pending', extra => '| date'},
+ {name => 'expire_time', label => l('Expire Date'), tabs => 'tab_pending', extra => '| date'},
+ {name => 'hold_request_lib', label => l('Requesting Library'), tabs => 'tab_pending'},
+ {name => 'hold_pickup_lib', label => l('Pickup Library'), tabs => 'tab_pending'}
+ {name => 'transit_time', label => l('Transit Date'), tabs => 'tab_inbound || tab_outbound', extra => '| date'},
+ {name => 'transit_source', label => l('Transit Source'), tabs => 'tab_inbound || tab_outbound'},
+ {name => 'transit_dest', label => l('Transit Destination'), tabs => 'tab_inbound || tab_outbound'},
+ {name => 'hold_shelf_time', label => l('Shelf Date'), tabs => 'tab_onshelf', extra => '| date'},
+ {name => 'patron_given_name', label => l('Patron First'), tabs => 'tab_circulating || tab_onshelf'},
+ {name => 'patron_family_name', label => l('Patron Last'), tabs => 'tab_circulating || tab_onshelf'},
+ {name => 'patron_barcode', label => l('Patron Barcode'), tabs => 'tab_circulating || tab_onshelf'},
+ {name => 'xact_start', label => l('Checkout Date'), tabs => 'tab_circulating', extra => '| date'},
+ {name => 'due_date', label => l('Due Date'), tabs => 'tab_circulating', extra => '| date'},
+ {name => 'circ_circ_lib', label => l('Circulating Library'), tabs => 'tab_circulating'},
+ {name => 'title', label => l('Title')}
+];
+%]
+
<table class="table table-striped table-hover table-condensed" ng-show="itemList.count()">
<thead>
<tr>
<th><a href="javascript:;" ng-click="itemList.selectAll()">✓</a></th>
-
- <th>#</th>
- <th ng-show="tab_pending">[% l('Request ID') %]</th>
- <th ng-show="tab_inbound || tab_outbound">[% l('Transit ID') %]</th>
- <th ng-show="tab_circulating">[% l('Circ ID') %]</th>
-
- <th>[% l('Item Barcode') %]</th>
- <th>[% l('Copy Library') %]</th>
-
- <!-- holds columns -->
- <th ng-show="tab_pending">[% l('Request Date') %]</th>
- <th ng-show="tab_pending">[% l('Expire Date') %]</th>
- <th ng-show="tab_pending">[% l('Requesting Library') %]</th>
- <th ng-show="tab_pending">[% l('Pickup Library') %]</th>
-
- <!-- transit columns -->
- <th ng-show="tab_inbound || tab_outbound">[% l('Transit Date') %]</th>
- <th ng-show="tab_inbound || tab_outbound">[% l('Transit Source') %]</th>
- <th ng-show="tab_inbound || tab_outbound">[% l('Transit Destination') %]</th>
-
- <!-- shelf columns -->
- <th ng-show="tab_onshelf">[% l('Shelf Date') %]</th>
-
- <!-- circ columns -->
- <th ng-show="tab_circulating || tab_onshelf">[% l('Patron Name') %]</th>
- <th ng-show="tab_circulating || tab_onshelf">[% l('Patron Barcode') %]</th>
- <th ng-show="tab_circulating">[% l('Checkout Date') %]</th>
- <th ng-show="tab_circulating">[% l('Due Date') %]</th>
- <th ng-show="tab_circulating">[% l('Circulating Library') %]</th>
-
- <!-- titles can get long, so plop it onto the end of the table -->
- <th>[% l('Title') %]</th>
-
+ [% FOREACH col IN COLUMNS %]
+ <th [% IF col.tabs %]ng-show="[% col.tabs %]"[% END %]>[% col.label %]</th>
+ [% END %]
</tr>
</thead>
<tbody>
<tr ng-repeat="item in itemList.items">
<td><input type='checkbox' ng-model="itemList.selected[item.index]"/></td>
- <td>{{item.index + 1}}</td>
-
- <td ng-show="tab_pending">{{item.hold_id}}</td>
- <td ng-show="tab_inbound || tab_outbound">{{item.transit_id}}</td>
- <td ng-show="tab_circulating">{{item.circ_id}}</td>
-
- <td><a
- href="./fulfillment/status/{{item.copy_barcode_enc}}">
- {{item.copy_barcode}}</a>
+ [% FOREACH col IN COLUMNS %]
+ <td
+ [% IF col.tabs %]ng-show="[% col.tabs %]"[% END %]
+ ng-init="addColumn({name : '[% col.name %]', label : '[% col.label %]'})">
+ [% IF col.name == 'copy_barcode' %]
+ <a href="./fulfillment/status/{{item.copy_barcode_enc}}">{{item.copy_barcode}}</a>
+ [% ELSE %]
+ {{item.[% col.name %][% col.extra IF col.extra %]}}
+ [% END %]
</td>
- <td>{{item.copy_circ_lib}}</td>
-
- <td ng-show="tab_pending">{{item.request_time | date}}</td>
- <td ng-show="tab_pending">{{item.expire_time | date}}</td>
- <td ng-show="tab_pending">{{item.request_lib}}</td>
- <td ng-show="tab_pending">{{item.pickup_lib}}</td>
-
- <td ng-show="tab_inbound || tab_outbound">{{item.transit_time | date}}</td>
- <td ng-show="tab_inbound || tab_outbound">{{item.transit_source}}</td>
- <td ng-show="tab_inbound || tab_outbound">{{item.transit_dest}}</td>
- <td ng-show="tab_onshelf">{{item.hold_shelf_time | date}}</td>
- <td ng-show="tab_circulating">{{item.patron_given_name}} {{item.patron_family_name}}</td>
- <td ng-show="tab_circulating">{{item.patron_barcode}}</td>
- <td ng-show="tab_circulating">{{item.xact_start | date}}</td>
- <td ng-show="tab_circulating">{{item.due_date | date}}</td>
- <td ng-show="tab_circulating">{{item.circ_circ_lib}}</td>
- <td>{{item.title}}</td>
+ [% END %]
</tr>
</tbody>
</table>
$scope.illRouteParams = $routeParams;
$scope.itemList = egList.create({limit : 10}); // limit TBD
-
+ $scope.columns = [];
+ $scope.addColumn = function(col) {
+ $scope.columns.push(col);
+ }
+
// map of flattener fields to retrieve for each query type
$scope.flatFields = {
ahr : {
patron_barcode : {path : 'usr.card.barcode'},
patron_given_name : {path : 'usr.first_given_name'},
patron_family_name : {path : 'usr.family_name'},
- request_lib : {path : 'request_lib.shortname'}, // TODO: causes query problem, wha?
- pickup_lib : {path : 'pickup_lib.shortname'},
+ hold_request_lib : {path : 'request_lib.shortname'}, // TODO: causes query problem, wha?
+ hold_pickup_lib : {path : 'pickup_lib.shortname'},
title : {path : 'bib_rec.bib_record.simple_record.title'},
author : {path : 'bib_rec.bib_record.simple_record.author'},
copy_id : {path : 'current_copy.id'},
id : {path : 'id'},
transit_id : {path : 'id'},
hold_id : {path : 'hold_transit_copy.hold.id'},
- request_lib : {path : 'hold_transit_copy.hold.request_lib'},
- pickup_lib : {path : 'hold_transit_copy.hold.pickup_lib.shortname'},
+ hold_request_lib : {path : 'hold_transit_copy.hold.request_lib.shortname'},
+ hold_pickup_lib : {path : 'hold_transit_copy.hold.pickup_lib.shortname'},
patron_id : {path : 'hold_transit_copy.hold.usr.id'},
patron_barcode : {path : 'hold_transit_copy.hold.usr.card.barcode'},
patron_given_name : {path : 'hold_transit_copy.hold.usr.first_given_name'},