id-field="id"
idl-class="atc"
features="-sort,-multisort"
- items-provider="grid_data_provider"
grid-controls="grid_controls"
persist-key="circ.transits.list"
>
<eg-grid-menu-item handler="abort_transit"
label="[% l('Abort Transit') %]"></eg-grid-menu-item>
- <eg-grid-field path='id' hidden></eg-grid-field>
- <eg-grid-field path='target_copy.barcode' label="[% l('Barcode') %]">
- <a target="_self" href='./cat/item/{{item.target_copy().id()}}'>{{item.target_copy().barcode()}}</a>
+ <eg-grid-field path='id' hidden required></eg-grid-field>
+ <eg-grid-field path='target_copy.id' hidden required></eg-grid-field>
+ <eg-grid-field path='target_copy.call_number.record.simple_record.id' hidden required></eg-grid-field>
+ <eg-grid-field path='hold_transit_copy.hold.id' hidden required></eg-grid-field>
+ <eg-grid-field path='target_copy.barcode' label="[% l('Barcode') %]" sortable>
+ <a target="_self" href="./cat/item/{{item['target_copy.id']}}">{{item['target_copy.barcode']}}</a>
</eg-grid-field>
<eg-grid-field path='target_copy.circ_lib.shortname' hidden></eg-grid-field>
<eg-grid-field path='target_copy.call_number.label' hidden></eg-grid-field>
- <eg-grid-field path='target_copy.call_number.record.simple_record.title' label="[% l('Title') %]">
- <a target="_self" href="[% ctx.base_path %]/staff/cat/catalog/record/{{item.target_copy().call_number().record().simple_record().id()}}">
- {{item.target_copy().call_number().record().simple_record().title()}}
+ <eg-grid-field path='target_copy.call_number.record.simple_record.title' label="[% l('Title') %]" sortable>
+ <a target="_self" href="[% ctx.base_path %]/staff/cat/catalog/record/{{item['target_copy.call_number.record.simple_record.id']}}">
+ {{item['target_copy.call_number.record.simple_record.title']}}
</a>
</eg-grid-field>
<eg-grid-field path='target_copy.call_number.record.simple_record.author' hidden></eg-grid-field>
- <eg-grid-field path='source.shortname' label="[% l('Source Library') %]"></eg-grid-field>
- <eg-grid-field path='dest.shortname' label="[% l('Destination Library') %]"></eg-grid-field>
- <eg-grid-field path='source_send_time' dateformat='short''></eg-grid-field>
+ <eg-grid-field path='source.shortname' label="[% l('Source Library') %]" sortable></eg-grid-field>
+ <eg-grid-field path='dest.shortname' label="[% l('Destination Library') %]" sortable></eg-grid-field>
+ <eg-grid-field path='source_send_time' dateformat='short' sortable></eg-grid-field>
<eg-grid-field path='hold_transit_copy.hold.hold_type'></eg-grid-field>
<eg-grid-field path='hold_transit_copy.hold.request_time' hidden></eg-grid-field>
<eg-grid-field path='hold_transit_copy.hold.capture_time' hidden></eg-grid-field>
['$scope','$q','$routeParams','$window','egCore','egTransits','egGridDataProvider','$uibModal','$timeout',
function($scope , $q , $routeParams , $window , egCore , egTransits , egGridDataProvider , $uibModal , $timeout) {
- var transits = [];
- var provider = egGridDataProvider.instance({});
- $scope.grid_data_provider = provider;
$scope.transit_direction = 'to';
function init_dates() {
abort_transit(transits);
}
- $scope.add_copies_to_bucket = function(transits) {
+ $scope.add_copies_to_bucket = function() {
var copy_list = [];
angular.forEach($scope.grid_controls.selectedItems(), function(transit) {
- copy_list.push(transit.target_copy().id());
+ copy_list.push(transit['target_copy.id']);
});
if (copy_list.length == 0) return;
angular.forEach(
$scope.grid_controls.selectedItems(),
function (item) {
- if (rid_list.indexOf(item.target_copy().call_number().record().simple_record().id()) == -1)
- rid_list.push(item.target_copy().call_number().record().simple_record().id());
+ if (rid_list.indexOf(item['target_copy.call_number.record.simple_record.id']) == -1)
+ rid_list.push(item['target_copy.call_number.record.simple_record.id']);
}
);
return rid_list;
angular.forEach(
$scope.grid_controls.selectedItems(),
function (item) {
- if (rid && item.target_copy().call_number().record().simple_record().id() != rid) return;
- cp_id_list.push(item.target_copy().id());
+ if (rid && item['target_copy.call_number.record.simple_record.id'] != rid) return;
+ cp_id_list.push(item['target_copy.id']);
}
);
return cp_id_list;
spawnHoldingsEdit(true, false);
}
- $scope.grid_controls = {
- activateItem : load_item
- }
-
- function refresh_page() {
- transits = [];
- provider.refresh();
- }
-
- provider.get = function(offset, count) {
- var deferred = $q.defer();
- var recv_index = 0;
-
+ function current_query() {
var filter = {
'source_send_time' : { 'between' : date_range() },
'dest_recv_time' : null
};
if ($scope.transit_direction == 'to') { filter['dest'] = $scope.context_org.id(); }
if ($scope.transit_direction == 'from') { filter['source'] = $scope.context_org.id(); }
+ return filter;
+ }
- egCore.pcrud.search('atc',
- filter, {
- 'flesh' : 5,
- // atc -> target_copy -> call_number -> record -> simple_record
- // atc -> hold_transit_copy -> hold -> usr -> card
- 'flesh_fields' : {
- 'atc' : ['target_copy','dest','source','hold_transit_copy'],
- 'acp' : ['call_number','location','circ_lib'],
- 'acn' : ['record'],
- 'bre' : ['simple_record'],
- 'ahtc' : ['hold'],
- 'ahr' : ['usr'],
- 'au' : ['card']
- },
- 'select' : { 'bre' : ['id'] },
- order_by : { atc : 'source_send_time' },
- limit : count,
- offset : offset,
- }
- ).then(
- deferred.resolve, null,
- function(transit) {
- transits[offset + recv_index++] = transit;
- deferred.notify(transit);
- }
- );
+ $scope.grid_controls = {
+ activateItem : load_item,
+ setQuery : current_query
+ }
- return deferred.promise;
+ function refresh_page() {
+ $scope.grid_controls.setQuery(current_query());
+ $scope.grid_controls.refresh();
}
$scope.context_org = egCore.org.get(egCore.auth.user().ws_ou());