<div>{{selected_field_doc.string()}}</div>
</fieldset>
+<div id="reg-dupe-links">
+ [%# dupe_search_encoded is uri escaped in the JS %]
+ <div>
+ <a target="_blank" ng-show="dupe_counts.name"
+ href="/eg/staff/circ/patron/search?search={{dupe_search_encoded}}" >
+ [% l('Found [_1] patron(s) with the same name', '{{dupe_counts.name}}') %]
+ </a>
+ </div>
+ <div>
+ <a target="_blank" ng-show="dupe_counts.email"
+ href="/eg/staff/circ/patron/search?search={{dupe_search_encoded}}" >
+ [% l('Found [_1] patron(s) with the same email address',
+ '{{dupe_counts.email}}') %]</a>
+ </div>
+ <div>
+ <a target="_blank" ng-show="dupe_counts.ident"
+ href="/eg/staff/circ/patron/search?search={{dupe_search_encoded}}" >
+ [% l('Found [_1] patron(s) with the same identification',
+ '{{dupe_counts.ident}}') %]</a>
+ </div>
+ <div>
+ <a target="_blank" ng-show="dupe_counts.phone"
+ href="/eg/staff/circ/patron/search?search={{dupe_search_encoded}}" >
+ [% l('Found [_1] patron(s) with the same phone number',
+ '{{dupe_counts.phone}}') %]</a>
+ </div>
+ <div>
+ <a target="_blank" ng-show="dupe_counts.address"
+ href="/eg/staff/circ/patron/search?search={{dupe_search_encoded}}" >
+ [% l('Found [_1] patron(s) with the same address',
+ '{{dupe_counts.address}}') %]</a>
+ </div>
+</div>
+
+
[% MACRO formfield(cls, field, path, input_type) BLOCK;
# input field generator for common text/number/checkbox fields
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%;
// 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;
}
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;
'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
+ };
});
}
// 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
}
$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() {