From: Bill Erickson Date: Wed, 11 Dec 2013 16:08:15 +0000 (-0500) Subject: web staff: more patron saerch X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=7d79dd0a959d7fcf7ca58b4cc3e5d0ce8548e7b8;p=working%2FEvergreen.git web staff: more patron saerch Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/templates/staff/circ/patron/index.tt2 b/Open-ILS/src/templates/staff/circ/patron/index.tt2 index 1130edfe14..235ca4f933 100644 --- a/Open-ILS/src/templates/staff/circ/patron/index.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/index.tt2 @@ -37,7 +37,7 @@ [% l('Edit') %]
  • - [% l('Search') %] + [% l('Patron Search') %]
  • diff --git a/Open-ILS/src/templates/staff/circ/patron/t_search.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_search.tt2 index eb65e4efac..ff97a2f125 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_search.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_search.tt2 @@ -3,60 +3,63 @@
    -
    -
    -
    - - - - - - -
    + +
    + + + + + + + + + +
    -
    -
    - - - - -
    +
    + + + + +
    -
    -
    - - - - - -
    +
    + + + + +
    -
    -
    - + - - - - - - - -
    +
    + +
    diff --git a/Open-ILS/src/templates/staff/css/style.css.tt2 b/Open-ILS/src/templates/staff/css/style.css.tt2 index e31c0c2460..cfc65af676 100644 --- a/Open-ILS/src/templates/staff/css/style.css.tt2 +++ b/Open-ILS/src/templates/staff/css/style.css.tt2 @@ -97,7 +97,7 @@ but the ones I'm finding aren't quite cutting it..*/ .pad-vert {padding : 20px 0px 10px 0px;} #patron-checkout-barcode { width: 18em; } -#patron-search-form div.row { +#patron-search-form div.form-group { margin-bottom: 5px; } 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 4f25b08926..48840daacb 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 @@ -237,15 +237,16 @@ function($scope, $q, $routeParams, $timeout, $window, $location, egEnv, $scope.focusMe = true; $scope.patrons = patronSvc.patrons; - // typeahead doesn't filter correct with full hash objects, - // so trim them down to just name and id. I'm probably - // missing something... + // typeahead doesn't filter correctly with full hash objects, so + // trim them down to just name and id. This would allow us to use + // full objects (egIDL.toHash()) instead of manually creating + // objects... maybe later. + // http://stackoverflow.com/questions/18429967/angularjs-ui-typeahead-match-on-leading-characters $scope.profiles = egEnv.pgt.list.map( function(grp) {return {name : grp.name(), id : grp.id() }}) $scope.org_units = egEnv.aou.list.map( function(org) {return {shortname : org.shortname(), id : org.id() }}) - // TODO: experiment // if this is useful, it should be moved into a service. @@ -259,13 +260,30 @@ function($scope, $q, $routeParams, $timeout, $window, $location, egEnv, // TODO: function to reset all tips }; + // TODO: + // another experiment -- user prefs in localStorage -- this should + // be a service, which can also check (certain) user/org settings + $scope.applyShowExtras = function($event, bool) { + $scope.showExtras = bool; + $window.localStorage.setItem('eg.prefs.circ.patron.search.showExtras', bool); + $event.preventDefault(); + } + // localStorage stores strings; parse the values as JSON bools + $scope.showExtras = JSON.parse($window.localStorage.getItem( + 'eg.prefs.circ.patron.search.showExtras')) || false; + // map form arguments into search params function compileSearch(args) { var search = {}; angular.forEach(args, function(val, key) { if (!val) return; - if (key.match(/home_ou|inactive/)) return; // separate API param - search[key] = {value : val, group : 0}; + if (key == 'profile') { + search.profile = {value : args.profile.id, group : 0}; + } else if (key == 'home_ou') { + search.home_ou = args.home_ou.id; // passed separately + } else { + search[key] = {value : val, group : 0}; + } if (key.match(/phone|ident/)) { search[key].group = 2; } else { @@ -276,12 +294,20 @@ function($scope, $q, $routeParams, $timeout, $window, $location, egEnv, } } }); + return search; } // send compiled search; get user IDs function sendSearch(args) { search = compileSearch(args); + + var home_ou = search.home_ou; + delete search.home_ou; + var inactive = search.inactive; + delete search.inactive; + + console.debug('patron search ' + js2JSON(search)); egNet.request( 'open-ils.actor', 'open-ils.actor.patron.search.advanced', @@ -292,8 +318,8 @@ function($scope, $q, $routeParams, $timeout, $window, $location, egEnv, "second_given_name ASC", "dob DESC" ], - args.inactive, - args.home_ou + inactive, + home_ou ).then(function(ids) { retrieveUsers(ids);