webstaff: start list of patterns
authorGalen Charlton <gmc@equinoxinitiative.org>
Thu, 27 Apr 2017 16:58:57 +0000 (12:58 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Thu, 27 Apr 2017 16:58:57 +0000 (12:58 -0400)
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/templates/staff/serials/t_prediction_manager.tt2
Open-ILS/web/js/ui/default/staff/serials/directives/prediction_manager.js
Open-ILS/web/js/ui/default/staff/serials/services/core.js

index 49b863f..ea0c9af 100644 (file)
@@ -1,3 +1,32 @@
 <div>
 <eg-sub-selector bib-id="bibId" ssub-id="ssubId"></eg-sub-selector>
 </div>
+
+<div>
+  <div class="row" ng-repeat="pred in predictions | orderBy: 'id' as filtered track by pred.id">
+    <ng-form name="predform" class="form-inline">
+    <div class="col-md-1"><label>[% l('ID') %] {{pred.id}}</label></div>
+    <div class="col-md-1">
+      <label class="checkbox-inline">
+        <input type="checkbox" ng-model="pred.active">[% l('Active') %]
+      </label>
+    </div>
+    <div class="col-md-2">
+      <label>[% l('Start Date') %]</label>
+        {{pred.create_date | date:"shortDate"}}
+    </div>
+    <div class="col-md-3">
+        <label>[% l('Type') %]</label>
+        <select ng-model="pred.type">
+            <option value="basic">[% l('Basic') %]</option>
+            <option value="supplement">[% l('Supplement') %]</option>
+            <option value="index">[% l('Index') %]</option>
+        </select>
+        <button class="btn btn-default">[% l('Edit Pattern') %]</button>
+    </div>
+    <div>
+        <button class="btn btn-primary" ng-disabled="!predform.$dirty">[% l('Save') %]</button>
+    </div>
+    </form>
+  </div>
+</div>
index 8927c9a..fe5d5ba 100644 (file)
@@ -14,6 +14,20 @@ angular.module('egSerialsAppDep')
         '$uibModal',
 function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider ,
                      $uibModal) {
+
+    egSerialsCoreSvc.fetch($scope.bibId).then(function() {
+        reload($scope.ssubId);
+    });
+
+    function reload(ssubId) {
+        var ssub = egSerialsCoreSvc.get_ssub(ssubId);
+        $scope.predictions = egCore.idl.toTypedHash(ssub.scaps());
+    }
+
+    $scope.$watch('ssubId', function(newVal, oldVal) {
+        if (newVal && newVal != oldVal) reload(newVal);
+    });
+
 }]
     }
 })
index d138df4..2f69e04 100644 (file)
@@ -152,5 +152,13 @@ function(egCore , orderByFilter , $q) {
         return deferred.promise;
     }
 
+    service.get_ssub = function(ssubId) {
+        for (var i = 0; i <= service.subTree.length; i++) {
+            if (service.subTree[i].id() == ssubId) {
+                return service.subTree[i];
+            }
+        }
+    }
+
     return service;
 }]);