LP#1402797 Add (stub) fast item add, and (working) bib source selection
authorMike Rylander <mrylander@gmail.com>
Tue, 17 Feb 2015 18:30:57 +0000 (13:30 -0500)
committerBill Erickson <berickxx@gmail.com>
Wed, 25 Feb 2015 16:16:09 +0000 (11:16 -0500)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/templates/staff/cat/share/t_marcedit.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/css/cat.css.tt2
Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js

diff --git a/Open-ILS/src/templates/staff/cat/share/t_marcedit.tt2 b/Open-ILS/src/templates/staff/cat/share/t_marcedit.tt2
new file mode 100644 (file)
index 0000000..1d4dbba
--- /dev/null
@@ -0,0 +1,37 @@
+<div>
+  <div ng-if="bre">
+    <div class="row col-md-12 pad-vert marcfastitemadd">
+        <input id="mfiacn" type="text" placeholder="[% l('Call Number:') %]" ng-model="fast_item_callnumber"/>
+        <input id="mfiabc" type="text" placeholder="[% l('Barcode') %]" ng-model="fast_item_barcode"/>
+        <button class="btn btn-default" ng-click="saveFastItem()">Add Item</button>
+      </div>
+    </div>
+  </div>
+  <div class="marcffeditor">
+    <div class="row col-md-12 pad-vert marctypesource">
+      <div class="col-md-2"><label>Record Type:</label> {{calculated_record_type}}</div>
+      <div ng-if="bre" class="col-md-2"><eg-marc-edit-bibsource/></div>
+    </div>
+  </div>
+  <div class="marcrecord pad-vert">
+    <div>
+      <eg-marc-edit-leader record="record" on-keydown="onKeydown"/>
+    </div>
+    <div>
+      <eg-marc-edit-controlfield 
+        ng-repeat="field in controlfields" 
+        field="field" on-keydown="onKeydown"
+        id="r{{field.record.subfield('901','c')[1]}}f{{field.position}}"
+      />
+    </div>
+    <div>
+      <eg-marc-edit-datafield 
+        ng-repeat="field in datafields" 
+        field="field" on-keydown="onKeydown" 
+        id="r{{field.record.subfield('901','c')[1]}}f{{field.position}}"
+      />
+    </div>
+  </div>
+  <button class="btn btn-default" ng-click="saveRecord()">Save</button>
+  <button class="btn btn-default" ng-click="seeBreaker()">Breaker</button>
+</div>
index 2d653a8..ba4f41a 100644 (file)
@@ -1,5 +1,9 @@
 .marcrecord {
-    background-color: lightgrey;
+    //background-color: lightgrey;
+}
+
+.marcfastitemadd, .marctypesource {
+    border-bottom: solid thin gray;
 }
 
 .marcedit {
index 000587c..f6f2e05 100644 (file)
@@ -267,23 +267,7 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap'])
 /// TODO: fixed field editor and such
 .directive("egMarcEditRecord", function () {
     return {
-        template: '<form ng-submit="saveRecord()">'+
-                  '<div class="marcrecord">'+
-                    '<div><eg-marc-edit-leader record="record" on-keydown="onKeydown"/></div>'+
-                    '<div><eg-marc-edit-controlfield '+
-                        'ng-repeat="field in controlfields" '+
-                        'field="field" on-keydown="onKeydown"'+
-                        'id="r{{field.record.subfield(\'901\',\'c\')[1]}}f{{field.position}}"'+
-                        '/></div>'+
-                    '<div><eg-marc-edit-datafield '+
-                        'ng-repeat="field in datafields" '+
-                        'field="field" on-keydown="onKeydown" '+
-                        'id="r{{field.record.subfield(\'901\',\'c\')[1]}}f{{field.position}}"'+
-                        '/></div>'+
-                  '</div>'+
-                  '<button class="btn btn-default" type="submit">Save</button>'+
-                  '</form>'+
-                  '<button class="btn btn-default" ng-click="seeBreaker()">Breaker</button>',
+        templateUrl : './cat/share/t_marcedit',
         restrict: 'E',
         replace: false,
         scope: { recordId : '=', recordType : '@', maxUndo : '@' },
@@ -304,6 +288,7 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap'])
         controller : ['$timeout','$scope','egCore',
             function ( $timeout , $scope , egCore ) {
 
+                $scope.bib_source = null;
                 $scope.record_type = $scope.recordType || 'bre';
                 $scope.max_undo = $scope.maxUndo || 100;
                 $scope.record_undo_stack = [];
@@ -648,9 +633,15 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap'])
                         $scope.in_redo = true;
                         $scope[$scope.record_type] = rec;
                         $scope.record = new MARC.Record({ marcxml : $scope[$scope.record_type].marc() });
+                        $scope.calculated_record_type = $scope.record.recordType();
                         $scope.controlfields = $scope.record.fields.filter(function(f){ return f.isControlfield() });
                         $scope.datafields = $scope.record.fields.filter(function(f){ return !f.isControlfield() });
                         $scope.save_stack_depth = $scope.record_undo_stack.length;
+
+                        if ($scope.record_type == 'bre') {
+                            $scope.bib_source = $scope[$scope.record_type].source();
+                        }
+
                     }).then(setCaret);
                 }
 
@@ -792,4 +783,32 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap'])
     }
 })
 
+.directive("egMarcEditBibsource", ['$timeout',function ($timeout) {
+    return {
+        restrict: 'E',
+        replace: false,
+        template: '<span class="nullable">'+
+                    '<select class="form-control" ng-model="bib_source" ng-options="s.id() as s.source() for s in bib_sources">'+
+                      '<option value="">Select a Source</option>'+
+                    '</select>'+
+                  '</span>',
+        controller: ['$scope','egCore',
+            function ($scope , egCore) {
+
+                egCore.pcrud.retrieveAll('cbs', {}, {atomic : true})
+                    .then(function(list) { $scope.bib_sources = list; });
+
+                $scope.$watch('bib_source',
+                    function(newVal, oldVal) {
+                        if (newVal !== oldVal) {
+                            $scope.bre.source(newVal);
+                        }
+                    }
+                );
+
+            }
+        ]
+    }
+}])
+
 ;