From 1cd6641b0fda805e1fbf3be97d06b5ba16de8472 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 16 Jun 2014 14:54:33 -0400 Subject: [PATCH] checkout receipt Signed-off-by: Bill Erickson --- .../staff/admin/workstation/t_print_templates.tt2 | 7 ++++ .../src/templates/staff/circ/patron/t_checkout.tt2 | 40 +++++++++++++++++----- .../staff/share/print_templates/t_checkout.tt2 | 17 +++++++++ .../js/ui/default/staff/admin/workstation/app.js | 23 ++++++++++--- .../js/ui/default/staff/circ/patron/checkout.js | 16 +++++++++ 5 files changed, 90 insertions(+), 13 deletions(-) create mode 100644 Open-ILS/src/templates/staff/share/print_templates/t_checkout.tt2 diff --git a/Open-ILS/src/templates/staff/admin/workstation/t_print_templates.tt2 b/Open-ILS/src/templates/staff/admin/workstation/t_print_templates.tt2 index 15e07b2a9a..88ee0188ce 100644 --- a/Open-ILS/src/templates/staff/admin/workstation/t_print_templates.tt2 +++ b/Open-ILS/src/templates/staff/admin/workstation/t_print_templates.tt2 @@ -15,6 +15,7 @@ + @@ -39,6 +40,12 @@

[% l('Template') %]

+
+ [% l( + "Unable to load template '[_1]'. The web server returned an error.", + '{{print.template_name}}') + %] +
diff --git a/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 index 48fe012d58..abb054f3bc 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 @@ -61,14 +61,36 @@ main-label="[% l('Checkouts') %]" items-provider="gridDataProvider" persist-key="circ.patron.checkout"> - - - + + - - - - - - + + + + + + + +
+
+
+ + [% l('Auto-Print') %] +
+
+ +
+
+ diff --git a/Open-ILS/src/templates/staff/share/print_templates/t_checkout.tt2 b/Open-ILS/src/templates/staff/share/print_templates/t_checkout.tt2 new file mode 100644 index 0000000000..496fd4cd9d --- /dev/null +++ b/Open-ILS/src/templates/staff/share/print_templates/t_checkout.tt2 @@ -0,0 +1,17 @@ +
+
[% l('Welcome to [_1]', '{{current_location.name}}') %]
+
[% l('You checked out the following items:') %]
+
+
    +
  1. +
    {{circ.title}}
    +
    [% l('Barcode: [_1] Due: [_2]', + '{{circ.target_copy.barcode}}', + '{{circ.due_date | date:"short"}}') %]
    +
  2. +
+
+
{{current_location.shortname}} {{today | date:'short'}}
+
[% l('You were helped by [_1]', '{{staff.first_given_name}}') %]
+
+ diff --git a/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js b/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js index 7e37c4e64c..2a635e88c9 100644 --- a/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js +++ b/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js @@ -364,6 +364,14 @@ function($scope , $q , egCore) { } ], + circulations : [ + { + due_date : new Date().toISOString(), + target_copy : seed_copy, + title : seed_record.title + }, + ], + previous_balance : 8.45, payment_total : 2.00, payment_applied : 2.00, @@ -404,11 +412,18 @@ function($scope , $q , egCore) { $scope.preview_scope.payments[1].xact.copy_barcode = seed_copy.barcode; $scope.template_changed = function() { + $scope.print.load_failed = false; egCore.hatch.getPrintTemplate($scope.print.template_name) - .then(function(html) { - $scope.print.template_content = html; - console.log('set template content'); - }); + .then( + function(html) { + $scope.print.template_content = html; + console.log('set template content'); + }, + function() { + $scope.print.template_content = ''; + $scope.print.load_failed = true; + } + ); } $scope.save_locally = function() { diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js b/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js index 4dd6ea0d75..c9bfc00722 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js @@ -122,5 +122,21 @@ function($scope , $q , $modal , $routeParams , egCore , egUser , patronSvc , payload.circ.due_date(payload.noncat_circ.duedate()); } } + + $scope.print_receipt = function() { + var print_data = { + circulations : [], + staff : egCore.idl.toHash(egCore.auth.user()), + current_location : egCore.idl.toHash( + egCore.org.get(egCore.auth.user().ws_ou())) + } + angular.forEach($scope.checkouts, function(co) { + var circ = egCore.idl.toHash(co.payload.circ); + circ.title = co.payload.record.title; + print_data.circulations.push(circ); + }); + + egCore.hatch.printFromTemplate('default', 'checkout', print_data); + } }]) -- 2.11.0