From 14ea9f1eefc2f31926f4629294c3c6b30eb09bbe Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 8 Dec 2009 21:21:03 +0000 Subject: [PATCH] plugged in holds list printing and progress dialog while waiting for template generation git-svn-id: svn://svn.open-ils.org/ILS/trunk@15107 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../web/js/ui/default/circ/selfcheck/selfcheck.js | 68 +++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js b/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js index f6b91a5f13..96e4a8058d 100644 --- a/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js +++ b/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js @@ -397,7 +397,7 @@ SelfCheckManager.prototype.goToTab = function(name) { openils.Util.hide('oils-selfck-payment-page'); openils.Util.hide('oils-selfck-holds-page'); - openils.Util.show('oils-selfck-circ-page'); + openils.Util.hide('oils-selfck-circ-page'); switch(name) { case 'checkout': @@ -558,6 +558,8 @@ SelfCheckManager.prototype.drawHolds = function(holds) { } ); + this.holds = holds; + progressDialog.hide(); for(var i in holds) { @@ -963,6 +965,8 @@ SelfCheckManager.prototype.printItemsOutReceipt = function(callback) { if(!this.itemsOut.length) return; + progressDialog.show(true); + var params = [ this.authtoken, this.staff.ws_ou(), @@ -979,6 +983,7 @@ SelfCheckManager.prototype.printItemsOutReceipt = function(callback) { async : true, params : params, oncomplete : function(r) { + progressDialog.hide(); var resp = openils.Util.readResponse(r); var output = resp.template_output(); if(output) { @@ -996,6 +1001,67 @@ SelfCheckManager.prototype.printItemsOutReceipt = function(callback) { ); } +/** + * Print a receipt for this user's items out + */ +SelfCheckManager.prototype.printHoldsReceipt = function(callback) { + + if(!this.holds.length) return; + + progressDialog.show(true); + + var holdIds = []; + var holdData = []; + + dojo.forEach(this.holds, + function(data) { + holdIds.push(data.hold.id()); + if(data.status == 4) { + holdData.push({ready : true}); + } else { + holdData.push({ + queue_position : data.queue_position, + potential_copies : data.potential_copies + }); + } + } + ); + + var params = [ + this.authtoken, + this.staff.ws_ou(), + null, + 'format.selfcheck.holds', + 'print-on-demand', + holdIds, + holdData + ]; + + var self = this; + fieldmapper.standardRequest( + ['open-ils.circ', 'open-ils.circ.fire_hold_trigger_events'], + { + async : true, + params : params, + oncomplete : function(r) { + progressDialog.hide(); + var resp = openils.Util.readResponse(r); + var output = resp.template_output(); + if(output) { + self.printData(output.data(), self.holds.length, callback); + } else { + var error = resp.error_output(); + if(error) { + throw new Error("Error creating receipt: " + error.data()); + } else { + throw new Error("No receipt data returned from server"); + } + } + } + } + ); +} + -- 2.11.0