JBAS-1981 SCKO Total/session items out count
authorBill Erickson <berickxx@gmail.com>
Tue, 6 Feb 2018 16:43:18 +0000 (11:43 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
KCLS/openils/var/templates_kcls/circ/selfcheck/circ_page.tt2
Open-ILS/web/js/ui/kcls/circ/selfcheck/selfcheck.js

index 8f551a4..50c7301 100644 (file)
@@ -1,6 +1,12 @@
 <div class="row">
-  <div class="col-md-offset-4 col-xs-9 col-md-8"><label>Items Checked Out</label></div>
+  <div class="col-md-offset-2 col-xs-9 col-md-8">
+    <label>Items Checked Out</label>
+    <span style='padding-left: 10px'><b>Now: </b>
+      <span id='oils-selfck-circ-session-total'></span></span>
+    <span style='padding-left: 10px'><b>All: </b>
+      <span id='oils-selfck-circ-account-total'></span></span>
   </div>
+</div>
 <div class="row">
   <div class="col-md-offset-1 col-md-5 pad-vert-btn">
     <a href="javascript:;" onclick="selfCheckMgr.printList('items_out');" class="btn btn-success scko-action-btn">
index 30d71c6..bd58b03 100644 (file)
@@ -606,8 +606,7 @@ SelfCheckManager.prototype.drawItemsOutPage = function() {
     dojo.byId('scko-renewal-alerts').innerHTML = '';
 
     // Reset items checked out in case it changed
-    this.circSummary = undefined;
-    this.updateCircSummary();
+    this.updateCircSummary(false, true);
 
     if(!this.outTemplate)
         this.outTemplate = this.itemsOutTbody.removeChild(dojo.byId('oils-selfck-circ-out-row'));
@@ -820,8 +819,12 @@ SelfCheckManager.prototype.updateHoldsSummary = function() {
 }
 
 
-SelfCheckManager.prototype.updateCircSummary = function(increment) {
-    if(!this.circSummary) {
+SelfCheckManager.prototype.updateCircSummary = function(increment, force) {
+
+    if (!this.circSummary || force) {
+        
+        // Avoid clobbering the session counts so for on a force refresh
+        var sessionCount = this.circSummary ? this.circSummary.session : 0;
 
         var summary = fieldmapper.standardRequest(
             ['open-ils.actor', 'open-ils.actor.user.checked_out.count'],
@@ -831,15 +834,24 @@ SelfCheckManager.prototype.updateCircSummary = function(increment) {
         this.circSummary = {
             total : Number(summary.out) + Number(summary.overdue),
             overdue : Number(summary.overdue),
-            session : 0
+            session : sessionCount
         };
     }
 
-    if(increment) {
+    if (increment) {
         // local checkout occurred.  Add to the total and the session.
         this.circSummary.total += 1;
         this.circSummary.session += 1;
+
+        console.log('incrementing circ totals total='+
+            this.circSummary.total+'; session=' + this.circSummary.session);
     }
+
+    dojo.byId('oils-selfck-circ-account-total')
+        .innerHTML = this.circSummary.total;
+
+    dojo.byId('oils-selfck-circ-session-total')
+        .innerHTML = this.circSummary.session;
 }