From be2b2cfd6a86c36ab36d9d77afc6665415a260ee Mon Sep 17 00:00:00 2001 From: Mike Risher Date: Tue, 19 May 2020 16:35:49 +0000 Subject: [PATCH] lp1751356 Typing to select with item stat cat dropdowns MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Stat cat dropdowns don’t show you characters as you type and doesn’t seem to work reliably. Modify them to resolve these issues. Signed-off-by: Mike Risher Changes to be committed: modified: Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2 modified: Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js --- .../templates/staff/cat/volcopy/t_attr_edit.tt2 | 11 ++-------- .../web/js/ui/default/staff/cat/volcopy/app.js | 24 +++++++++++++++++++++- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2 b/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2 index 7168f6ada1..80ce31ee43 100644 --- a/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2 +++ b/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2 @@ -516,15 +516,8 @@
  • - + +
  • diff --git a/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js b/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js index 501a9c1785..2134200961 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js @@ -1286,7 +1286,19 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , } $scope.statcatUpdate = function (id) { - var newval = $scope.working.statcats[id]; + var newval; + + // use sc_selected_text to find the selected stat cat's id and update the working.statcats object with that id + angular.forEach($scope.statcats, function(statcat) { + if (statcat.id() === id) { + angular.forEach(statcat.entries(), function (entry) { + if (entry.value() === statcat.sc_selected_text) { + newval = entry.id(); + $scope.working.statcats[id] = entry.id(); + } + }) + } + }) if (typeof newval != 'undefined') { if (angular.isObject(newval)) { // we'll use the pkey @@ -1829,6 +1841,12 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , if (!none && Object.keys(value_hash).length == 1) { $scope.working.statcats[sc.id()] = value_hash[Object.keys(value_hash)[0]]; + // populate stat cat combo-box with correct text + angular.forEach(item.stat_cat_entries(), function (entry) { + if (entry.id() === $scope.working.statcats[sc.id()]) { + sc.sc_selected_text=entry.value(); + } + }); $scope.working.statcats_multi[sc.id()] = false; } else if (item_list.length > 1 && Object.keys(value_hash).length > 0) { $scope.working.statcats[sc.id()] = undefined; @@ -1899,6 +1917,10 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , if (!$scope.in_item_select) { $scope.working.statcats[s.id()] = undefined; } + s.sc_entry_values = s.entries().map(entry => { + return entry.value(); + }); + if (!s.sc_selected_text) s.sc_selected_text = ''; createStatcatUpdateWatcher(s.id()); }); $scope.in_item_select = false; -- 2.11.0