]> git.koha-community.org Git - koha.git/blob - koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js
Bug 14060: Remove readonly attributes on date inputs
[koha.git] / koha-tmpl / intranet-tmpl / prog / js / pages / circulation.js
1 $(document).ready(function() {
2     $("#CheckAllExports").on("click",function(){
3         $(".export:visible").prop("checked", true);
4         return false;
5     });
6     $("#UncheckAllExports").on("click",function(){
7         $(".export:visible").prop("checked", false);
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         onClose: function(dateText, inst) {
35             validate_date(dateText, inst);
36         },
37         minDate: 1, // require that renewal date is after today
38         hour: 23,
39         minute: 59
40     });
41     $("#duedatespec").datetimepicker({
42         onClose: function(dateText, inst) {
43             if ( validate_date(dateText, inst) ) {
44                 $("#barcode").focus();
45             }
46         },
47         hour: 23,
48         minute: 59
49     });
50     $("#export_submit").on("click",function(){
51         var output_format = $("#output_format").val();
52         export_checkouts(output_format);
53         return false;
54     });
55
56     var checkout_settings = $(".checkout-settings");
57     var checkout_settings_icon = $(".checkout-settings-icon");
58
59     // If any checkboxes in the checkout settings are selected, show the settings by default
60     if ( $(".checkout-settings input:checked,#duedatespec[value!='']").length ) {
61         checkout_settings.show();
62         checkout_settings_icon.removeClass("fa-caret-right").addClass("fa-caret-down");
63     } else {
64         checkout_settings.hide();
65         checkout_settings_icon.removeClass("fa-caret-down").addClass("fa-caret-right");
66     }
67
68     $("#show-checkout-settings a").on("click",function(){
69         if( checkout_settings.is(":hidden")){
70             checkout_settings.show();
71             checkout_settings_icon.removeClass("fa-caret-right").addClass("fa-caret-down");
72         } else {
73             $("#barcode").focus();
74             checkout_settings.hide();
75             checkout_settings_icon.removeClass("fa-caret-down").addClass("fa-caret-right");
76         }
77     });
78
79 });
80
81 function export_checkouts(format) {
82     if ($("input:checkbox[name='biblionumbers']:checked").length < 1){
83         alert(MSG_EXPORT_SELECT_CHECKOUTS);
84         return;
85     }
86
87     $("input:checkbox[name='biblionumbers']").each( function(){
88         var input_item = $(this).siblings("input:checkbox");
89         if ( $(this).is(":checked") ) {
90             $(input_item).prop("checked", true);
91         } else {
92             $(input_item).prop("checked", false);
93         }
94     } );
95
96     if (format == 'iso2709_995') {
97         format = 'iso2709';
98         $("#dont_export_item").val(0);
99     } else if (format == 'iso2709') {
100         $("#dont_export_item").val(1);
101     }
102
103     document.getElementById("output_format").value = format;
104     document.issues.submit();
105 }
106
107 function validate1(date) {
108     var today = new Date();
109     if ( date < today ) {
110         return true;
111      } else {
112         return false;
113      }
114 }