webstaff: add subscription selector to prediction manager
authorGalen Charlton <gmc@equinoxinitiative.org>
Tue, 25 Apr 2017 21:29:06 +0000 (17:29 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 25 Apr 2017 21:29:06 +0000 (17:29 -0400)
This also implement updating the browser URL when a
different subscription is chosen.

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/templates/staff/serials/t_manage.tt2
Open-ILS/src/templates/staff/serials/t_prediction_manager.tt2
Open-ILS/web/js/ui/default/staff/serials/app.js

index 8e68b2a..38758d0 100644 (file)
@@ -13,7 +13,7 @@
       </uib-tab>
       <uib-tab index="'prediction'" heading="[% l('Manage Predictions') %]">
         <eg-prediction-manager ng-if="active_tab == 'prediction'"
-            bib-id="bib_id" ssub-id="ssub_id">
+            bib-id="bib_id" ssub-id="ssub.id">
         </eg-prediction-manager>
       </uib-tab>
       <uib-tab index="'view-issues'" heading="[% l('View Issues') %]">
index a84341d..49b863f 100644 (file)
@@ -1,3 +1,3 @@
 <div>
-Here will reside prediction pattern management stuff.
+<eg-sub-selector bib-id="bibId" ssub-id="ssubId"></eg-sub-selector>
 </div>
index 7cd7a34..66e286d 100644 (file)
@@ -39,16 +39,23 @@ angular.module('egSerialsApp')
 function($scope , $routeParams , $location , egSerialsCoreSvc) {
     $scope.bib_id = $routeParams.bib_id;
     $scope.active_tab = $routeParams.active_tab ?  $routeParams.active_tab : 'manage-subscriptions';
-    $scope.ssub_id = null;
+    $scope.ssub = {id : null};
     if ($routeParams.subscription_id) {
         egSerialsCoreSvc.verify_subscription_id($scope.bib_id, $routeParams.subscription_id)
         .then(function(verified) {
             if (verified) {
-                $scope.ssub_id = $routeParams.subscription_id;
+                $scope.ssub.id = $routeParams.subscription_id;
             } else {
                 // subscription ID is no good, so drop it from the URL
                 $location.path('/serials/' + $scope.bib_id + '/' + $scope.active_tab);
             }
         });
+        $scope.$watch('ssub.id', function(newVal, oldVal) {
+console.debug('changed?');
+            if (oldVal != newVal) {
+                $location.path('/serials/' + $scope.bib_id + '/' + $scope.active_tab +
+                               '/' + $scope.ssub.id);
+            }
+        });
     }
 }])