items out print; initial edit due date
authorBill Erickson <berick@esilibrary.com>
Mon, 30 Jun 2014 21:33:52 +0000 (17:33 -0400)
committerBill Erickson <berick@esilibrary.com>
Mon, 30 Jun 2014 21:33:52 +0000 (17:33 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/staff/circ/patron/t_edit_due_date_dialog.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/circ/patron/t_items_out.tt2
Open-ILS/src/templates/staff/circ/patron/t_new_message_dialog.tt2
Open-ILS/src/templates/staff/share/print_templates/t_items_out.tt2 [new file with mode: 0644]
Open-ILS/web/js/ui/default/staff/circ/patron/items_out.js

diff --git a/Open-ILS/src/templates/staff/circ/patron/t_edit_due_date_dialog.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_edit_due_date_dialog.tt2
new file mode 100644 (file)
index 0000000..338c3e9
--- /dev/null
@@ -0,0 +1,20 @@
+<form ng-submit="ok(args)" role="form">
+  <div class="modal-header">
+    <button type="button" class="close" ng-click="cancel()" 
+      aria-hidden="true">&times;</button>
+    <h4 class="modal-title">
+      [% l('Edit Due Date For [_1] Items', '{{args.num_circs}}') %]
+    </h4>
+  </div>
+  <div class="modal-body">
+    <div class="form-group row pad-vert">
+      <div class="col-md-6">
+        <input eg-date-input class="form-control" ng-model="args.due_date"/>
+      </div>
+    </div>
+  </div>
+  <div class="modal-footer">
+    <input type="submit" class="btn btn-primary" value="[% l('OK') %]"/>
+    <button class="btn btn-warning" ng-click="cancel($event)">[% l('Cancel') %]</button>
+  </div>
+</form>
index b8d00e9..887d433 100644 (file)
@@ -7,6 +7,16 @@
   main-label="[% l('Items Checked Out') %]"
   items-provider="gridDataProvider"
   persist-key="circ.patron.items_out">
+
+  <eg-grid-action 
+    handler="print_receipt"
+    label="[% l('Print Item Receipt') %]">
+  </eg-grid-action>
+  <eg-grid-action 
+    handler="edit_due_date"
+    label="[% l('Edit Due Date') %]">
+  </eg-grid-action>
+
   <eg-grid-field label="[% l('Circ ID') %]" path='id'></eg-grid-field>
   <eg-grid-field label="[% l('Barcode') %]" path='target_copy.barcode'>
     <a href="./cat/item/{{item.target_copy().id()}}" target="_self">
index 5f6ebab..d3555a0 100644 (file)
@@ -42,5 +42,4 @@
       <input type="submit" class="btn btn-primary" value="[% l('OK') %]"/>
       <button class="btn btn-warning" ng-click="cancel()">[% l('Cancel') %]</button>
     </div>
-  </div> <!-- modal-content -->
 </form>
diff --git a/Open-ILS/src/templates/staff/share/print_templates/t_items_out.tt2 b/Open-ILS/src/templates/staff/share/print_templates/t_items_out.tt2
new file mode 100644 (file)
index 0000000..fee903b
--- /dev/null
@@ -0,0 +1,17 @@
+<div>
+  <div>[% l('Welcome to [_1]', '{{current_location.name}}') %]</div>
+  <div>[% l('You have the following items:') %]</div>
+  <hr/>
+  <ol>
+    <li ng-repeat="checkout in circulations">
+      <div>{{checkout.title}}</div>
+      <div>[% l('Barcode: [_1] Due: [_2]', 
+        '{{checkout.copy.barcode}}',
+        '{{checkout.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 d80e022..dff599b 100644 (file)
@@ -4,8 +4,8 @@
 
 angular.module('egPatronApp').controller('PatronItemsOutCtrl',
 
-       ['$scope','$q','$routeParams','egCore','egUser','patronSvc','egGridDataProvider',
-function($scope,  $q,  $routeParams,  egCore , egUser,  patronSvc , egGridDataProvider) {
+       ['$scope','$q','$routeParams','egCore','egUser','patronSvc','egGridDataProvider','$modal',
+function($scope,  $q,  $routeParams,  egCore , egUser,  patronSvc , egGridDataProvider , $modal) {
 
     $scope.initTab('items_out', $routeParams.id);
     
@@ -108,5 +108,50 @@ function($scope,  $q,  $routeParams,  egCore , egUser,  patronSvc , egGridDataPr
         date.setTime(Date.parse(circ.due_date()));
         return date < new Date();
     }
+
+    $scope.edit_due_date = function(items) {
+        $modal.open({
+            templateUrl : './circ/patron/t_edit_due_date_dialog',
+            controller : [
+                        '$scope','$modalInstance',
+                function($scope , $modalInstance) {
+                    $scope.args = {
+                        num_circs : items.length,
+                        due_date : new Date()
+                    }
+                    $scope.ok = function(args) {
+                        // TODO open-ils.circ.circulation.due_date.update (circ_id, date)
+                        $modalInstance.close();
+                    }
+                    $scope.cancel = function($event) {
+                        $modalInstance.dismiss();
+                        $event.preventDefault();
+                    }
+                }
+            ]
+        });
+    }
+
+    $scope.print_receipt = function(items) {
+        if (items.length == 0) return $q.when();
+        var print_data = {circulations : []}
+
+        angular.forEach(patronSvc.items_out, function(circ) {
+            print_data.circulations.push({
+                circ : egCore.idl.toHash(circ),
+                copy : egCore.idl.toHash(circ.target_copy()),
+                call_number : egCore.idl.toHash(circ.target_copy().call_number()),
+                title : circ.target_copy().call_number().record().simple_record().title(),
+                author : circ.target_copy().call_number().record().simple_record().author(),
+            })
+        });
+
+        return egCore.print.print({
+            context : 'default', 
+            template : 'items_out', 
+            scope : print_data,
+        });
+    }
+
 }]);