SelfCheckManager.prototype.checkin = function(barcode) {
var self = this;
+
+ // clear the box now so checkins can continue
+ this.updateScanBox();
+
this.checkinCopy({
barcode : barcode,
onload : function(evts) {
if(increment) {
// local checkout occurred. Add to the total and the session.
- this.circSummary.total += 1;
+ this.circSummary.total += 1; // TODO += increment for checkins
this.circSummary.session += 1;
}
}
}
-SelfCheckManager.prototype.displayCheckin = function(result) {
+SelfCheckManager.prototype.displayCheckin = function(result, statText) {
console.log('display checkin results ' + result);
+
+ var copy = result.payload.copy;
+ var record = result.payload.record;
+ var circ = result.payload.circ;
+ var row = this.checkinTemplate.cloneNode(true);
+
+ if(record.isbn()) {
+ this.byName(row, 'jacket').setAttribute('src',
+ '/opac/extras/ac/jacket/small/' + record.isbn());
+ }
+
+ this.byName(row, 'barcode').innerHTML = copy.barcode();
+ this.byName(row, 'title').innerHTML = record.title();
+ this.byName(row, 'author').innerHTML = record.author();
+ this.byName(row, 'status').innerHTML = statText || result.textcode;
+
+ if (circ) {
+ this.byName(row, 'remaining').innerHTML = circ.renewal_remaining();
+ var date = dojo.date.stamp.fromISOString(circ.due_date());
+ this.byName(row, 'due_date').innerHTML =
+ dojo.date.locale.format(date, {selector : 'date'});
+ }
+
+
+ // put new circs at the top of the list
+ var tbody = this.checkinTbody;
+ tbody.insertBefore(row, tbody.getElementsByTagName('tr')[0]);
+
this.updateCircSummary();
}
var payload = result.payload || {};
var tc = result.textcode;
+ console.log('checkin resulted in ' + tc);
+
if (tc == 'NO_SESSION') {
return this.logoutStaff();
displayText = 'No change ' + item; // TODO i18n
this.displayCheckin(result);
+ } else if (tc == 'ROUTE_ITEM') {
+
+ var statText;
+ if (result.source.org) {
+ var sn = fieldmapper.aou.findOrgUnit(result.source.org).shortname();
+ displayText = 'Item needs routing to ' + sn; // TODO i18n
+ statText = tc + ' => ' + sn;
+
+ }
+
+ this.displayCheckin(result, statText);
+
} else if (tc == 'ASSET_COPY_NOT_FOUND') {
displayText = dojo.string.substitute(