|
Lines 237-328
Link Here
|
| 237 |
<script> |
237 |
<script> |
| 238 |
var table_settings = [% TablesSettings.GetTableSettings('members', 'patron-lists', 'patron-list-table', 'json') | $raw %] |
238 |
var table_settings = [% TablesSettings.GetTableSettings('members', 'patron-lists', 'patron-list-table', 'json') | $raw %] |
| 239 |
</script> |
239 |
</script> |
| 240 |
|
|
|
| 241 |
<script> |
240 |
<script> |
| 242 |
$(document).ready(function() { |
241 |
$(document).ready(function () { |
| 243 |
$('#patrons_to_add_fieldset').hide(); |
242 |
$("#patrons_to_add_fieldset").hide(); |
| 244 |
|
243 |
|
| 245 |
$("#patron-list-table").kohaTable( |
244 |
$("#patron-list-table").kohaTable( |
| 246 |
{ |
245 |
{ |
| 247 |
pagingType: "full", |
246 |
pagingType: "full", |
| 248 |
}, |
247 |
}, |
| 249 |
table_settings |
248 |
table_settings |
| 250 |
); |
249 |
); |
| 251 |
|
250 |
|
| 252 |
function RemovePatron( cardnumber, container ) { |
251 |
function RemovePatron(cardnumber, container) { |
| 253 |
$( '#borrower_' + cardnumber ).remove(); |
252 |
$("#borrower_" + cardnumber).remove(); |
| 254 |
|
253 |
|
| 255 |
if ( ! $(container).html() ) { |
254 |
if (!$(container).html()) { |
| 256 |
$(container).parent("fieldset").hide( 800 ); |
255 |
$(container).parent("fieldset").hide(800); |
| 257 |
} |
256 |
} |
| 258 |
} |
257 |
} |
| 259 |
patron_autocomplete($("#find_patron"), { |
258 |
patron_autocomplete($("#find_patron"), { |
| 260 |
"on-select-add-to": { |
259 |
"on-select-add-to": { |
| 261 |
container: $("#patrons_to_add"), |
260 |
container: $("#patrons_to_add"), |
| 262 |
input_name: 'patrons_to_add', |
261 |
input_name: "patrons_to_add", |
| 263 |
}, |
262 |
}, |
| 264 |
"on-select-callback": function( event, ui ) { |
263 |
"on-select-callback": function (event, ui) { |
| 265 |
$("#find_patron").val('').focus(); |
264 |
$("#find_patron").val("").focus(); |
| 266 |
return false; |
265 |
return false; |
| 267 |
} |
266 |
}, |
| 268 |
}); |
267 |
}); |
| 269 |
|
268 |
|
| 270 |
$("body").on("click", "#CheckAll", function(e){ |
269 |
$("body").on("click", "#CheckAll", function (e) { |
| 271 |
e.preventDefault(); |
270 |
e.preventDefault(); |
| 272 |
$("input[type='checkbox']","#patron-list-table").each(function(){ |
271 |
$("input[type='checkbox']", "#patron-list-table").each(function () { |
| 273 |
$(this).prop("checked",1); |
272 |
$(this).prop("checked", 1); |
| 274 |
}); |
273 |
}); |
| 275 |
}); |
274 |
}); |
| 276 |
$("body").on("click", "#CheckNone", function(e){ |
275 |
$("body").on("click", "#CheckNone", function (e) { |
| 277 |
e.preventDefault(); |
276 |
e.preventDefault(); |
| 278 |
$("input[type='checkbox']","#patron-list-table").each(function(){ |
277 |
$("input[type='checkbox']", "#patron-list-table").each(function () { |
| 279 |
$(this).prop("checked",0); |
278 |
$(this).prop("checked", 0); |
| 280 |
}); |
279 |
}); |
| 281 |
}); |
280 |
}); |
| 282 |
|
281 |
|
| 283 |
$("#remove_patrons").submit(function(){ |
282 |
$("#remove_patrons").submit(function () { |
| 284 |
var checkedItems = $("input:checked"); |
283 |
var checkedItems = $("input:checked"); |
| 285 |
if ($(checkedItems).size() == 0) { |
284 |
if ($(checkedItems).size() == 0) { |
| 286 |
alert(_("You must select one or more patrons to remove")); |
285 |
alert(_("You must select one or more patrons to remove")); |
| 287 |
return false; |
286 |
return false; |
| 288 |
} |
287 |
} |
| 289 |
$(checkedItems).parents('tr').addClass("warn"); |
288 |
$(checkedItems).parents("tr").addClass("warn"); |
| 290 |
if( confirm(_("Are you sure you want to remove the selected patrons?")) ) { |
289 |
if (confirm(_("Are you sure you want to remove the selected patrons?"))) { |
| 291 |
return true; |
290 |
return true; |
| 292 |
} else { |
291 |
} else { |
| 293 |
$(checkedItems).parents('tr').removeClass("warn"); |
292 |
$(checkedItems).parents("tr").removeClass("warn"); |
| 294 |
return false; |
293 |
return false; |
| 295 |
} |
294 |
} |
| 296 |
}); |
295 |
}); |
| 297 |
|
296 |
|
| 298 |
$("#add_patrons_by_id a").on("click", function(){ |
297 |
$("#add_patrons_by_id a").on("click", function () { |
| 299 |
$("#add_patrons_by_id, #patron_search_line").hide(); |
298 |
$("#add_patrons_by_id, #patron_search_line").hide(); |
| 300 |
$("#add_patrons_by_search, #patron_ids_line, #patron_ids_submit").show(); |
299 |
$("#add_patrons_by_search, #patron_ids_line, #patron_ids_submit").show(); |
| 301 |
}); |
300 |
}); |
| 302 |
|
301 |
|
| 303 |
$("#add_patrons_by_search a").on("click", function(){ |
302 |
$("#add_patrons_by_search a").on("click", function () { |
| 304 |
$("#add_patrons_by_id, #patron_search_line").show(); |
303 |
$("#add_patrons_by_id, #patron_search_line").show(); |
| 305 |
$("#add_patrons_by_search, #patron_ids_line, #patron_ids_submit").hide(); |
304 |
$("#add_patrons_by_search, #patron_ids_line, #patron_ids_submit").hide(); |
| 306 |
}); |
305 |
}); |
| 307 |
|
306 |
|
| 308 |
$('.merge-patrons').on('click', function() { |
307 |
$(".merge-patrons").on("click", function () { |
| 309 |
var checkedItems = $("input:checked"); |
308 |
var checkedItems = $("input:checked"); |
| 310 |
if ($(checkedItems).length < 2) { |
309 |
if ($(checkedItems).length < 2) { |
| 311 |
alert(_("You must select two or more patrons to merge")); |
310 |
alert(_("You must select two or more patrons to merge")); |
| 312 |
return false; |
311 |
return false; |
| 313 |
} |
312 |
} |
| 314 |
$(checkedItems).parents('tr').addClass("warn"); |
313 |
$(checkedItems).parents("tr").addClass("warn"); |
| 315 |
if (confirm(_("Are you sure you want to merge the selected patrons?"))) { |
314 |
if (confirm(_("Are you sure you want to merge the selected patrons?"))) { |
| 316 |
var merge_patrons_url = '/cgi-bin/koha/members/merge-patrons.pl?' + |
315 |
var merge_patrons_url = |
| 317 |
$('.selection:checked') |
316 |
"/cgi-bin/koha/members/merge-patrons.pl?" + |
| 318 |
.map(function() { |
317 |
$(".selection:checked") |
| 319 |
return "id=" + $( '#borrowernumber_' + $(this).val() ).val() |
318 |
.map(function () { |
| 320 |
}).get().join('&'); |
319 |
return "id=" + $("#borrowernumber_" + $(this).val()).val(); |
|
|
320 |
}) |
| 321 |
.get() |
| 322 |
.join("&"); |
| 321 |
|
323 |
|
| 322 |
window.location.href = merge_patrons_url; |
324 |
window.location.href = merge_patrons_url; |
| 323 |
return false; |
325 |
return false; |
| 324 |
} else { |
326 |
} else { |
| 325 |
$(checkedItems).parents('tr').removeClass("warn"); |
327 |
$(checkedItems).parents("tr").removeClass("warn"); |
| 326 |
return false; |
328 |
return false; |
| 327 |
} |
329 |
} |
| 328 |
}); |
330 |
}); |