Lines 2-321
Link Here
|
2 |
[% USE ColumnsSettings %] |
2 |
[% USE ColumnsSettings %] |
3 |
[% USE Branches %] |
3 |
[% USE Branches %] |
4 |
[% USE Categories %] |
4 |
[% USE Categories %] |
|
|
5 |
[% SET footerjs = 1 %] |
5 |
[% INCLUDE 'doc-head-open.inc' %] |
6 |
[% INCLUDE 'doc-head-open.inc' %] |
6 |
<title>Koha › Patrons [% IF ( searching ) %]› Search results[% END %]</title> |
7 |
<title>Koha › Patrons [% IF ( searching ) %]› Search results[% END %]</title> |
7 |
[% INCLUDE 'doc-head-close.inc' %] |
8 |
[% INCLUDE 'doc-head-close.inc' %] |
8 |
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> |
9 |
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> |
9 |
[% INCLUDE 'datatables.inc' %] |
|
|
10 |
[% INCLUDE 'columns_settings.inc' %] |
11 |
<script type="text/javascript"> |
12 |
//<![CDATA[ |
13 |
$(document).ready(function() { |
14 |
$('#add_to_patron_list_submit').prop('disabled', true); |
15 |
$('#new_patron_list').hide(); |
16 |
|
17 |
$('#add_to_patron_list').change(function() { |
18 |
var value = $('#add_to_patron_list').val(); |
19 |
if ( value == 'new' ) { |
20 |
$('#new_patron_list').val('') |
21 |
$('#new_patron_list').show(); |
22 |
$('#new_patron_list').focus(); |
23 |
} else if ( value ) { |
24 |
$('#new_patron_list').hide(); |
25 |
$('#add_to_patron_list_submit').prop('disabled', false); |
26 |
} else { |
27 |
$('#new_patron_list').hide(); |
28 |
$('#add_to_patron_list_submit').prop('disabled', true); |
29 |
} |
30 |
}); |
31 |
|
32 |
$('#new_patron_list').on('input', function() { |
33 |
if ( $('#new_patron_list').val() ) { |
34 |
$('#add_to_patron_list_submit').prop('disabled', false); |
35 |
} else { |
36 |
$('#add_to_patron_list_submit').prop('disabled', true); |
37 |
} |
38 |
}); |
39 |
|
40 |
$("#add_to_patron_list_submit").on('click', function(e){ |
41 |
if ( $('#add_to_patron_list').val() == 'new' ) { |
42 |
if ( $('#new_patron_list').val() ) { |
43 |
$("#add_to_patron_list option").each(function() { |
44 |
if ( $(this).text() == $('#new_patron_list').val() ) { |
45 |
alert( _("You already have a list with that name!") ); |
46 |
return false; |
47 |
} |
48 |
}); |
49 |
} else { |
50 |
alert( _("You must give your new patron list a name!") ); |
51 |
return false; |
52 |
} |
53 |
} |
54 |
|
55 |
if ( $("#memberresultst input:checkbox:checked").length == 0 ) { |
56 |
alert( _("You have not selected any patrons to add to a list!") ); |
57 |
return false; |
58 |
} |
59 |
|
60 |
var borrowernumbers = []; |
61 |
$("#memberresultst").find("input:checkbox:checked").each(function(){ |
62 |
borrowernumbers.push($(this).val()); |
63 |
}); |
64 |
var data = { |
65 |
add_to_patron_list: $("#add_to_patron_list").val(), |
66 |
new_patron_list: $("#new_patron_list").val(), |
67 |
borrowernumbers: borrowernumbers |
68 |
}; |
69 |
$.ajax({ |
70 |
data: data, |
71 |
type: 'POST', |
72 |
url: '/cgi-bin/koha/svc/members/add_to_list', |
73 |
success: function(data) { |
74 |
$("#patron_list_dialog").show(); |
75 |
$("#patron_list_dialog > span.patrons-length").html(data.patrons_added_to_list); |
76 |
$("#patron_list_dialog > a").attr("href", "/cgi-bin/koha/patron_lists/list.pl?patron_list_id=" + data.patron_list.patron_list_id); |
77 |
$("#patron_list_dialog > a").html(data.patron_list.name); |
78 |
if ( $('#add_to_patron_list').val() == 'new' ) { |
79 |
var new_patron_list_added = $("<option>", { |
80 |
value: data.patron_list.patron_list_id, |
81 |
text: data.patron_list.name |
82 |
}); |
83 |
$("#add_to_patron_list optgroup").append(new_patron_list_added); |
84 |
$("#add_to_patron_list").val(data.patron_list.patron_list_id); |
85 |
$("#new_patron_list").val(''); |
86 |
$('#add_to_patron_list').change(); |
87 |
} |
88 |
}, |
89 |
error: function() { |
90 |
alert("an error occurred"); |
91 |
} |
92 |
}); |
93 |
return true; |
94 |
}); |
95 |
$(".filterByLetter").on("click",function(e){ |
96 |
e.preventDefault(); |
97 |
filterByFirstLetterSurname($(this).text()); |
98 |
}); |
99 |
$("#select_all").on("click",function(e){ |
100 |
e.preventDefault(); |
101 |
$(".selection").prop("checked", true); |
102 |
}); |
103 |
$("#clear_all").on("click",function(e){ |
104 |
e.preventDefault(); |
105 |
$(".selection").prop("checked", false); |
106 |
}); |
107 |
$("#clear_search").on("click",function(e){ |
108 |
e.preventDefault(); |
109 |
clearFilters(true); |
110 |
}); |
111 |
$("#searchform").on("submit", filter); |
112 |
}); |
113 |
|
114 |
var dtMemberResults; |
115 |
var search = 1; |
116 |
$(document).ready(function() { |
117 |
[% IF searchmember %] |
118 |
$("#searchmember_filter").val("[% searchmember | html %]"); |
119 |
[% END %] |
120 |
[% IF searchfieldstype %] |
121 |
$("searchfieldstype_filter").val("[% searchfieldstype %]"); |
122 |
[% END %] |
123 |
[% IF searchtype %] |
124 |
$("#searchtype_filter").val("[% searchtype %]"); |
125 |
[% END %] |
126 |
[% IF categorycode %] |
127 |
$("#categorycode_filter").val("[% categorycode_filter %]"); |
128 |
[% END %] |
129 |
[% IF branchcode %] |
130 |
$("#branchcode_filter").val("[% branchcode_filter %]"); |
131 |
[% END %] |
132 |
|
133 |
[% IF view != "show_results" %] |
134 |
search = 0; |
135 |
[% ELSE %] |
136 |
$("#searchresults").show(); |
137 |
[% END %] |
138 |
|
139 |
// Build the aLengthMenu |
140 |
var aLengthMenu = [ |
141 |
[%PatronsPerPage %], 10, 20, 50, 100, -1 |
142 |
]; |
143 |
jQuery.unique(aLengthMenu); |
144 |
aLengthMenu.sort(function( a, b ){ |
145 |
// Put "All" at the end |
146 |
if ( a == -1 ) { |
147 |
return 1; |
148 |
} else if ( b == -1 ) { |
149 |
return -1; |
150 |
} |
151 |
return parseInt(a) < parseInt(b) ? -1 : 1;} |
152 |
); |
153 |
var aLengthMenuLabel = []; |
154 |
$(aLengthMenu).each(function(){ |
155 |
if ( this == -1 ) { |
156 |
// Label for -1 is "All" |
157 |
aLengthMenuLabel.push("All"); |
158 |
} else { |
159 |
aLengthMenuLabel.push(this); |
160 |
} |
161 |
}); |
162 |
|
163 |
// Apply DataTables on the results table |
164 |
var columns_settings = [% ColumnsSettings.GetColumns( 'members', 'member', 'memberresultst', 'json' ) %]; |
165 |
[% UNLESS CAN_user_tools_manage_patron_lists %] |
166 |
[%# Remove the first column if we do not display the checkbox %] |
167 |
columns_settings.splice(0, 1); |
168 |
[% END %] |
169 |
dtMemberResults = KohaTable("#memberresultst", { |
170 |
'bServerSide': true, |
171 |
'sAjaxSource': "/cgi-bin/koha/svc/members/search", |
172 |
'fnServerData': function(sSource, aoData, fnCallback) { |
173 |
if ( ! search ) { |
174 |
return; |
175 |
} |
176 |
aoData.push({ |
177 |
'name': 'searchmember', |
178 |
'value': $("#searchmember_filter").val() |
179 |
},{ |
180 |
'name': 'firstletter', |
181 |
'value': $("#firstletter_filter").val() |
182 |
},{ |
183 |
'name': 'searchfieldstype', |
184 |
'value': $("#searchfieldstype_filter").val() |
185 |
},{ |
186 |
'name': 'searchtype', |
187 |
'value': $("#searchtype_filter").val() |
188 |
},{ |
189 |
'name': 'categorycode', |
190 |
'value': $("#categorycode_filter").val() |
191 |
},{ |
192 |
'name': 'branchcode', |
193 |
'value': $("#branchcode_filter").val() |
194 |
},{ |
195 |
'name': 'name_sorton', |
196 |
'value': 'borrowers.surname borrowers.firstname' |
197 |
},{ |
198 |
'name': 'dateofbirth', |
199 |
'value': 'borrowers.dateofbirth', |
200 |
},{ |
201 |
'name': 'category_sorton', |
202 |
'value': 'categories.description', |
203 |
},{ |
204 |
'name': 'branch_sorton', |
205 |
'value': 'branches.branchname' |
206 |
},{ |
207 |
'name': 'template_path', |
208 |
'value': 'members/tables/members_results.tt', |
209 |
}); |
210 |
$.ajax({ |
211 |
'dataType': 'json', |
212 |
'type': 'POST', |
213 |
'url': sSource, |
214 |
'data': aoData, |
215 |
'success': function(json){ |
216 |
// redirect if there is only 1 result. |
217 |
if ( json.aaData.length == 1 ) { |
218 |
var borrowernumber = json.aaData[0].borrowernumber; |
219 |
document.location.href="/cgi-bin/koha/members/moremember.pl?borrowernumber="+borrowernumber; |
220 |
return false; |
221 |
} |
222 |
fnCallback(json); |
223 |
} |
224 |
}); |
225 |
}, |
226 |
'aoColumns':[ |
227 |
[% IF CAN_user_tools_manage_patron_lists %] |
228 |
{ 'mDataProp': 'dt_borrowernumber', 'bSortable': false }, |
229 |
[% END %] |
230 |
{ 'mDataProp': 'dt_cardnumber' }, |
231 |
{ 'mDataProp': 'dt_name' }, |
232 |
{ 'mDataProp': 'dt_dateofbirth' }, |
233 |
{ 'mDataProp': 'dt_category' }, |
234 |
{ 'mDataProp': 'dt_branch' }, |
235 |
{ 'mDataProp': 'dt_dateexpiry' }, |
236 |
{ 'mDataProp': 'dt_od_checkouts', 'bSortable': false }, |
237 |
{ 'mDataProp': 'dt_fines', 'bSortable': false }, |
238 |
{ 'mDataProp': 'dt_borrowernotes' }, |
239 |
{ 'mDataProp': 'dt_action', 'bSortable': false, 'sClass': 'actions' } |
240 |
], |
241 |
'fnRowCallback': function(nRow, aData, iDisplayIndex, iDisplayIndexFull) { |
242 |
/* Center text for 6th column */ |
243 |
$("td:eq(5)", nRow).css("text-align", "center"); |
244 |
|
245 |
return nRow; |
246 |
}, |
247 |
'bFilter': false, |
248 |
'bAutoWidth': false, |
249 |
[% IF CAN_user_tools_manage_patron_lists %] |
250 |
'aaSorting': [[2, 'asc']], |
251 |
[% ELSE %] |
252 |
'aaSorting': [[1, 'asc']], |
253 |
[% END %] |
254 |
"aLengthMenu": [aLengthMenu, aLengthMenuLabel], |
255 |
'sPaginationType': 'full_numbers', |
256 |
"iDisplayLength": [% PatronsPerPage %], |
257 |
"bProcessing": true, |
258 |
}, columns_settings); |
259 |
update_searched(); |
260 |
}); |
261 |
|
262 |
// Update the string "Results found ..." |
263 |
function update_searched(){ |
264 |
var searched = $("#searchfieldstype_filter").find("option:selected").text(); |
265 |
if ( $("#searchmember_filter").val() ) { |
266 |
if ( $("#searchtype_filter").val() == 'start_with' ) { |
267 |
searched += _(" starting with "); |
268 |
} else { |
269 |
searched += _(" containing "); |
270 |
} |
271 |
searched += "'" + $("#searchmember_filter").val() + "'"; |
272 |
} |
273 |
if ( $("#firstletter_filter").val() ) { |
274 |
searched += _(" begins with ") + "'" + $("#firstletter_filter").val() +"'"; |
275 |
} |
276 |
if ( $("#categorycode_filter").val() ) { |
277 |
searched += _(" with category ") + "'" + $("#categorycode_filter").find("option:selected").text() + "'"; |
278 |
} |
279 |
if ( $("#branchcode_filter").val() ) { |
280 |
searched += _(" in library ") + $("#branchcode_filter").find("option:selected").text(); |
281 |
} |
282 |
$("#searchpattern").text(searched); |
283 |
} |
284 |
|
285 |
// Redraw the table |
286 |
function filter() { |
287 |
$("#firstletter_filter").val(''); |
288 |
update_searched(); |
289 |
search = 1; |
290 |
$("#searchresults").show(); |
291 |
dtMemberResults.fnDraw(); |
292 |
return false; |
293 |
} |
294 |
|
295 |
// User has clicked on the Clear button |
296 |
function clearFilters(redraw) { |
297 |
$("#searchform select").val(''); |
298 |
$("#firstletter_filter").val(''); |
299 |
$("#searchmember_filter").val(''); |
300 |
if(redraw) { |
301 |
search = 1; |
302 |
$("#searchresults").show(); |
303 |
dtMemberResults.fnDraw(); |
304 |
} |
305 |
} |
306 |
|
307 |
// User has clicked on a letter |
308 |
function filterByFirstLetterSurname(letter) { |
309 |
clearFilters(false); |
310 |
$("#firstletter_filter").val(letter); |
311 |
update_searched(); |
312 |
search = 1; |
313 |
$("#searchresults").show(); |
314 |
dtMemberResults.fnDraw(); |
315 |
} |
316 |
//]]> |
317 |
</script> |
318 |
</head> |
10 |
</head> |
|
|
11 |
|
319 |
<body id="pat_member" class="pat"> |
12 |
<body id="pat_member" class="pat"> |
320 |
[% INCLUDE 'header.inc' %] |
13 |
[% INCLUDE 'header.inc' %] |
321 |
[% INCLUDE 'patron-search.inc' %] |
14 |
[% INCLUDE 'patron-search.inc' %] |
Lines 527-530
function filterByFirstLetterSurname(letter) {
Link Here
|
527 |
[% INCLUDE 'members-menu.inc' %] |
220 |
[% INCLUDE 'members-menu.inc' %] |
528 |
</div> |
221 |
</div> |
529 |
</div> |
222 |
</div> |
|
|
223 |
|
224 |
[% MACRO jsinclude BLOCK %] |
225 |
[% INCLUDE 'datatables.inc' %] |
226 |
[% INCLUDE 'columns_settings.inc' %] |
227 |
<script type="text/javascript" src="[% interface %]/[% theme %]/js/members-menu.js"></script> |
228 |
<script type="text/javascript"> |
229 |
$(document).ready(function() { |
230 |
$('#add_to_patron_list_submit').prop('disabled', true); |
231 |
$('#new_patron_list').hide(); |
232 |
|
233 |
$('#add_to_patron_list').change(function() { |
234 |
var value = $('#add_to_patron_list').val(); |
235 |
if ( value == 'new' ) { |
236 |
$('#new_patron_list').val('') |
237 |
$('#new_patron_list').show(); |
238 |
$('#new_patron_list').focus(); |
239 |
} else if ( value ) { |
240 |
$('#new_patron_list').hide(); |
241 |
$('#add_to_patron_list_submit').prop('disabled', false); |
242 |
} else { |
243 |
$('#new_patron_list').hide(); |
244 |
$('#add_to_patron_list_submit').prop('disabled', true); |
245 |
} |
246 |
}); |
247 |
|
248 |
$('#new_patron_list').on('input', function() { |
249 |
if ( $('#new_patron_list').val() ) { |
250 |
$('#add_to_patron_list_submit').prop('disabled', false); |
251 |
} else { |
252 |
$('#add_to_patron_list_submit').prop('disabled', true); |
253 |
} |
254 |
}); |
255 |
|
256 |
$("#add_to_patron_list_submit").on('click', function(e){ |
257 |
if ( $('#add_to_patron_list').val() == 'new' ) { |
258 |
if ( $('#new_patron_list').val() ) { |
259 |
$("#add_to_patron_list option").each(function() { |
260 |
if ( $(this).text() == $('#new_patron_list').val() ) { |
261 |
alert( _("You already have a list with that name!") ); |
262 |
return false; |
263 |
} |
264 |
}); |
265 |
} else { |
266 |
alert( _("You must give your new patron list a name!") ); |
267 |
return false; |
268 |
} |
269 |
} |
270 |
|
271 |
if ( $("#memberresultst input:checkbox:checked").length == 0 ) { |
272 |
alert( _("You have not selected any patrons to add to a list!") ); |
273 |
return false; |
274 |
} |
275 |
|
276 |
var borrowernumbers = []; |
277 |
$("#memberresultst").find("input:checkbox:checked").each(function(){ |
278 |
borrowernumbers.push($(this).val()); |
279 |
}); |
280 |
var data = { |
281 |
add_to_patron_list: $("#add_to_patron_list").val(), |
282 |
new_patron_list: $("#new_patron_list").val(), |
283 |
borrowernumbers: borrowernumbers |
284 |
}; |
285 |
$.ajax({ |
286 |
data: data, |
287 |
type: 'POST', |
288 |
url: '/cgi-bin/koha/svc/members/add_to_list', |
289 |
success: function(data) { |
290 |
$("#patron_list_dialog").show(); |
291 |
$("#patron_list_dialog > span.patrons-length").html(data.patrons_added_to_list); |
292 |
$("#patron_list_dialog > a").attr("href", "/cgi-bin/koha/patron_lists/list.pl?patron_list_id=" + data.patron_list.patron_list_id); |
293 |
$("#patron_list_dialog > a").html(data.patron_list.name); |
294 |
if ( $('#add_to_patron_list').val() == 'new' ) { |
295 |
var new_patron_list_added = $("<option>", { |
296 |
value: data.patron_list.patron_list_id, |
297 |
text: data.patron_list.name |
298 |
}); |
299 |
$("#add_to_patron_list optgroup").append(new_patron_list_added); |
300 |
$("#add_to_patron_list").val(data.patron_list.patron_list_id); |
301 |
$("#new_patron_list").val(''); |
302 |
$('#add_to_patron_list').change(); |
303 |
} |
304 |
}, |
305 |
error: function() { |
306 |
alert("an error occurred"); |
307 |
} |
308 |
}); |
309 |
return true; |
310 |
}); |
311 |
$(".filterByLetter").on("click",function(e){ |
312 |
e.preventDefault(); |
313 |
filterByFirstLetterSurname($(this).text()); |
314 |
}); |
315 |
$("#select_all").on("click",function(e){ |
316 |
e.preventDefault(); |
317 |
$(".selection").prop("checked", true); |
318 |
}); |
319 |
$("#clear_all").on("click",function(e){ |
320 |
e.preventDefault(); |
321 |
$(".selection").prop("checked", false); |
322 |
}); |
323 |
$("#clear_search").on("click",function(e){ |
324 |
e.preventDefault(); |
325 |
clearFilters(true); |
326 |
}); |
327 |
$("#searchform").on("submit", filter); |
328 |
}); |
329 |
|
330 |
var dtMemberResults; |
331 |
var search = 1; |
332 |
$(document).ready(function() { |
333 |
[% IF searchmember %] |
334 |
$("#searchmember_filter").val("[% searchmember | html %]"); |
335 |
[% END %] |
336 |
[% IF searchfieldstype %] |
337 |
$("searchfieldstype_filter").val("[% searchfieldstype %]"); |
338 |
[% END %] |
339 |
[% IF searchtype %] |
340 |
$("#searchtype_filter").val("[% searchtype %]"); |
341 |
[% END %] |
342 |
[% IF categorycode %] |
343 |
$("#categorycode_filter").val("[% categorycode_filter %]"); |
344 |
[% END %] |
345 |
[% IF branchcode %] |
346 |
$("#branchcode_filter").val("[% branchcode_filter %]"); |
347 |
[% END %] |
348 |
|
349 |
[% IF view != "show_results" %] |
350 |
search = 0; |
351 |
[% ELSE %] |
352 |
$("#searchresults").show(); |
353 |
[% END %] |
354 |
|
355 |
// Build the aLengthMenu |
356 |
var aLengthMenu = [ |
357 |
[%PatronsPerPage %], 10, 20, 50, 100, -1 |
358 |
]; |
359 |
jQuery.unique(aLengthMenu); |
360 |
aLengthMenu.sort(function( a, b ){ |
361 |
// Put "All" at the end |
362 |
if ( a == -1 ) { |
363 |
return 1; |
364 |
} else if ( b == -1 ) { |
365 |
return -1; |
366 |
} |
367 |
return parseInt(a) < parseInt(b) ? -1 : 1;} |
368 |
); |
369 |
var aLengthMenuLabel = []; |
370 |
$(aLengthMenu).each(function(){ |
371 |
if ( this == -1 ) { |
372 |
// Label for -1 is "All" |
373 |
aLengthMenuLabel.push("All"); |
374 |
} else { |
375 |
aLengthMenuLabel.push(this); |
376 |
} |
377 |
}); |
378 |
|
379 |
// Apply DataTables on the results table |
380 |
var columns_settings = [% ColumnsSettings.GetColumns( 'members', 'member', 'memberresultst', 'json' ) %]; |
381 |
[% UNLESS CAN_user_tools_manage_patron_lists %] |
382 |
[%# Remove the first column if we do not display the checkbox %] |
383 |
columns_settings.splice(0, 1); |
384 |
[% END %] |
385 |
dtMemberResults = KohaTable("#memberresultst", { |
386 |
'bServerSide': true, |
387 |
'sAjaxSource': "/cgi-bin/koha/svc/members/search", |
388 |
'fnServerData': function(sSource, aoData, fnCallback) { |
389 |
if ( ! search ) { |
390 |
return; |
391 |
} |
392 |
aoData.push({ |
393 |
'name': 'searchmember', |
394 |
'value': $("#searchmember_filter").val() |
395 |
},{ |
396 |
'name': 'firstletter', |
397 |
'value': $("#firstletter_filter").val() |
398 |
},{ |
399 |
'name': 'searchfieldstype', |
400 |
'value': $("#searchfieldstype_filter").val() |
401 |
},{ |
402 |
'name': 'searchtype', |
403 |
'value': $("#searchtype_filter").val() |
404 |
},{ |
405 |
'name': 'categorycode', |
406 |
'value': $("#categorycode_filter").val() |
407 |
},{ |
408 |
'name': 'branchcode', |
409 |
'value': $("#branchcode_filter").val() |
410 |
},{ |
411 |
'name': 'name_sorton', |
412 |
'value': 'borrowers.surname borrowers.firstname' |
413 |
},{ |
414 |
'name': 'dateofbirth', |
415 |
'value': 'borrowers.dateofbirth', |
416 |
},{ |
417 |
'name': 'category_sorton', |
418 |
'value': 'categories.description', |
419 |
},{ |
420 |
'name': 'branch_sorton', |
421 |
'value': 'branches.branchname' |
422 |
},{ |
423 |
'name': 'template_path', |
424 |
'value': 'members/tables/members_results.tt', |
425 |
}); |
426 |
$.ajax({ |
427 |
'dataType': 'json', |
428 |
'type': 'POST', |
429 |
'url': sSource, |
430 |
'data': aoData, |
431 |
'success': function(json){ |
432 |
// redirect if there is only 1 result. |
433 |
if ( json.aaData.length == 1 ) { |
434 |
var borrowernumber = json.aaData[0].borrowernumber; |
435 |
document.location.href="/cgi-bin/koha/members/moremember.pl?borrowernumber="+borrowernumber; |
436 |
return false; |
437 |
} |
438 |
fnCallback(json); |
439 |
} |
440 |
}); |
441 |
}, |
442 |
'aoColumns':[ |
443 |
[% IF CAN_user_tools_manage_patron_lists %] |
444 |
{ 'mDataProp': 'dt_borrowernumber', 'bSortable': false }, |
445 |
[% END %] |
446 |
{ 'mDataProp': 'dt_cardnumber' }, |
447 |
{ 'mDataProp': 'dt_name' }, |
448 |
{ 'mDataProp': 'dt_dateofbirth' }, |
449 |
{ 'mDataProp': 'dt_category' }, |
450 |
{ 'mDataProp': 'dt_branch' }, |
451 |
{ 'mDataProp': 'dt_dateexpiry' }, |
452 |
{ 'mDataProp': 'dt_od_checkouts', 'bSortable': false }, |
453 |
{ 'mDataProp': 'dt_fines', 'bSortable': false }, |
454 |
{ 'mDataProp': 'dt_borrowernotes' }, |
455 |
{ 'mDataProp': 'dt_action', 'bSortable': false, 'sClass': 'actions' } |
456 |
], |
457 |
'fnRowCallback': function(nRow, aData, iDisplayIndex, iDisplayIndexFull) { |
458 |
/* Center text for 6th column */ |
459 |
$("td:eq(5)", nRow).css("text-align", "center"); |
460 |
|
461 |
return nRow; |
462 |
}, |
463 |
'bFilter': false, |
464 |
'bAutoWidth': false, |
465 |
[% IF CAN_user_tools_manage_patron_lists %] |
466 |
'aaSorting': [[2, 'asc']], |
467 |
[% ELSE %] |
468 |
'aaSorting': [[1, 'asc']], |
469 |
[% END %] |
470 |
"aLengthMenu": [aLengthMenu, aLengthMenuLabel], |
471 |
'sPaginationType': 'full_numbers', |
472 |
"iDisplayLength": [% PatronsPerPage %], |
473 |
"bProcessing": true, |
474 |
}, columns_settings); |
475 |
update_searched(); |
476 |
}); |
477 |
|
478 |
// Update the string "Results found ..." |
479 |
function update_searched(){ |
480 |
var searched = $("#searchfieldstype_filter").find("option:selected").text(); |
481 |
if ( $("#searchmember_filter").val() ) { |
482 |
if ( $("#searchtype_filter").val() == 'start_with' ) { |
483 |
searched += _(" starting with "); |
484 |
} else { |
485 |
searched += _(" containing "); |
486 |
} |
487 |
searched += "'" + $("#searchmember_filter").val() + "'"; |
488 |
} |
489 |
if ( $("#firstletter_filter").val() ) { |
490 |
searched += _(" begins with ") + "'" + $("#firstletter_filter").val() +"'"; |
491 |
} |
492 |
if ( $("#categorycode_filter").val() ) { |
493 |
searched += _(" with category ") + "'" + $("#categorycode_filter").find("option:selected").text() + "'"; |
494 |
} |
495 |
if ( $("#branchcode_filter").val() ) { |
496 |
searched += _(" in library ") + $("#branchcode_filter").find("option:selected").text(); |
497 |
} |
498 |
$("#searchpattern").text(searched); |
499 |
} |
500 |
|
501 |
// Redraw the table |
502 |
function filter() { |
503 |
$("#firstletter_filter").val(''); |
504 |
update_searched(); |
505 |
search = 1; |
506 |
$("#searchresults").show(); |
507 |
dtMemberResults.fnDraw(); |
508 |
return false; |
509 |
} |
510 |
|
511 |
// User has clicked on the Clear button |
512 |
function clearFilters(redraw) { |
513 |
$("#searchform select").val(''); |
514 |
$("#firstletter_filter").val(''); |
515 |
$("#searchmember_filter").val(''); |
516 |
if(redraw) { |
517 |
search = 1; |
518 |
$("#searchresults").show(); |
519 |
dtMemberResults.fnDraw(); |
520 |
} |
521 |
} |
522 |
|
523 |
// User has clicked on a letter |
524 |
function filterByFirstLetterSurname(letter) { |
525 |
clearFilters(false); |
526 |
$("#firstletter_filter").val(letter); |
527 |
update_searched(); |
528 |
search = 1; |
529 |
$("#searchresults").show(); |
530 |
dtMemberResults.fnDraw(); |
531 |
} |
532 |
</script> |
533 |
[% END %] |
534 |
|
530 |
[% INCLUDE 'intranet-bottom.inc' %] |
535 |
[% INCLUDE 'intranet-bottom.inc' %] |