Lines 364-447
$(document).ready(function(){
Link Here
|
364 |
"right": "1%", |
364 |
"right": "1%", |
365 |
"width": "150px", |
365 |
"width": "150px", |
366 |
} ); |
366 |
} ); |
367 |
// Patron clubs |
|
|
368 |
$("body").on("click", ".cancel_enrollment", function(e){ |
369 |
e.preventDefault(); |
370 |
var id = $(this).data("id"); |
371 |
cancelEnrollment( id ); |
372 |
}); |
373 |
$("body").on("click", ".add_enrollment", function(e){ |
374 |
e.preventDefault(); |
375 |
var id = $(this).data("id"); |
376 |
loadEnrollmentForm( id ); |
377 |
}); |
378 |
$("body").on("click", ".add_enrollment", function(e){ |
379 |
e.preventDefault(); |
380 |
var club_id = $(this).data("club_id"); |
381 |
var borrowernumber = $(this).data("borrowernumber"); |
382 |
addEnrollment( borrowernumber, club_id ); |
383 |
}); |
384 |
$("body").on("click", ".cancel_add_enrollment", function(e){ |
385 |
e.preventDefault(); |
386 |
var club_id = $(this).data("club_id"); |
387 |
var borrowernumber = $(this).data("borrowernumber"); |
388 |
showClubs( borrowernumber, club_id ); |
389 |
}); |
390 |
}); |
367 |
}); |
391 |
|
|
|
392 |
// Patron clubs tab, circulation.pl and moremember.pl |
393 |
function loadEnrollmentForm( id ) { |
394 |
$("body").css("cursor", "progress"); |
395 |
$('#clubs-tab').load('/cgi-bin/koha/clubs/patron-enroll.pl?borrowernumber=' + borrowernumber + '&id=' + id, function() { |
396 |
$("body").css("cursor", "default"); |
397 |
}); |
398 |
|
399 |
return false; |
400 |
} |
401 |
|
402 |
function cancelEnrollment( id ) { |
403 |
$("body").css("cursor", "progress"); |
404 |
$.ajax({ |
405 |
type: "POST", |
406 |
url: '/cgi-bin/koha/svc/club/cancel_enrollment', |
407 |
data: { id: id }, |
408 |
success: function( data ) { |
409 |
if ( data.success ) { |
410 |
$('#clubs-tab').load('/cgi-bin/koha/clubs/patron-clubs-tab.pl?borrowernumber=' + borrowernumber, function() { |
411 |
$("body").css("cursor", "default"); |
412 |
}); |
413 |
} else { |
414 |
alert( MSG_CANT_CANCEL_ENROLLMENT ); |
415 |
} |
416 |
}, |
417 |
dataType: 'json' |
418 |
}); |
419 |
return false; |
420 |
} |
421 |
|
422 |
function addEnrollment( borrowernumber, club_id ) { |
423 |
$("body").css("cursor", "progress"); |
424 |
$.ajax({ |
425 |
type: "POST", |
426 |
url: '/cgi-bin/koha/svc/club/enroll', |
427 |
data: $( "#patron-enrollment-form" ).serialize(), |
428 |
success: function( data ) { |
429 |
if ( data.success ) { |
430 |
$('#clubs-tab').load('/cgi-bin/koha/clubs/patron-clubs-tab.pl?borrowernumber=' + borrowernumber + '&id=' + club_id, function() { |
431 |
$("body").css("cursor", "default"); |
432 |
}); |
433 |
} else { |
434 |
alert(_("Unable to create enrollment!")); |
435 |
} |
436 |
}, |
437 |
dataType: 'json' |
438 |
}); |
439 |
return false; |
440 |
} |
441 |
|
442 |
function showClubs( borrowernumber, club_id ) { |
443 |
$("body").css("cursor", "progress"); |
444 |
$('#clubs-tab').load('/cgi-bin/koha/clubs/patron-clubs-tab.pl?borrowernumber=' + borrowernumber + '&id=' + club_id, function() { |
445 |
$("body").css("cursor", "default"); |
446 |
}); |
447 |
} |