-<h2>CHECKOUT</h2>
+
+<div class="row">
+ <div class="col-md-1"></div>
+ <div class="col-md-2">[% l('Barcode') %]</div>
+ <div class="col-md-3">[% l('Title') %]</div>
+ <div class="col-md-3">[% l('Author') %]</div>
+ <div class="col-md-2">[% l('Due Date') %]</div>
+</div>
+
+<div class="row" ng-repeat="circ in circs">
+ <div class="col-md-1">
+ <img src="/opac/extras/ac/jacket/small/r/{{circ.record.doc_id()}}"/>
+ </div>
+ <div class="col-md-2">{{circ.copy.barcode()}}</div>
+ <div class="col-md-3">{{circ.record.title()}}</div>
+ <div class="col-md-3">{{circ.record.author()}}</div>
+ <div class="col-md-2">{{circ.circ.due_date() | date:'short'}}</div>
+</div>
total_circ_count : 0,
ready_hold_count : 0,
total_hold_count : 0,
- total_owed_count : 0
+ total_owed_count : 0,
+
+ pending_barcode : null, // most recently scanned barcode
+ scanned_barcodes : [], // all scanned barcodes
};
// patron_id is set in cases where the patron has not yet been fetched.
text : '',
focus : false,
disabled : function() {
- // TODO: inactive barcode, etc.
+ // TODO: do we need this?
return false;
+ },
+
+ changed : function($event) {
+ delete $scope.scanbox.already_seen;
+ if ($event.keyCode != 13) return; // submit on enter.
+ scanbox_handler($scope.scanbox.text);
+ }
+ }
+
+ function scanbox_handler(barcode) {
+
+ if (scSvc.scanned_barcodes.indexOf(barcode) > -1) {
+ // avoid processing barcodes the user has already
+ // scanned in this session.
+ $scope.scanbox.already_seen = barcode;
+ return;
+ }
+
+ scSvc.pending_barcode = barcode;
+ scSvc.scanned_barcodes.push(barcode);
+
+ if ($location.path() == '/circ/selfcheck/checkout') {
+ // Already on the checkout page. Tell the checkout
+ // controller to process the barcode.
+ $scope.scanbox.handle_barcode();
+
+ } else {
+ // User scanned a barcode from a UI that's not the
+ // checkout UI. Direct the user back to the checkout
+ // UI so the checkout can continue.
+ $location.path('/circ/selfcheck/checkout');
}
}
scSvc.new_path_init();
$scope.scanbox.focus = true;
+ $scope.scanbox.handle_barcode = function() {
+ var barcode = scSvc.pending_barcode;
+ delete scSvc.pending_barcode;
+
+ console.debug('Processing copy barcode ' + barcode);
+
+ // TODO: checkout item and toss it into the list.
+
+ // always re-focus after scan
+ $scope.scanbox.focus = true;
+ }
+
}])
.controller('ItemsCtrl',
scSvc.get_items_out().then(null, null,
function(circ_blob) { $scope.circs.push(circ_blob) });
+ // TODO: support batch renewal.
+
}])
.controller('HoldsCtrl',