1 /* global borrowernumber advsearch dateformat _ CAN_user_borrowers_edit_borrowers number_of_adult_categories destination */
3 $(document).ready(function(){
4 $("#filteraction_off, #filteraction_on").on('click', function(e) {
6 $('#filters').toggle();
7 $('.filteraction').toggle();
10 $("#filteraction_on").toggle();
13 $("#filteraction_off").toggle();
15 $("#searchfieldstype").change(function() {
16 var MSG_DATE_FORMAT = "";
17 if ( $(this).val() == 'dateofbirth' ) {
18 if( dateformat == 'us' ){
19 MSG_DATE_FORMAT = _("Dates of birth should be entered in the format 'MM/DD/YYYY'");
20 } else if( dateformat == 'iso' ){
21 MSG_DATE_FORMAT = _("Dates of birth should be entered in the format 'YYYY-MM-DD'");
22 } else if( dateformat == 'metric' ){
23 MSG_DATE_FORMAT = _("Dates of birth should be entered in the format 'DD/MM/YYYY'");
24 } else if( dateformat == 'dmydot' ){
25 MSG_DATE_FORMAT = _("Dates of birth should be entered in the format 'DD.MM.YYYY'");
27 $('#searchmember').attr("title", MSG_DATE_FORMAT).tooltip('show');
29 $('#searchmember').tooltip('destroy');
33 if( CAN_user_borrowers_edit_borrowers ){
34 $("#deletepatron").click(function(){
35 window.location='/cgi-bin/koha/members/deletemem.pl?member=' + borrowernumber;
37 $("#renewpatron").click(function(){
38 confirm_reregistration();
39 $(".btn-group").removeClass("open");
42 $("#updatechild").click(function(e){
43 if( $(this).data("toggle") == "tooltip"){ // Disabled menu option has tooltip attribute
47 $(".btn-group").removeClass("open");
52 $("#updatechild, #patronflags, #renewpatron, #deletepatron, #exportbarcodes").tooltip();
53 $("#exportcheckins").click(function(){
55 $(".btn-group").removeClass("open");
58 $("#printsummary").click(function(){
59 printx_window("page");
60 $(".btn-group").removeClass("open");
63 $("#printslip").click(function(){
64 printx_window("slip");
65 $(".btn-group").removeClass("open");
68 $("#printquickslip").click(function(){
69 printx_window("qslip");
70 $(".btn-group").removeClass("open");
73 $("#print_overdues").click(function(){
74 window.open("/cgi-bin/koha/members/print_overdues.pl?borrowernumber=" + borrowernumber, "printwindow");
75 $(".btn-group").removeClass("open");
78 $("#searchtohold").click(function(){
82 $("#select_patron_messages").on("change",function(){
83 $("#borrower_message").val( $(this).val() );
87 function confirm_updatechild() {
88 var is_confirmed = window.confirm(_("Are you sure you want to update this child to an Adult category? This cannot be undone."));
90 window.location='/cgi-bin/koha/members/update-child.pl?op=update&borrowernumber=' + borrowernumber;
94 function update_child() {
95 if( number_of_adult_categories > 1 ){
96 window.open('/cgi-bin/koha/members/update-child.pl?op=multi&borrowernumber=' + borrowernumber,'UpdateChild','width=400,height=300,toolbar=no,scrollbars=yes,resizable=yes');
98 confirm_updatechild();
102 function confirm_reregistration() {
103 var is_confirmed = window.confirm(_("Are you sure you want to renew this patron's registration?"));
105 window.location = '/cgi-bin/koha/members/setstatus.pl?borrowernumber=' + borrowernumber + '&destination=' + destination + '&reregistration=y';
108 function export_barcodes() {
109 window.open('/cgi-bin/koha/members/readingrec.pl?borrowernumber=' + borrowernumber + '&op=export_barcodes');
111 var slip_re = /slip/;
112 function printx_window(print_type) {
113 var handler = print_type.match(slip_re) ? "printslip" : "summary-print";
114 window.open("/cgi-bin/koha/members/" + handler + ".pl?borrowernumber=" + borrowernumber + "&print=" + print_type, "printwindow");
117 function searchToHold(){
118 var date = new Date();
119 date.setTime(date.getTime() + (10 * 60 * 1000));
120 $.cookie("holdfor", borrowernumber, { path: "/", expires: date });
121 location.href="/cgi-bin/koha/catalogue/search.pl";