CAT-206 Cataloging Date in Webby
authorKyle Huckins <khuckins@catalyte.io>
Wed, 13 Feb 2019 18:09:07 +0000 (18:09 +0000)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:51:45 +0000 (15:51 -0400)
- Add Cataloging Date row to marc edit interface
- Add update and clear buttons for Cataloging Date

Signed-off-by: Kyle Huckins <khuckins@catalyte.io>
 Changes to be committed:
modified:   Open-ILS/src/templates/staff/cat/share/t_marcedit.tt2
modified:   Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js

Open-ILS/src/templates/staff/cat/share/t_marcedit.tt2
Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js

index 5ba7859..5ec1415 100644 (file)
       </div>
     </div>
   </div>
+  
+  <div class="pad-vert row marctypesource" ng-if="bre">
+      <div class="col-md-3 col-md-offset-6">
+        <div class="input-group">
+            <span class="input-group-addon">
+              [% l('Cataloging Date:') %]
+            </span>
+            <eg-date-input ng-model="cataloging_date"></eg-date-input>
+        </div>
+      </div>
+      <div class="col-md-3">
+          <span class="btn-group">
+            <button class="btn btn-default" ng-click="updateDate(cataloging_date)">[% l('Update Date') %]</button>
+            <button class="btn btn-default" ng-click="cataloging_date = null">[% l('Clear Date') %]</button>
+          </span>
+      </div>
+
+  </div>
 
   <div ng-show="flatEditor.isEnabled">
     <textarea class="marcflateditor" cols="120" rows="40" ng-model="flat_text_marc" ng-blur="saveFlatTextMARC()"></textarea>
index 4d2f9c9..63310ff 100644 (file)
@@ -1193,6 +1193,9 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap'])
                         $scope.dirtyFlag = false;
                         $scope.flat_text_marc = $scope.record.toBreaker();
 
+                        if ($scope.record_type == 'bre') {
+                            $scope.cataloging_date = new Date(rec.cataloging_date()) || new Date();
+                        }
                         if ($scope.record_type == 'bre' && !$scope.brandNewRecord) {
                             $scope.bib_source.id = $scope.bibSource = rec.source(); //$scope.Record().source();
                         }
@@ -1257,6 +1260,16 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap'])
                     return true;
                 };
 
+                $scope.updateDate = function(cataloging_date) {
+                    if (cataloging_date instanceof Date && !isNaN(cataloging_date)) {
+                        $scope.Record().cataloging_date(new Date(cataloging_date).toISOString());
+                    } else if (!cataloging_date) {
+                        $scope.Record.cataloging_date(null);
+                    } else {
+                        return;
+                    }
+                }
+
                 $scope.processRedo = function () {
                     if ($scope.record_redo_stack.length) {
                         $scope.in_redo = true;