LP#1685929-Adds more XUL parity to Webstaff checkIn
authorCesar Velez <Cesar.Velez@equinoxinitiative.org>
Fri, 11 Aug 2017 15:00:29 +0000 (16:00 +0100)
committerGalen Charlton <gmc@equinoxinitiative.org>
Fri, 25 Aug 2017 19:52:21 +0000 (15:52 -0400)
Checkin Grid context actions like Add Items to Bucket, Show Holds on Bib, Show
Last Few Circulations, Edit Item Attributes, Mark Item Missing Pieces,
Print Spine Label, were missing from CheckIn in webstaff.

Signed-off by: Cesar Velez <cesar.velez@equinoxinitiative.org>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>

Conflicts:
Open-ILS/web/js/ui/default/staff/cat/item/app.js

Open-ILS/src/templates/staff/circ/checkin/index.tt2
Open-ILS/src/templates/staff/circ/checkin/t_checkin_table.tt2
Open-ILS/web/js/ui/default/staff/cat/item/app.js
Open-ILS/web/js/ui/default/staff/circ/checkin/app.js

index dd2c0cf..4bc925d 100644 (file)
@@ -9,7 +9,18 @@
 <script src="[% ctx.media_prefix %]/js/ui/default/staff/services/ui.js"></script>
 <script src="[% ctx.media_prefix %]/js/ui/default/staff/services/user.js"></script>
 <script src="[% ctx.media_prefix %]/js/ui/default/staff/circ/services/circ.js"></script>
+<script>
+angular.module('egCoreMod').run(['egStrings', function(s) {
+s.CONFIRM_MARK_MISSING_TITLE = "[% l('Mark item as missing pieces?') %]";
+s.CONFIRM_MARK_MISSING_BODY =
+  "[% l('[_1] / [_2]', '{{barcode}}', '{{title}}') %]";
+s.CIRC_NOT_FOUND =
+  "[% l('No circulation found for item with barcode [_1].  Item not modified.', '{{barcode}}') %]"
+}])
+</script>
+
 [% INCLUDE 'staff/circ/share/circ_strings.tt2' %]
+<script src="[% ctx.media_prefix %]/js/ui/default/staff/cat/item/app.js"></script>
 <script src="[% ctx.media_prefix %]/js/ui/default/staff/circ/checkin/app.js"></script>
 <link rel="stylesheet" href="[% ctx.base_path %]/staff/css/circ.css" />
 [% END %]
index 0066cb3..5978e7b 100644 (file)
@@ -8,7 +8,9 @@
   grid-controls="gridControls"
   persist-key="{{grid_persist_key}}"
   dateformat="{{$root.egDateAndTimeFormat}}">
-
+  
+  <eg-grid-action handler="add_copies_to_bucket" label="[% l('Add Items to Bucket') %]">
+  </eg-grid-action>
   <eg-grid-action 
     handler="fetchLastCircPatron"
     label="[% l('Retrieve Last Patron Who Circulated Item') %]">
     handler="showBackdateDialog"
     label="[% l('Backdate Post-Checkin') %]">
   </eg-grid-action>
-  <eg-grid-action 
+  <eg-grid-action
+    group="[% l('Show')"
     handler="showMarkDamaged"
     label="[% l('Mark Items Damaged') %]">
   </eg-grid-action>
+  <eg-grid-action
+    group="[% l('Show')"
+    handler="show_mark_missing_pieces"
+    label="[% l('Mark Missing Pieces') %]">
+  </eg-grid-action>
   <eg-grid-action 
     handler="abortTransit"
     label="[% l('Cancel Transits') %]">
   </eg-grid-action>
+  <!-- Show Group -->
+  <eg-grid-action handler="showBibHolds" group="[% l('Show') %]"
+    label="[% l('Record Holds') %]">
+  </eg-grid-action>
+  <eg-grid-action handler="showLastCircs" group="[% l('Show') %]"
+    label="[% l('Last Few Circs') %]">
+  </eg-grid-action>
+
+  <!-- Edit Group -->
+  <eg-grid-action handler="selectedHoldingsVolCopyEdit" group="[% l('Edit') %]"
+    label="[% l('Volumes and Items') %]">
+  </eg-grid-action>
 
+  <eg-grid-action handler="printSpineLabels" group="[% l('Print') %]"
+    label="[% l('Spine Labels') %]">
+  </eg-grid-action>
   <eg-grid-field label="[% l('Alert Msg') %]"   
     path="acp.alert_message"></eg-grid-field>
 
index 65737ad..be24fd8 100644 (file)
@@ -48,8 +48,8 @@ angular.module('egItemStatus',
 })
 
 .factory('itemSvc', 
-       ['egCore','egCirc','$uibModal','$q','$timeout','$window','egConfirmDialog',
-function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog ) {
+       ['egCore','egCirc','$uibModal','$q','$timeout','$window','egConfirmDialog','egAlertDialog',
+function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog, egAlertDialog ) {
 
     var service = {
         copies : [], // copy barcode search results
@@ -104,10 +104,12 @@ function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog
         return egCore.pcrud.retrieve( 'acp', id, service.flesh)
             .then(function(copy) {return copy});
     }
+
     service.getCirc = function(id) {
         return egCore.pcrud.search('aacs', { target_copy : id },
             service.circFlesh).then(function(circ) {return circ});
     }
+
     service.getSummary = function(id) {
         return circ_summary = egCore.net.request(
             'open-ils.circ',
@@ -876,6 +878,59 @@ function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog
         }
     }
 
+    service.mark_missing_pieces = function(copy) {
+        var b = copy.barcode();
+        var t = egCore.idl.toHash(copy.call_number()).record.title;
+        egConfirmDialog.open(
+            egCore.strings.CONFIRM_MARK_MISSING_TITLE,
+            egCore.strings.CONFIRM_MARK_MISSING_BODY,
+            { barcode : b, title : t }
+        ).result.then(function() {
+
+            // kick off mark missing
+            return egCore.net.request(
+                'open-ils.circ',
+                'open-ils.circ.mark_item_missing_pieces',
+                egCore.auth.token(), copy.id()
+            )
+
+        }).then(function(resp) {
+            var evt = egCore.evt.parse(resp); // should always produce event
+
+            if (evt.textcode == 'ACTION_CIRCULATION_NOT_FOUND') {
+                return egAlertDialog.open(
+                    egCore.strings.CIRC_NOT_FOUND, {barcode : copy.barcode()});
+            }
+
+            var payload = evt.payload;
+
+            // TODO: open copy editor inline?  new tab?
+
+            // print the missing pieces slip
+            var promise = $q.when();
+            if (payload.slip) {
+                // wait for completion, since it may spawn a confirm dialog
+                promise = egCore.print.print({
+                    context : 'default',
+                    content_type : 'text/html',
+                    content : payload.slip.template_output().data()
+                });
+            }
+
+            if (payload.letter) {
+                $scope.letter = payload.letter.template_output().data();
+            }
+
+            // apply patron penalty
+            if (payload.circ) {
+                promise.then(function() {
+                    egCirc.create_penalty(payload.circ.usr())
+                });
+            }
+
+        });
+    }
+
     return service;
 }])
 
index 099b1be..8f2fb50 100644 (file)
@@ -1,5 +1,5 @@
 angular.module('egCheckinApp', ['ngRoute', 'ui.bootstrap', 
-    'egCoreMod', 'egUiMod', 'egGridMod', 'egUserMod'])
+    'egCoreMod', 'egUiMod', 'egGridMod', 'egUserMod', 'egItemStatus'])
 
 .config(function($routeProvider, $locationProvider, $compileProvider) {
     $locationProvider.html5Mode(true);
@@ -34,8 +34,8 @@ angular.module('egCheckinApp', ['ngRoute', 'ui.bootstrap',
  * Manages checkin
  */
 .controller('CheckinCtrl',
-       ['$scope','$q','$window','$location','egCore','checkinSvc','egGridDataProvider','egCirc',
-function($scope , $q , $window , $location , egCore , checkinSvc , egGridDataProvider , egCirc)  {
+       ['$scope','$q','$window','$location', '$timeout','egCore','checkinSvc','egGridDataProvider','egCirc', 'itemSvc',
+function($scope , $q , $window , $location , $timeout , egCore , checkinSvc , egGridDataProvider , egCirc, itemSvc)  {
 
     $scope.focusMe = true;
     $scope.checkins = checkinSvc.checkins;
@@ -326,5 +326,53 @@ function($scope , $q , $window , $location , egCore , checkinSvc , egGridDataPro
         });
     }
 
+    $scope.add_copies_to_bucket = function(items){
+        var itemsIds = [];
+        angular.forEach(items, function(cp){
+            itemsIds.push(cp.acp.id());
+        });
+
+        itemSvc.add_copies_to_bucket(itemsIds);
+    }
+
+    $scope.showBibHolds = function(items){
+        var recordIds = [];
+        angular.forEach(items, function(i){
+            recordIds.push(i.acn.record());
+        });
+        angular.forEach(recordIds, function (r) {
+            var url = egCore.env.basePath + 'cat/catalog/record/' + r + '/holds';
+            $timeout(function() { $window.open(url, '_blank') });
+        });
+    }
+
+    $scope.showLastCircs = function(items){
+        var itemIds = [];
+        angular.forEach(items, function(cp){
+            itemIds.push(cp.acp.id());
+        });
+        angular.forEach(itemIds, function (id) {
+            var url = egCore.env.basePath + 'cat/item/' + id + '/circs';
+            $timeout(function() { $window.open(url, '_blank') });
+        });
+    }
+
+    $scope.selectedHoldingsVolCopyEdit = function (items) {
+        var itemObjs = [];
+        angular.forEach(items, function(i){
+            var h = egCore.idl.toHash(i);
+            h['call_number.record.id'] = h.record.doc_id;
+            itemObjs.push(h);
+        });
+        itemSvc.spawnHoldingsEdit(itemObjs,false,false);
+    }
+
+    $scope.show_mark_missing_pieces = function(items){
+        angular.forEach(items, function(i){
+            i.acp.call_number(i.acn);
+            i.acp.call_number().record(i.record);
+            itemSvc.mark_missing_pieces(i.acp);
+        });
+    }
 }])