From: Mike Risher Date: Tue, 19 May 2020 16:35:49 +0000 (+0000) Subject: lp1751356 Typing to select with item stat cat dropdowns X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=1003e3c9015e8d5a7b4645be542d6a603ad71c7b;p=working%2FEvergreen.git lp1751356 Typing to select with item stat cat dropdowns 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 Signed-off-by: Rogan Hamby --- 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 580ec61585..aa2fa31ffd 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 @@ -513,15 +513,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 29bd7f0e1c..2e0ef23cb1 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 @@ -1271,7 +1271,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 @@ -1814,6 +1826,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; @@ -1884,6 +1902,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;