1 $(document).ready(function() {
2 $('#patronlists').tabs();
3 var allcheckboxes = $(".checkboxed");
4 $("#renew_all").on("click",function(){
5 allcheckboxes.checkCheckboxes(":input[name*=items]");
6 allcheckboxes.unCheckCheckboxes(":input[name*=barcodes]");
8 $("#CheckAllitems").on("click",function(){
9 allcheckboxes.checkCheckboxes(":input[name*=items]");
10 allcheckboxes.unCheckCheckboxes(":input[name*=barcodes]"); return false;
12 $("#CheckNoitems").on("click",function(){
13 allcheckboxes.unCheckCheckboxes(":input[name*=items]"); return false;
15 $("#CheckAllreturns").on("click",function(){
16 allcheckboxes.checkCheckboxes(":input[name*=barcodes]");
17 allcheckboxes.unCheckCheckboxes(":input[name*=items]"); return false;
19 $("#CheckNoreturns" ).on("click",function(){
20 allcheckboxes.unCheckCheckboxes(":input[name*=barcodes]"); return false;
23 $("#CheckAllexports").on("click",function(){
24 allcheckboxes.checkCheckboxes(":input[name*=biblionumbers]");
25 allcheckboxes.unCheckCheckboxes(":input[name*=items]");
28 $("#CheckNoexports").on("click",function(){
29 allcheckboxes.unCheckCheckboxes(":input[name*=biblionumbers]");
33 $("#relrenew_all").on("click",function(){
34 allcheckboxes.checkCheckboxes(":input[name*=items]");
35 allcheckboxes.unCheckCheckboxes(":input[name*=barcodes]");
37 $("#relCheckAllitems").on("click",function(){
38 allcheckboxes.checkCheckboxes(":input[name*=items]");
39 allcheckboxes.unCheckCheckboxes(":input[name*=barcodes]"); return false;
41 $("#relCheckNoitems").on("click",function(){
42 allcheckboxes.unCheckCheckboxes(":input[name*=items]"); return false;
44 $("#relCheckAllreturns").on("click",function(){
45 allcheckboxes.checkCheckboxes(":input[name*=barcodes]");
46 allcheckboxes.unCheckCheckboxes(":input[name*=items]"); return false;
48 $("#relCheckNoreturns").on("click",function(){
49 allcheckboxes.unCheckCheckboxes(":input[name*=barcodes]"); return false;
51 $("#messages ul").after("<a href=\"#\" id=\"addmessage\">"+MSG_ADD_MESSAGE+"</a>");
52 $("#borrower_messages .cancel").on("click",function(){
53 $("#add_message_form").hide();
54 $("#addmessage").show();
56 $("#addmessage").on("click",function(){
58 $("#add_message_form").show();
61 $("input.radio").on("click",function(){
62 radioCheckBox($(this));
65 $("#newduedate").datetimepicker({
66 minDate: 1, // require that renewal date is after today
70 $("#duedatespec").datetimepicker({
71 onClose: function(dateText, inst) { $("#barcode").focus(); },
75 $("#export_submit").on("click",function(){
76 var export_format = $("#export_formats").val();
77 export_checkouts(export_format);
80 // Clicking the table cell checks the checkbox inside it
81 $("td").on("click",function(e){
82 if(e.target.tagName.toLowerCase() == 'td'){
83 $(this).find("input:checkbox:visible").each( function() {
84 if($(this).attr("checked")){
85 $(this).removeAttr("checked");
87 $(this).attr("checked","checked");
88 radioCheckBox($(this));
95 function export_checkouts(format) {
96 if ($("input:checkbox[name='biblionumbers'][checked]").length < 1){
97 alert(MSG_EXPORT_SELECT_CHECKOUTS);
101 $("input:checkbox[name='biblionumbers']").each( function(){
102 var input_item = $(this).siblings("input:checkbox");
103 if ( $(this).is(":checked") ) {
104 $(input_item).attr("checked", "checked");
106 $(input_item).attr("checked", "");
110 if (format == 'iso2709_995') {
112 $("#dont_export_item").val(0);
113 } else if (format == 'iso2709') {
114 $("#dont_export_item").val(1);
116 document.issues.action="/cgi-bin/koha/tools/export.pl";
117 document.getElementById("export_format").value = format;
118 document.issues.submit();
120 /* Reset form action to its initial value */
121 document.issues.action="/cgi-bin/koha/reserve/renewscript.pl";
125 function validate1(date) {
126 var today = new Date();
127 if ( date < today ) {
134 // prevent adjacent checkboxes from being checked simultaneously
135 function radioCheckBox(box){
136 box.parents("td").siblings().find("input:checkbox:visible").each(function(){
137 if($(this).attr("checked")){
138 $(this).removeAttr("checked");