From d69bb376a59fd8dc2db95a26bccbc599c54defc7 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 9 Dec 2015 11:42:50 -0500 Subject: [PATCH] LP#1452950 patron dupe search links Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton --- .../templates/staff/circ/patron/t_edit.tt2 | 35 +++++++++++++++++++ Open-ILS/src/templates/staff/css/circ.css.tt2 | 8 +++++ .../js/ui/default/staff/circ/patron/app.js | 9 +++-- .../js/ui/default/staff/circ/patron/regctl.js | 20 ++++++----- 4 files changed, 62 insertions(+), 10 deletions(-) diff --git a/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 index 419c23c3ef..23e51d7fbe 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 @@ -27,6 +27,41 @@
{{selected_field_doc.string()}}
+ + + [% MACRO formfield(cls, field, path, input_type) BLOCK; # input field generator for common text/number/checkbox fields diff --git a/Open-ILS/src/templates/staff/css/circ.css.tt2 b/Open-ILS/src/templates/staff/css/circ.css.tt2 index efc04f77b8..80373bb4ed 100644 --- a/Open-ILS/src/templates/staff/css/circ.css.tt2 +++ b/Open-ILS/src/templates/staff/css/circ.css.tt2 @@ -110,6 +110,14 @@ but the ones I'm finding aren't quite cutting it..*/ margin-top: 20px; } +#reg-dupe-links { + position: fixed; + top:180px; + right:20px; + padding: 10px; + margin-top: 10px; +} + #reg-field-doc legend { /* otherwise the font size is quite large */ font-size: 100%; diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js index 2cd7d9d2fa..6a184ae263 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js @@ -793,11 +793,16 @@ function($scope, $q, $routeParams, $timeout, $window, $location, egCore, // Handle URL-encoded searches if ($location.search().search) { + console.log('URL search = ' + $location.search().search); patronSvc.urlSearch = {search : JSON2js($location.search().search)}; // why the double-JSON encoded sort? - patronSvc.urlSearch.sort = - JSON2js(patronSvc.urlSearch.search.search_sort); + if (patronSvc.urlSearch.search.search_sort) { + patronSvc.urlSearch.sort = + JSON2js(patronSvc.urlSearch.search.search_sort); + } else { + patronSvc.urlSearch.sort = []; + } delete patronSvc.urlSearch.search.search_sort; } diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js index 739e09882a..ed016fcc0c 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js @@ -381,9 +381,6 @@ angular.module('egCoreMod') switch (type) { - // TODO hide dupe results links matching the type - // of the current search - case 'name': var fname = patron.first_given_name; var lname = patron.family_name; @@ -422,11 +419,11 @@ angular.module('egCoreMod') 'open-ils.actor.patron.search.advanced', egCore.auth.token(), search, null, null, 1 ).then(function(res) { - res = res.filter(function(id) {return id != patron.id}); - if (res.length == 0) return; - - console.log(js2JSON(res)); + return { + count : res.length, + search : search + }; }); } @@ -685,6 +682,7 @@ function PatronRegCtrl($scope, $routeParams, // for existing patrons, disable barcode input by default $scope.disable_bc = $scope.focus_usrname = Boolean($scope.patron_id); $scope.focus_bc = !Boolean($scope.patron_id); + $scope.dupe_counts = {}; if (!$scope.edit_passthru) { // in edit more, scope.edit_passthru is delivered to us by @@ -1094,7 +1092,13 @@ function PatronRegCtrl($scope, $routeParams, } $scope.dupe_value_changed = function(type, value) { - patronRegSvc.dupe_patron_search($scope.patron, type, value); + $scope.dupe_counts[type] = 0; + patronRegSvc.dupe_patron_search($scope.patron, type, value) + .then(function(res) { + $scope.dupe_counts[type] = res.count; + $scope.dupe_search_encoded = + encodeURIComponent(js2JSON(res.search)); + }); } $scope.edit_passthru.save = function() { -- 2.43.2