selfcheck checkin UI
authorBill Erickson <berick@esilibrary.com>
Mon, 4 Feb 2013 17:25:06 +0000 (12:25 -0500)
committerBill Erickson <berick@esilibrary.com>
Mon, 4 Feb 2013 17:25:06 +0000 (12:25 -0500)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/circ/selfcheck/checkin_page.tt2
Open-ILS/web/css/skin/default/selfcheck.css
Open-ILS/web/js/dojo/openils/circ/nls/selfcheck.js
Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js

index 1a88e8f..151e6a1 100644 (file)
@@ -27,8 +27,8 @@
                 <td>[% l('Title') %]</td>
                 <td>[% l('Author') %]</td>
                 <td>[% l('Due Date') %]</td>
-                <td>[% l('Renewals Left') %]</td>
-                <td>[% l('Status') %]</td>
+                <td>[% l('Copy Status') %]</td>
+                <td>[% l('Outcome') %]</td>
             </tr>
         </thead>
         <tbody id='oils-selfck-checkin-tbody'>
@@ -38,8 +38,8 @@
                 <td name='title'></td>
                 <td name='author'></td>
                 <td name='due_date'></td>
-                <td name='remaining'></td>
                 <td name='status'></td>
+                <td name='outcome'></td>
             </tr>
         </tbody>
         <tbody id='oils-selfck-checkin-out-tbody' class='oils-selfck-item-table'></tbody>
index 8c0e5d5..7e8e3a6 100644 (file)
@@ -20,6 +20,7 @@ body {
 
 #oils-selfck-user-details {
     text-align: left;
+    padding-right: 15px;
 }
 
 #oils-selfck-logo-div {
index 7102c65..7202e30 100644 (file)
     "FAIL_PART_transit_range": "The item cannot transit this far",
     "PAYMENT_INVALID_USER_XACT_ID" : "We cannot proceed with the payment, because your account was updated from another location.  Please refresh the interface or log out and back in to retrieve the latest account information",
     "ADDRESS": "${0} ${1}<br/>${2}, ${3} ${4}",
+    "CHECKIN_SUCCESS" : "Successfully checked in ${0}",
+    "CHECKIN_NO_CHANGE" : "No change on checkin for ${0}",
+    "CHECKIN_ROUTE_ITEM" : "Item ${0} should be routed to ${1}",
+    "CHECKOUT_PROMPT" : "Please an item barcode to check out",
+    "CHECKIN_PROMPT" : "Please an item barcode to check in"
 }
 
index 8bb0240..de859a9 100644 (file)
@@ -7,6 +7,7 @@ dojo.require('openils.CGI');
 dojo.require('openils.Util');
 dojo.require('openils.User');
 dojo.require('openils.Event');
+dojo.require('openils.PermaCrud');
 dojo.require('openils.widget.ProgressDialog');
 dojo.require('openils.widget.OrgUnitFilteringSelect');
 
@@ -59,6 +60,8 @@ function SelfCheckManager() {
     // true if we are exposing staff-only features (e.g. checkin)
     this.staffMode = false;
 
+    this.copyStatusMap = {};
+
     // Construct a mock checkout for debugging purposes
     if(this.mockCheckouts = this.cgi.param('mock-circ')) {
 
@@ -126,6 +129,7 @@ SelfCheckManager.prototype.init = function() {
 
     this.setupStaffLogin();
     this.loadOrgSettings();
+    this.loadCopyStatuses();
 
     // are we in staff mode?
     new openils.User().getPermOrgList(['SELFCHECK_STAFF_MODE'], 
@@ -214,6 +218,20 @@ SelfCheckManager.prototype.init = function() {
 }
 
 
+SelfCheckManager.prototype.loadCopyStatuses = function() {
+    var self = this;
+    var pcrud = new openils.PermaCrud();
+    pcrud.retrieveAll('ccs', {
+        async : true,
+        oncomplete : function(r) {
+            var list = openils.Util.readResponse(r);
+            dojo.forEach(list, function(stat) {
+                self.copyStatusMap[stat.id()] = stat;
+            });
+        }
+    });
+};
+
 SelfCheckManager.prototype.getSelectedFinesTotal = function() {
     var total = 0;
     dojo.forEach(
@@ -569,7 +587,7 @@ SelfCheckManager.prototype.drawCircPage = function() {
 
     var self = this;
     this.updateScanBox({
-        msg : 'Please enter an item barcode', // TODO i18n
+        msg : dojo.string.substitute(localeStrings.CHECKOUT_PROMPT),
         handler : function(barcode) { self.checkout(barcode); }
     });
 
@@ -611,7 +629,7 @@ SelfCheckManager.prototype.drawCheckinPage = function() {
 
     var self = this;
     this.updateScanBox({
-        msg : 'Please enter an item barcode', // TODO i18n
+        msg : dojo.string.substitute(localeStrings.CHECKIN_PROMPT),
         handler : function(barcode) { self.checkin(barcode); }
     });
 };
@@ -1064,8 +1082,6 @@ SelfCheckManager.prototype.inlineCheckinCopy = function(barcode, abortTransit) {
         ]}
     );
 
-    // TODO: staffMode : handle/report events better
-    
     if(!resp.length) resp = [resp];
     for(var i = 0; i < resp.length; i++) {
         var tc = openils.Event.parse(resp[i]).textcode;
@@ -1138,7 +1154,7 @@ SelfCheckManager.prototype.failPartMessage = function(result) {
     }
 }
 
-SelfCheckManager.prototype.displayCheckin = function(result, statText) {
+SelfCheckManager.prototype.displayCheckin = function(result, outcomeText) {
     console.log('display checkin results ' + result);
 
     var copy = result.payload.copy;
@@ -1154,10 +1170,10 @@ SelfCheckManager.prototype.displayCheckin = function(result, statText) {
     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;
+    this.byName(row, 'status').innerHTML = this.copyStatusMap[copy.status()].name();
+    this.byName(row, 'outcome').innerHTML = outcomeText || 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'});
@@ -1186,26 +1202,27 @@ SelfCheckManager.prototype.handleCheckinResult = function(item, result) {
 
     } else if (tc == 'SUCCESS') {
 
-        //displayText = dojo.string.substitute(localeStrings.CHECKOUT_SUCCESS, [item]);
-        displayText = 'Checkin Succeeded ' + item; // TODO i18n
+        displayText = dojo.string.substitute(
+            localeStrings.CHECKIN_SUCCESS, [item]);
         this.displayCheckin(result);
 
     } else if (tc == 'NO_CHANGE') {
 
-        displayText = 'No change ' + item; // TODO i18n
+        displayText = dojo.string.substitute(
+            localeStrings.CHECKIN_NO_CHANGE, [item]);
         this.displayCheckin(result);
 
     } else if (tc == 'ROUTE_ITEM') {
 
-        var statText;
+        var outcomeText;
         if (result.source.org) {
             var sn = fieldmapper.aou.findOrgUnit(result.source.org).shortname();
-            displayText = 'Item needs routing to ' + sn; // TODO i18n
-            statText = tc + ' => ' + sn;
-
+            displayText = dojo.string.substitute(
+                localeStrings.CHECKIN_ROUTE_ITEM, [item, sn]);
+            outcomeText = tc + ' => ' + sn;
         }
 
-        this.displayCheckin(result, statText);
+        this.displayCheckin(result, outcomeText);
 
     } else if (tc == 'ASSET_COPY_NOT_FOUND') {