LP#1537233 Copy bucket handles mis-scans, improve focus
authorBill Erickson <berickxx@gmail.com>
Fri, 15 Sep 2017 19:08:47 +0000 (15:08 -0400)
committerKathy Lussier <klussier@masslnc.org>
Mon, 18 Sep 2017 19:16:26 +0000 (15:16 -0400)
Show warning message to user when an unknown barcode is scanned in the
copy bucket pending list UI.  Also, after a barcode failure occurs, select
the barcode text (instead of clearing it) so it can be seen and easily
replaced, consistent with the item status UI.

After successful scan, clear and re-focus the barcode input box.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Cesar Velez <cesar.velez@equinoxinitiative.org>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/templates/staff/cat/bucket/copy/t_pending.tt2
Open-ILS/web/js/ui/default/staff/cat/bucket/copy/app.js

index dcd0815..6391625 100644 (file)
@@ -3,13 +3,21 @@
     <form ng-submit="search()">
       <div class="input-group">
         <span class="input-group-addon">[% l('Scan Item') %]</span>
-        <input type="text" class="form-control" focus-me="focusMe"
+        <input type="text" class="form-control" select-me="context.selectPendingBC"
         ng-model="bucketSvc.barcodeString" placeholder="[% l('Barcode...') %]">
       </div>
     </form>
   </div>
 </div>
 
+<div class="row pad-vert" ng-if="context.itemNotFound">
+  <div class="col-md-6">
+    <div class="alert alert-danger">
+      [% l('Item Not Found') %]
+    </div>
+  </div>
+</div>
+
 <br/>
 
 <eg-grid
index d99e70e..151fe91 100644 (file)
@@ -372,6 +372,11 @@ function($scope,  $location,  $q,  $timeout,  $uibModal,
 function($scope,  $routeParams,  bucketSvc , egGridDataProvider,   egCore) {
     $scope.setTab('pending');
 
+    $scope.context = {
+        copyNotFound : false,
+        selectPendingBC : true
+    };
+
     var query;
     $scope.gridControls = {
         setQuery : function(q) {
@@ -379,19 +384,32 @@ function($scope,  $routeParams,  bucketSvc , egGridDataProvider,   egCore) {
                 return {id : bucketSvc.pendingList};
             else
             return null;
+        },
+        allItemsRetrieved : function() {
+            $scope.context.selectPendingBC = true;
         }
     }
 
     $scope.search = function() {
         bucketSvc.barcodeRecords = [];
+        $scope.context.itemNotFound = false;
+
+        // clear selection so re-selecting can have an effect
+        $scope.context.selectPendingBC = false;
 
         egCore.pcrud.search(
             'acp',
             {barcode : bucketSvc.barcodeString, deleted : 'f'},
             {}
-        ).then(null, null, function(copy) {
-            bucketSvc.pendingList.push(copy.id());
-            $scope.gridControls.setQuery({id : bucketSvc.pendingList});
+        ).then(function(copy) {
+            if (copy) {
+                bucketSvc.pendingList.push(copy.id());
+                $scope.gridControls.setQuery({id : bucketSvc.pendingList});
+                bucketSvc.barcodeString = ''; // clear form on valid copy
+            } else {
+                $scope.context.itemNotFound = true;
+                $scope.context.selectPendingBC = true;
+            }
         });
     }