From 6235ddfbad64647b447fdd4a1e46a176155f7b7c Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 5 May 2017 17:34:11 -0400 Subject: [PATCH] webstaff: implement adding a new prediction Signed-off-by: Galen Charlton --- .../staff/serials/t_prediction_manager.tt2 | 31 ++++++++++++++++++++++ .../staff/serials/directives/prediction_manager.js | 24 +++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/Open-ILS/src/templates/staff/serials/t_prediction_manager.tt2 b/Open-ILS/src/templates/staff/serials/t_prediction_manager.tt2 index 28720345cc..cecf908cfa 100644 --- a/Open-ILS/src/templates/staff/serials/t_prediction_manager.tt2 +++ b/Open-ILS/src/templates/staff/serials/t_prediction_manager.tt2 @@ -3,6 +3,37 @@
+
+ + +
+
+ +
+
+ +
+
+ + {{new_prediction.create_date | date:"shortDate"}} +
+
+ + + +
+
+ +
+ +
+

[% l('Existing Prediction Patterns') %]

diff --git a/Open-ILS/web/js/ui/default/staff/serials/directives/prediction_manager.js b/Open-ILS/web/js/ui/default/staff/serials/directives/prediction_manager.js index 7be34eadda..02f735e7a2 100644 --- a/Open-ILS/web/js/ui/default/staff/serials/directives/prediction_manager.js +++ b/Open-ILS/web/js/ui/default/staff/serials/directives/prediction_manager.js @@ -28,6 +28,18 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider , if (newVal && newVal != oldVal) reload(newVal); }); + $scope.createScap = function(pred) { + var scap = egCore.idl.fromTypedHash(pred); + egCore.pcrud.create(scap).then(function() { + // completely reset the model in order to reset the + // forms; causes a blink, alas + $scope.predictions = []; + $scope.new_prediction = null; + egSerialsCoreSvc.fetch($scope.bibId).then(function() { + reload($scope.ssubId); + }); + }); + } $scope.updateScap = function(pred) { var scap = egCore.idl.fromTypedHash(pred); egCore.pcrud.update(scap).then(function() { @@ -40,6 +52,18 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider , }); } + $scope.startNewScap = function() { + $scope.new_prediction = egCore.idl.toTypedHash(new egCore.idl.scap()); + $scope.new_prediction.type = 'basic'; + $scope.new_prediction.active = true; + $scope.new_prediction.create_date = new Date(); + $scope.new_prediction.subscription = $scope.ssubId; + $scope.new_pred = {}; + } + + $scope.importScapFromBibRecord = function() { + } + $scope.openPatternEditorDialog = function(pred) { $uibModal.open({ templateUrl: './serials/t_pattern_editor_dialog', -- 2.11.0