checkin; mark damaged, abort transit
authorBill Erickson <berick@esilibrary.com>
Wed, 25 Jun 2014 16:06:19 +0000 (12:06 -0400)
committerBill Erickson <berick@esilibrary.com>
Wed, 25 Jun 2014 16:06:19 +0000 (12:06 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/staff/circ/checkin/t_checkin_table.tt2
Open-ILS/src/templates/staff/circ/share/circ_strings.tt2
Open-ILS/web/js/ui/default/staff/circ/checkin/app.js
Open-ILS/web/js/ui/default/staff/circ/services/circ.js

index 79392c1..6b5343f 100644 (file)
     handler="showBackdateDialog"
     label="[% l('Backdate Post-Checkin') %]">
   </eg-grid-action>
+  <eg-grid-action 
+    handler="showMarkDamaged"
+    label="[% l('Mark Items Damaged') %]">
+  </eg-grid-action>
+  <eg-grid-action 
+    handler="abortTransit"
+    label="[% l('Abort Transits') %]">
+  </eg-grid-action>
 
   <eg-grid-field label="[% l('Alert Msg') %]"   
     path="acp.alert_message"></eg-grid-field>
index d317a48..cdc6731 100644 (file)
@@ -23,6 +23,8 @@ s.PRECAT_CHECKIN_MSG =
 s.LOCATION_ALERT_MSG =
   '[% l("Item [_1] needs to be routed to [_2]", 
     "{{copy.barcode()}}","{{copy.location().name()}}") %]';
+s.MARK_DAMAGED_CONFIRM = '[% l("Mark {{num_items}} items as DAMAGED?") %]';
+s.ABORT_TRANSIT_CONFIRM = '[% l("Abort {{num_transits}} transits?") %]';
 }]);
 </script>
 
index f40415c..00be1df 100644 (file)
@@ -246,5 +246,29 @@ function($scope , $q , $window , $location , egCore , checkinSvc , egGridDataPro
         }
     }
 
+    $scope.showMarkDamaged = function(items) {
+        var copy_ids = [];
+        angular.forEach(items, function(item) {
+            if (item.acp) copy_ids.push(item.acp.id());
+        });
+
+        if (copy_ids.length) {
+            egCirc.mark_damaged(copy_ids).then(function() {
+                // update grid items?
+            });
+        }
+    }
+
+    $scope.abortTransit = function(items) {
+        var transit_ids = [];
+        angular.forEach(items, function(item) {
+            if (item.transit) transit_ids.push(item.transit.id());
+        });
+
+        egCirc.abort_transits(transit_ids).then(function() {
+            // update grid items?
+        });
+    }
+
 }])
 
index 1eaa702..b9947e6 100644 (file)
@@ -695,6 +695,63 @@ function($modal , $q , egCore , egAlertDialog , egConfirmDialog) {
         }).result;
     }
 
+    service.mark_damaged = function(copy_ids) {
+        return egConfirmDialog.open(
+            egCore.strings.MARK_DAMAGED_CONFIRM, '',
+            {   num_items : copy_ids.length,
+                ok : function() {},
+                cancel : function() {}
+            }
+
+        ).result.then(function() {
+            var promises = [];
+            angular.forEach(copy_ids, function(copy_id) {
+                promises.push(
+                    egCore.net.request(
+                        'open-ils.circ',
+                        'open-ils.circ.mark_item_damaged',
+                        egCore.auth.token(), copy_id
+                    ).then(function(resp) {
+                        if (evt = egCore.evt.parse(resp)) {
+                            console.error('mark damaged failed: ' + evt);
+                        }
+                    })
+                );
+            });
+
+            return $q.all(promises);
+        });
+    }
+
+    service.abort_transits = function(transit_ids) {
+        return egConfirmDialog.open(
+            egCore.strings.ABORT_TRANSIT_CONFIRM, '',
+            {   num_transits : transit_ids.length,
+                ok : function() {},
+                cancel : function() {}
+            }
+
+        ).result.then(function() {
+            var promises = [];
+            angular.forEach(transit_ids, function(transit_id) {
+                promises.push(
+                    egCore.net.request(
+                        'open-ils.circ',
+                        'open-ils.circ.transit.abort',
+                        egCore.auth.token(), {transitid : transit_id}
+                    ).then(function(resp) {
+                        if (evt = egCore.evt.parse(resp)) {
+                            console.error('abort transit failed: ' + evt);
+                        }
+                    })
+                );
+            });
+
+            return $q.all(promises);
+        });
+    }
+
+
 
     // alert when copy location alert_message is set.
     // This does not affect processing, it only produces a click-through