aa3fd43b6d9346df300663bf66bb16bfc393ae26
[koha-ffzg.git] / koha-tmpl / intranet-tmpl / prog / en / js / pages / circulation.js
1 $(document).ready(function() {
2     $("#CheckAllExports").on("click",function(){
3         $(".export:visible").attr("checked", "checked" );
4         return false;
5     });
6     $("#UncheckAllExports").on("click",function(){
7         $(".export:visible").removeAttr("checked");
8         return false;
9     });
10
11     $('#patronlists').tabs({
12         activate: function( event, ui ) {
13             $('#'+ui.newTab.context.id).click();
14         }
15     });
16
17     $("#messages ul").after("<a href=\"#\" id=\"addmessage\">"+MSG_ADD_MESSAGE+"</a>");
18
19     $("#borrower_messages .cancel").on("click",function(){
20         $("#add_message_form").hide();
21         $("#addmessage").show();
22     });
23
24     $("#addmessage").on("click",function(){
25         $(this).hide();
26         $("#add_message_form").show();
27      });
28
29     $("input.radio").on("click",function(){
30         radioCheckBox($(this));
31     });
32
33     $("#newduedate").datetimepicker({
34         minDate: 1, // require that renewal date is after today
35         hour: 23,
36         minute: 59
37     });
38     $("#duedatespec").datetimepicker({
39         onClose: function(dateText, inst) { $("#barcode").focus(); },
40         hour: 23,
41         minute: 59
42     });
43     $("#export_submit").on("click",function(){
44         var export_format = $("#export_formats").val();
45         export_checkouts(export_format);
46         return false;
47     });
48
49 });
50
51 function export_checkouts(format) {
52     if ($("input:checkbox[name='biblionumbers'][checked]").length < 1){
53         alert(MSG_EXPORT_SELECT_CHECKOUTS);
54         return;
55     }
56
57     $("input:checkbox[name='biblionumbers']").each( function(){
58         var input_item = $(this).siblings("input:checkbox");
59         if ( $(this).is(":checked") ) {
60             $(input_item).attr("checked", "checked");
61         } else {
62             $(input_item).attr("checked", "");
63         }
64     } );
65
66     if (format == 'iso2709_995') {
67         format = 'iso2709';
68         $("#dont_export_item").val(0);
69     } else if (format == 'iso2709') {
70         $("#dont_export_item").val(1);
71     }
72
73     document.getElementById("export_format").value = format;
74     document.issues.submit();
75 }
76
77 function validate1(date) {
78     var today = new Date();
79     if ( date < today ) {
80         return true;
81      } else {
82         return false;
83      }
84 }