From: Galen Charlton Date: Mon, 22 May 2017 21:22:44 +0000 (-0400) Subject: webstaff: receiving template associated with distribution now displays X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=215997cc352b3e070297aeda6a5698a53b5bfe6f;p=working%2FEvergreen.git webstaff: receiving template associated with distribution now displays Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/templates/staff/serials/t_apply_binding_template.tt2 b/Open-ILS/src/templates/staff/serials/t_apply_binding_template.tt2 index dd0bbc2510..20de945782 100644 --- a/Open-ILS/src/templates/staff/serials/t_apply_binding_template.tt2 +++ b/Open-ILS/src/templates/staff/serials/t_apply_binding_template.tt2 @@ -40,7 +40,7 @@
diff --git a/Open-ILS/src/templates/staff/serials/t_subscription_manager.tt2 b/Open-ILS/src/templates/staff/serials/t_subscription_manager.tt2 index 67923798dd..076380f67a 100644 --- a/Open-ILS/src/templates/staff/serials/t_subscription_manager.tt2 +++ b/Open-ILS/src/templates/staff/serials/t_subscription_manager.tt2 @@ -37,7 +37,7 @@ diff --git a/Open-ILS/web/js/ui/default/staff/serials/directives/subscription_manager.js b/Open-ILS/web/js/ui/default/staff/serials/directives/subscription_manager.js index a4209ea2f6..cbaa2019bb 100644 --- a/Open-ILS/web/js/ui/default/staff/serials/directives/subscription_manager.js +++ b/Open-ILS/web/js/ui/default/staff/serials/directives/subscription_manager.js @@ -13,10 +13,24 @@ angular.module('egSerialsAppDep') '$uibModal','ngToast', function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider , $uibModal , ngToast ) { - egSerialsCoreSvc.fetch($scope.bibId).then(function() { - $scope.subscriptions = egCore.idl.toTypedHash(egSerialsCoreSvc.subTree); - $scope.distStreamGridDataProvider.refresh(); - }); + + function reload() { + egSerialsCoreSvc.fetch($scope.bibId).then(function() { + $scope.subscriptions = egCore.idl.toTypedHash(egSerialsCoreSvc.subTree); + // un-flesh receive unit template so that we can use + // it as a model of a select + angular.forEach($scope.subscriptions, function(ssub) { + angular.forEach(ssub.distributions, function(sdist) { + if (angular.isObject(sdist.receive_unit_template)) { + sdist.receive_unit_template = sdist.receive_unit_template.id; + } + }); + }); + $scope.distStreamGridDataProvider.refresh(); + }); + } + reload(); + $scope.distStreamGridControls = { activateItem : function (item) { } // TODO }; @@ -26,13 +40,6 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider , } }); - function reload() { - egSerialsCoreSvc.fetch($scope.bibId).then(function() { - $scope.subscriptions = egCore.idl.toTypedHash(egSerialsCoreSvc.subTree); - $scope.distStreamGridDataProvider.refresh(); - }); - } - $scope.need_one_selected = function() { var items = $scope.distStreamGridControls.selectedItems(); if (items.length == 1) return false; @@ -40,16 +47,10 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider , }; $scope.receiving_templates = {}; - var promises = []; angular.forEach(egCore.org.list(), function(org) { - promises.push( - egSerialsCoreSvc.fetch_templates(org.id()).then(function(list){ - $scope.receiving_templates[org.id()] = list; - }) - ); - }); - $q.all(promises).then(function() { - //console.log('finis',$scope.receiving_templates); + egSerialsCoreSvc.fetch_templates(org.id()).then(function(list){ + $scope.receiving_templates[org.id()] = egCore.idl.toTypedHash(list); + }); }); $scope.add_subscription = function() { @@ -405,16 +406,10 @@ function($scope , $q , $uibModalInstance , egCore , egSerialsCoreSvc , $scope.rows = rows; $scope.args = { bind_unit_template : {} }; $scope.templates = {}; - var promises = []; angular.forEach(libs, function(org) { - promises.push( - egSerialsCoreSvc.fetch_templates(org.id).then(function(list){ - $scope.templates[org.id] = list; - }) - ); - }); - $q.all(promises).then(function() { - //console.log('finis',$scope.receiving_templates); + egSerialsCoreSvc.fetch_templates(org.id).then(function(list){ + $scope.templates[org.id] = egCore.idl.toTypedHash(list); + }); }); }])