items out : check in, renew w/ date; add billing
authorBill Erickson <berick@esilibrary.com>
Tue, 1 Jul 2014 20:34:26 +0000 (16:34 -0400)
committerBill Erickson <berick@esilibrary.com>
Tue, 1 Jul 2014 20:34:26 +0000 (16:34 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/staff/circ/patron/index.tt2
Open-ILS/src/templates/staff/circ/patron/t_items_out.tt2
Open-ILS/src/templates/staff/circ/patron/t_renew_with_date_dialog.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/circ/share/t_event_override_dialog.tt2
Open-ILS/web/js/ui/default/staff/circ/patron/items_out.js
Open-ILS/web/js/ui/default/staff/circ/services/circ.js
Open-ILS/web/js/ui/default/staff/services/ui.js

index 9d9a809..54258a0 100644 (file)
@@ -37,6 +37,7 @@ angular.module('egCoreMod').run(['egStrings', function(s) {
   s.GROUP_ADD_USER = "[% l('Enter the patron barcode') %]";
   s.RENEW_ITEMS = "[% l('Renew Items?') %]";
   s.RENEW_ALL_ITEMS = "[% l('Renew All Items?') %]";
+  s.CHECK_IN_CONFIRM = "[% l('Check In Items?') %]";
 }]);
 </script>
 
index 32cb268..6113065 100644 (file)
     label="[% l('Mark Claims Never Checked Out') %]"></eg-grid-action>
   <eg-grid-action handler="renew" label="[% l('Renew') %]"></eg-grid-action>
   <eg-grid-action handler="renew_all" label="[% l('Renew All') %]"></eg-grid-action>
+  <eg-grid-action handler="renew_with_date" 
+    label="[% l('Renew With Specific Due Date') %]"></eg-grid-action>
+  <eg-grid-action handler="checkin" 
+    label="[% l('Check In') %]"></eg-grid-action>
+  <eg-grid-action handler="add_billing" 
+    label="[% l('Add Billing') %]"></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'>
diff --git a/Open-ILS/src/templates/staff/circ/patron/t_renew_with_date_dialog.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_renew_with_date_dialog.tt2
new file mode 100644 (file)
index 0000000..d8112d0
--- /dev/null
@@ -0,0 +1,24 @@
+<div class="modal-header">
+  <button type="button" class="close" 
+    ng-click="cancel()" aria-hidden="true">&times;</button>
+  <h4 class="modal-title">
+    [% l('Renew Items with Specific Due Date') %]
+  </h4>
+</div>
+<div class="modal-body">
+  <div class="pad-vert row">
+    <div class="col-md-12">
+      [% l('Enter due date for items: [_1]', '{{args.barcodes.join(" ")}}') %]
+    </div>
+  </div>
+  <div class="pad-vert row">
+    <div class="col-md-5">
+      <input eg-date-input required 
+        class="form-control" ng-model="args.date"/>
+    </div>
+  </div>
+</div>
+<div class="modal-footer">
+  <button class="btn btn-primary" ng-click="ok()">[% l('Submit') %]</button>
+  <button class="btn btn-warning" ng-click="cancel()">[% l('Cancel') %]</button>
+</div>
index fd19858..5850ac5 100644 (file)
@@ -9,7 +9,10 @@
   <div class="modal-body">
     <div class="panel panel-danger">
       <div class="panel-heading">{{evt.textcode}}</div>
-      <div class="panel-body">{{evt.desc}}</div>
+      <div class="panel-body">
+        <div ng-if="copy_barcode" class="strong-text-2">{{copy_barcode}}</div>
+        {{evt.desc}}
+      </div>
     </div>
   </div>
   <div class="modal-footer">
index 71cc6a3..75c8c2f 100644 (file)
@@ -5,9 +5,9 @@
 angular.module('egPatronApp').controller('PatronItemsOutCtrl',
 
        ['$scope','$q','$routeParams','egCore','egUser','patronSvc',
-        'egGridDataProvider','$modal','egCirc','egConfirmDialog',
+        'egGridDataProvider','$modal','egCirc','egConfirmDialog','egBilling',
 function($scope,  $q,  $routeParams,  egCore , egUser,  patronSvc , 
-         egGridDataProvider , $modal , egCirc , egConfirmDialog) {
+         egGridDataProvider , $modal , egCirc , egConfirmDialog , egBilling) {
 
     $scope.initTab('items_out', $routeParams.id);
 
@@ -245,7 +245,6 @@ function($scope,  $q,  $routeParams,  egCore , egUser,  patronSvc ,
 
     $scope.renew = function(items, msg) {
         if (!items.length) return;
-
         var barcodes = items.map(function(circ) 
             { return circ.target_copy().barcode() });
 
@@ -265,8 +264,8 @@ function($scope,  $q,  $routeParams,  egCore , egUser,  patronSvc ,
 
     $scope.renew_all = function() {
         var circs = patronSvc.items_out.filter(function(circ) {
-            // all others will be rejected at the server
             return (
+                // all others will be rejected at the server
                 !circ.stop_fines() ||
                 circ.stop_fines() == 'MAXFINES'
             );
@@ -274,5 +273,84 @@ function($scope,  $q,  $routeParams,  egCore , egUser,  patronSvc ,
         $scope.renew(circs, egCore.strings.RENEW_ALL_ITEMS);
     }
 
+    $scope.renew_with_date = function(items) {
+        if (!items.length) return;
+        var barcodes = items.map(function(circ) 
+            { return circ.target_copy().barcode() });
+
+        return $modal.open({
+            templateUrl : './circ/patron/t_edit_due_date_dialog',
+            templateUrl : './circ/patron/t_renew_with_date_dialog',
+            controller : [
+                        '$scope','$modalInstance',
+                function($scope , $modalInstance) {
+                    $scope.args = {
+                        barcodes : barcodes,
+                        date : new Date()
+                    }
+                    $scope.cancel = function() {$modalInstance.dismiss()}
+
+                    // Fire off the due-date updater for each circ.
+                    // When all is done, close the dialog
+                    $scope.ok = function() {
+                        var due = $scope.args.date.toISOString().replace(/T.*/,'');
+                        console.debug("renewing with due date: " + due);
+
+                        function do_one() {
+                            if (bc = barcodes.pop()) {
+                                egCirc.renew({copy_barcode : bc, due_date : due})
+                                .finally(do_one);
+                            } else {
+                                $modalInstance.close(); 
+                                reset_page();
+                            }
+                        }
+                       do_one(); // kick it off
+                    }
+                }
+            ]
+        }).result;
+    }
+
+    $scope.checkin = function(items) {
+        if (!items.length) return;
+        var barcodes = items.map(function(circ) 
+            { return circ.target_copy().barcode() });
+
+        return egConfirmDialog.open(
+            egCore.strings.CHECK_IN_CONFIRM, barcodes.join(' '), {
+
+        }).result.then(function() {
+            function do_one() {
+                if (bc = barcodes.pop()) {
+                    egCirc.checkin({copy_barcode : bc})
+                    .finally(do_one);
+                } else {
+                    reset_page();
+                }
+            }
+            do_one(); // kick it off
+        });
+    }
+
+    $scope.add_billing = function(items) {
+        if (!items.length) return;
+        var circs = items.concat(); // don't pop from grid array
+        function do_one() {
+            var circ; // don't clobber window.circ!
+            if (circ = circs.pop()) {
+                egBilling.showBillDialog({
+                    // let the dialog fetch the transaction, since it's
+                    // not sufficiently fleshed here.
+                    xact_id : circ.id(),
+                    patron : patronSvc.current
+                }).finally(do_one);
+            } else {
+                reset_page();
+            }
+        }
+        do_one();
+    }
+
 }]);
 
index 6f89d8a..c2900e8 100644 (file)
@@ -567,6 +567,7 @@ function($modal , $q , egCore , egAlertDialog , egConfirmDialog) {
                 $scope.evt = evt;
                 $scope.auto_override = 
                     service.checkout_auto_override_after_first.indexOf(evt.textcode) > -1;
+                $scope.copy_barcode = params.copy_barcode; // may be null
                 $scope.ok = function() { $modalInstance.close() }
                 $scope.cancel = function ($event) { 
                     $modalInstance.dismiss();
index d2e83ac..f5602cb 100644 (file)
@@ -130,7 +130,7 @@ function($modal, $interpolate) {
                     }
                     $scope.cancel = function() {
                         if (msg_scope.cancel) msg_scope.cancel();
-                        $modalInstance.close()
+                        $modalInstance.dismiss();
                     }
                 }
             ]
@@ -171,7 +171,7 @@ function($modal, $interpolate) {
                     }
                     $scope.cancel = function() {
                         if (msg_scope.cancel) msg_scope.cancel();
-                        $modalInstance.close()
+                        $modalInstance.dismiss();
                     }
                 }
             ]