checkout receipt
authorBill Erickson <berick@esilibrary.com>
Mon, 16 Jun 2014 18:54:33 +0000 (14:54 -0400)
committerBill Erickson <berick@esilibrary.com>
Mon, 16 Jun 2014 18:54:33 +0000 (14:54 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/staff/admin/workstation/t_print_templates.tt2
Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2
Open-ILS/src/templates/staff/share/print_templates/t_checkout.tt2 [new file with mode: 0644]
Open-ILS/web/js/ui/default/staff/admin/workstation/app.js
Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js

index 15e07b2..88ee018 100644 (file)
@@ -15,6 +15,7 @@
       <option value="bills_current">[% l('Bills, Current') %]</option>
       <option value="bills_historical">[% l('Bills, Historical') %]</option>
       <option value="bill_payment">[% l('Bills, Payment') %]</option>
+      <option value="checkout">[% l('Checkout') %]</option>
       <option value="patron_address">[% l('Patron Address') %]</option>
       <option value="patron_note">[% l('Patron Note') %]</option>
       <option value="transit_slip">[% l('Transit Slip') %]</option>
   </div>
   <div class="col-md-7">
     <h3>[% l('Template') %]</h3>
+    <div ng-if="print.load_failed" class="alert alert-danger">
+      [% l(
+        "Unable to load template '[_1]'.  The web server returned an error.", 
+        '{{print.template_name}}') 
+      %]
+    </div>
     <div>
       <textarea ng-model="print.template_content" class="print-template-text">
       </textarea>
index 48fe012..abb054f 100644 (file)
   main-label="[% l('Checkouts') %]"
   items-provider="gridDataProvider"
   persist-key="circ.patron.checkout">
-  <eg-grid-field label="[% l('Barcode') %]"     path='copy_barcode' visible></eg-grid-field>
-  <eg-grid-field label="[% l('Circ ID') %]"     path='payload.circ.id' visible></eg-grid-field>
-  <eg-grid-field label="[% l('Due Date') %]"    path='payload.circ.due_date' 
+  <eg-grid-field label="[% l('Barcode') %]"     
+    path='copy_barcode' visible></eg-grid-field>
+  <eg-grid-field label="[% l('Circ ID') %]"     
+    path='payload.circ.id' visible></eg-grid-field>
+  <eg-grid-field label="[% l('Due Date') %]"    
+    path='payload.circ.due_date' 
     visible datatype="timestamp" dateformat="short"></eg-grid-field>
-  <eg-grid-field label="[% l('Response') %]"    path='textcode' visible></eg-grid-field>
-  <eg-grid-field label="[% l('Title') %]"       path='payload.record.title' visible></eg-grid-field>
-  <eg-grid-field label="[% l('Author') %]"      path='payload.record.author' visible></eg-grid-field>
-  <eg-grid-field label="[% l('Call Number') %]" path='payload.copy.call_number.label' visible></eg-grid-field>
-  <eg-grid-field label="[% l('Alert Msg') %]"   path='payload.copy.alert_message' visible></eg-grid-field>
-  <eg-grid-field label="[% l('Noncat #') %]"    path='noncat_count' visible></eg-grid-field>
+  <eg-grid-field label="[% l('Response') %]"    
+    path='textcode' visible></eg-grid-field>
+  <eg-grid-field label="[% l('Title') %]"       
+    path='payload.record.title' visible></eg-grid-field>
+  <eg-grid-field label="[% l('Author') %]"      
+    path='payload.record.author' visible></eg-grid-field>
+  <eg-grid-field label="[% l('Call Number') %]" 
+    path='payload.copy.call_number.label' visible></eg-grid-field>
+  <eg-grid-field label="[% l('Alert Msg') %]"   
+    path='payload.copy.alert_message' visible></eg-grid-field>
+  <eg-grid-field label="[% l('Noncat #') %]"    
+    path='noncat_count' visible></eg-grid-field>
 </eg-grid>
+
+<div class="flex-row pad-vert">
+  <div class="flex-cell"></div>
+  <div class="pad-horiz">
+    <input ng-model="auto_print" type="checkbox"/>
+    [% l('Auto-Print') %]
+  </div>
+  <div>
+    <button class="btn btn-default" 
+      ng-click="print_receipt()">[% l('Print Receipt') %]</button>
+  </div>
+</div>
+
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 (file)
index 0000000..496fd4c
--- /dev/null
@@ -0,0 +1,17 @@
+<div>
+  <div>[% l('Welcome to [_1]', '{{current_location.name}}') %]</div>
+  <div>[% l('You checked out the following items:') %]</div>
+  <hr/>
+  <ol>
+    <li ng-repeat="circ in circulations">
+      <div>{{circ.title}}</div>
+      <div>[% l('Barcode: [_1] Due: [_2]', 
+        '{{circ.target_copy.barcode}}',
+        '{{circ.due_date | date:"short"}}') %]</div>
+    </li>
+  </ol>
+  <hr/>
+  <div>{{current_location.shortname}} {{today | date:'short'}}</div>
+  <div>[% l('You were helped by [_1]', '{{staff.first_given_name}}') %]</div>
+<br/>
+
index 7e37c4e..2a635e8 100644 (file)
@@ -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() {
index 4dd6ea0..c9bfc00 100644 (file)
@@ -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);
+    }
 }])