webstaff: add Predict New Issues button to predictions tab
authorGalen Charlton <gmc@equinoxinitiative.org>
Thu, 25 May 2017 17:54:09 +0000 (13:54 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 30 May 2017 16:06:51 +0000 (12:06 -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

index e2e403a..343f636 100644 (file)
@@ -63,6 +63,7 @@
         <button class="btn btn-default" ng-click="openPatternEditorDialog(pred)">[% l('Edit Pattern') %]</button>
     </div>
     <div>
+        <button class="btn btn-default" ng-disabled="pred.predform.$dirty" ng-click="add_issuances()">[% l('Predict New Issues') %]</button>
         <button type="submit" class="btn btn-default" ng-click="deleteScap(pred)">[% l('Delete') %]</button>
         <button type="submit" class="btn btn-primary" ng-disabled="!pred.predform.$dirty" ng-click="updateScap(pred)">[% l('Save') %]</button>
     </div>
index 1a0b461..7cace14 100644 (file)
@@ -11,9 +11,9 @@ angular.module('egSerialsAppDep')
         templateUrl: './serials/t_prediction_manager',
         controller:
        ['$scope','$q','egSerialsCoreSvc','egCore','egGridDataProvider',
-        '$uibModal','$timeout',
+        '$uibModal','$timeout','$location',
 function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider ,
-         $uibModal , $timeout) {
+         $uibModal , $timeout , $location) {
 
     egSerialsCoreSvc.fetch($scope.bibId).then(function() {
         reload($scope.ssubId);
@@ -127,6 +127,15 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider ,
         });
     }
 
+    $scope.add_issuances = function() {
+        return egSerialsCoreSvc.fetchItemsForSub($scope.ssubId).then(function() {
+            egSerialsCoreSvc.add_issuances($scope.ssubId).then(function() {
+                $location.path('/serials/' + $scope.bibId + '/issues/' +
+                                $scope.ssubId);
+            });
+        });
+    }
+
 }]
     }
 })