|
Lines 18-26
$(document).ready(function(){
Link Here
|
| 18 |
search = 0; |
18 |
search = 0; |
| 19 |
[% END %] |
19 |
[% END %] |
| 20 |
|
20 |
|
| 21 |
$("#searchmember_filter").on('keyup', function(){ |
|
|
| 22 |
filter(); |
| 23 |
}); |
| 24 |
// Apply DataTables on the results table |
21 |
// Apply DataTables on the results table |
| 25 |
dtMemberResults = $("#memberresultst").dataTable($.extend(true, {}, dataTablesDefaults, { |
22 |
dtMemberResults = $("#memberresultst").dataTable($.extend(true, {}, dataTablesDefaults, { |
| 26 |
'bServerSide': true, |
23 |
'bServerSide': true, |
|
Lines 33-38
$(document).ready(function(){
Link Here
|
| 33 |
'name': 'searchmember', |
30 |
'name': 'searchmember', |
| 34 |
'value': $("#searchmember_filter").val() |
31 |
'value': $("#searchmember_filter").val() |
| 35 |
},{ |
32 |
},{ |
|
|
33 |
'name': 'firstletter', |
| 34 |
'value': $("#firstletter_filter").val() |
| 35 |
},{ |
| 36 |
'name': 'categorycode', |
| 37 |
'value': $("#categorycode_filter").val() |
| 38 |
},{ |
| 39 |
'name': 'branchcode', |
| 40 |
'value': $("#branchcode_filter").val() |
| 41 |
},{ |
| 36 |
'name': 'name_sorton', |
42 |
'name': 'name_sorton', |
| 37 |
'value': 'borrowers.surname borrowers.firstname' |
43 |
'value': 'borrowers.surname borrowers.firstname' |
| 38 |
},{ |
44 |
},{ |
|
Lines 87-117
$(document).ready(function(){
Link Here
|
| 87 |
'bFilter': false, |
93 |
'bFilter': false, |
| 88 |
'bProcessing': true, |
94 |
'bProcessing': true, |
| 89 |
})); |
95 |
})); |
| 90 |
dtMemberResults.fnAddFilters("filter", 750); |
|
|
| 91 |
}); |
| 92 |
|
96 |
|
| 93 |
var delay = (function(){ |
97 |
$("#searchform").on('submit', filter); |
| 94 |
var timer = 0; |
98 |
}); |
| 95 |
return function(callback, ms){ |
|
|
| 96 |
clearTimeout (timer); |
| 97 |
timer = setTimeout(callback, ms); |
| 98 |
}; |
| 99 |
})(); |
| 100 |
|
99 |
|
| 101 |
function filter() { |
100 |
function filter() { |
| 102 |
search = 1; |
101 |
search = 1; |
| 103 |
|
102 |
$("#firstletter_filter").val(''); |
| 104 |
$("#searchresults").show(); |
103 |
$("#searchresults").show(); |
| 105 |
|
104 |
dtMemberResults.fnDraw(); |
| 106 |
if ( $("#searchmember_filter").val().length > 0 ) { |
|
|
| 107 |
delay(function(){ |
| 108 |
dtMemberResults.fnDraw(); |
| 109 |
}, 1000); |
| 110 |
} |
| 111 |
|
| 112 |
return false; |
105 |
return false; |
| 113 |
} |
106 |
} |
| 114 |
|
107 |
|
|
|
108 |
// User has clicked on a letter |
| 109 |
function filterByFirstLetterSurname(letter) { |
| 110 |
$("#firstletter_filter").val(letter); |
| 111 |
search = 1; |
| 112 |
$("#searchresults").show(); |
| 113 |
dtMemberResults.fnDraw(); |
| 114 |
} |
| 115 |
|
| 116 |
|
| 115 |
// modify parent window owner element |
117 |
// modify parent window owner element |
| 116 |
[% IF selection_type == 'add' %] |
118 |
[% IF selection_type == 'add' %] |
| 117 |
function add_user(borrowernumber, borrowername) { |
119 |
function add_user(borrowernumber, borrowername) { |
|
Lines 152-169
function filter() {
Link Here
|
| 152 |
<div id="bd"> |
154 |
<div id="bd"> |
| 153 |
<div class="yui-g"> |
155 |
<div class="yui-g"> |
| 154 |
|
156 |
|
| 155 |
<h3>Search for patron</h3> |
157 |
<form id="searchform"> |
| 156 |
|
158 |
<fieldset class="brief"> |
| 157 |
<label for="searchmember_filter">Search:</label> |
159 |
<h3>Search for patron</h3> |
| 158 |
<input type="text" id="searchmember_filter" value="[% searchmember %]"/> |
160 |
<ol> |
|
|
161 |
<li> |
| 162 |
<label for="searchmember_filter">Search:</label> |
| 163 |
<input type="text" id="searchmember_filter" value="[% searchmember %]"/> |
| 164 |
</li> |
| 165 |
<li> |
| 166 |
<label for="categorycode_filter">Category:</label> |
| 167 |
<select id="categorycode_filter"> |
| 168 |
<option value="">Any</option> |
| 169 |
[% FOREACH category IN categories %] |
| 170 |
<option value="[% category.categorycode %]">[% category.description %]</option> |
| 171 |
[% END %] |
| 172 |
</select> |
| 173 |
</li> |
| 174 |
<li> |
| 175 |
<label for="branchcode_filter">Library:</label> |
| 176 |
<select id="branchcode_filter"> |
| 177 |
[% IF branches.size != 1 %] |
| 178 |
<option value="">Any</option> |
| 179 |
[% END %] |
| 180 |
[% FOREACH branch IN branches %] |
| 181 |
<option value="[% branch.branchcode %]">[% branch.branchname %]</option> |
| 182 |
[% END %] |
| 183 |
</select> |
| 184 |
</li> |
| 185 |
</ol> |
| 186 |
<fieldset class="action"> |
| 187 |
<input type="submit" value="Search" /> |
| 188 |
</fieldset> |
| 189 |
</fieldset> |
| 190 |
<form> |
| 159 |
|
191 |
|
| 160 |
[% IF patrons_with_acq_perm_only %] |
192 |
[% IF patrons_with_acq_perm_only %] |
| 161 |
<div class="hint">Only staff with superlibrarian or acquisitions permissions (or order_manage permission if granular permissions are enabled) are returned in the search results</div> |
193 |
<div class="hint">Only staff with superlibrarian or acquisitions permissions (or order_manage permission if granular permissions are enabled) are returned in the search results</div> |
| 162 |
[% END %] |
194 |
[% END %] |
| 163 |
|
195 |
|
|
|
196 |
<div class="browse"> |
| 197 |
Browse by last name: |
| 198 |
[% FOREACH letter IN alphabet.split(' ') %] |
| 199 |
<a style="cursor:pointer" onclick="filterByFirstLetterSurname('[% letter %]');">[% letter %]</a> |
| 200 |
[% END %] |
| 201 |
</div> |
| 202 |
|
| 164 |
<div id="info" class="dialog message"></div> |
203 |
<div id="info" class="dialog message"></div> |
| 165 |
<div id="error" class="dialog alert"></div> |
204 |
<div id="error" class="dialog alert"></div> |
| 166 |
|
205 |
|
|
|
206 |
<input type="hidden" id="firstletter_filter" value="" /> |
| 167 |
<div id="searchresults"> |
207 |
<div id="searchresults"> |
| 168 |
<table id="memberresultst"> |
208 |
<table id="memberresultst"> |
| 169 |
<thead> |
209 |
<thead> |