web staff: checkin copy alert msg dialog
authorBill Erickson <berick@esilibrary.com>
Wed, 27 Nov 2013 19:16:01 +0000 (14:16 -0500)
committerBill Erickson <berick@esilibrary.com>
Wed, 27 Nov 2013 19:16:01 +0000 (14:16 -0500)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/staff/circ/checkin/index.tt2
Open-ILS/src/templates/staff/parts/confirm_dialog.tt2
Open-ILS/web/js/ui/default/staff/circ/checkin/app.js
Open-ILS/web/js/ui/default/staff/services/list.js

index 08095e5..6ec7931 100644 (file)
   [% INCLUDE 'staff/parts/alert_dialog.tt2' dialog_body=
     l('Copy "{{args.copy_barcode}}" was mis-scanned or is not cataloged') %]
 </script>
+<script type="text/ng-template" id="alert_msg_confirm_dialog">
+  [% INCLUDE 'staff/parts/confirm_dialog.tt2' 
+    dialog_title=l('Copy Alert Message for {{args.copy_barcode}}')
+    dialog_body='{{evt.payload}}' %]
+</script>
+
 
 
 [% END %]
index 9502c73..3e4a118 100644 (file)
@@ -2,24 +2,24 @@
   Generic confirmation dialog
   User can click OK -> $scope.ok() or Cancel -> $scope.cancel()
 -->
-<form class="form-validated" novalidate ng-submit="ok()">
-  <div class="modal-dialog">
-    <div class="modal-content">
-      <div class="modal-header">
-        <button type="button" class="close" 
-          ng-click="cancel()" aria-hidden="true">&times;</button>
-        [% IF dialog_title %] 
-          <h4 class="modal-title">[% dialog_title %]</h4> 
-        [% END %]
-      </div>
-      [% IF dialog_body %]
-        <div class="modal-body">[% dialog_body %]</div>
+<div class="modal-dialog">
+  <div class="modal-content">
+    <div class="modal-header">
+      <button type="button" class="close" 
+        ng-click="cancel()" aria-hidden="true">&times;</button>
+      [% IF dialog_title %] 
+        <h4 class="modal-title alert alert-info">[% dialog_title %]</h4> 
       [% END %]
-      <div class="modal-footer">
-        [% dialog_footer %]
-        <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 -->
-  </div> <!-- modal-dialog -->
-</form>
+    </div>
+    [% IF dialog_body %]
+      <div class="modal-body">[% dialog_body %]</div>
+    [% END %]
+    <div class="modal-footer">
+      [% dialog_footer %]
+      <input type="submit" class="btn btn-primary" 
+        ng-click="ok()" value="[% l('OK/Continue') %]"/>
+      <button class="btn btn-warning" 
+        ng-click="cancel()">[% l('Cancel') %]</button>
+    </div>
+  </div> <!-- modal-content -->
+</div> <!-- modal-dialog -->
index ef496c5..587180e 100644 (file)
@@ -101,6 +101,9 @@ function($scope,  $q,  $modal,  egStartup,  checkinSvc,  egNet,  egAuth,  orgAdd
             case 'ASSET_COPY_NOT_FOUND':
                 openAlertDialog('uncat_alert_dialog', evt, args);
                 break;
+            case 'COPY_ALERT_MESSAGE':
+                openConfirmDialog('alert_msg_confirm_dialog', evt, args);
+                break;
             default:
                 console.warn('unhandled checkin response : ' + evt.textcode);
                 console.debug('checkin: ' + js2JSON(evt));
@@ -124,6 +127,29 @@ function($scope,  $q,  $modal,  egStartup,  checkinSvc,  egNet,  egAuth,  orgAdd
         }).result.then(function() {$scope.focusMe = true});
     }
 
+    function openConfirmDialog(id, evt, args) {
+        // avoid unintended checkins while the dialog is open
+        $scope.blurMe = true;
+        $modal.open({
+            templateUrl: id,
+            controller: 
+                ['$scope', '$modalInstance', 
+                function($scope, $modalInstance) {
+                $scope.args = args;
+                $scope.evt = evt;
+                $scope.ok = function() {
+                    performCheckin(args, true);
+                    $modalInstance.close()
+                }
+                $scope.cancel = function() {
+                    $modalInstance.close()
+                    checkinSvc.checkins.items.push(evt);
+                }
+            }]
+        }).result.then(function() {$scope.focusMe = true});
+    }
+
+
     function openRouteDialog(evt, args) {
         // avoid unintended checkins while the dialog is open
         $scope.blurMe = true;
index 9f28fb9..a54340e 100644 (file)
@@ -253,11 +253,10 @@ angular.module('egListMod', ['egCoreMod'])
             var cls, clsobj;
 
             angular.forEach(parts, function(step, idx) {
-
+                // object is not fleshed to the expected extent
                 if (!obj || typeof obj != 'object') {
-                    // there are valid reasons for paths to be cut 
-                    // short, e.g. when data sets have varying contents.
-                    return obj;
+                    obj = '';
+                    return;
                 }
 
                 cls = obj.classname;