Bug 11565 [QA Followup] - Hide checkout options when not in use
[koha.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 output_format = $("#output_format").val();
45         export_checkouts(output_format);
46         return false;
47     });
48
49     var checkout_settings = $(".checkout-settings");
50     var checkout_settings_icon = $(".checkout-settings-icon");
51
52     $("#show-checkout-settings a").on("click",function(){
53         if( checkout_settings.is(":hidden")){
54             checkout_settings.show();
55             checkout_settings_icon.removeClass("fa-caret-right").addClass("fa-caret-down");
56         } else {
57             $("#barcode").focus();
58             checkout_settings.hide();
59             checkout_settings_icon.removeClass("fa-caret-down").addClass("fa-caret-right");
60         }
61     });
62
63 });
64
65 function export_checkouts(format) {
66     if ($("input:checkbox[name='biblionumbers'][checked]").length < 1){
67         alert(MSG_EXPORT_SELECT_CHECKOUTS);
68         return;
69     }
70
71     $("input:checkbox[name='biblionumbers']").each( function(){
72         var input_item = $(this).siblings("input:checkbox");
73         if ( $(this).is(":checked") ) {
74             $(input_item).attr("checked", "checked");
75         } else {
76             $(input_item).attr("checked", "");
77         }
78     } );
79
80     if (format == 'iso2709_995') {
81         format = 'iso2709';
82         $("#dont_export_item").val(0);
83     } else if (format == 'iso2709') {
84         $("#dont_export_item").val(1);
85     }
86
87     document.getElementById("output_format").value = format;
88     document.issues.submit();
89 }
90
91 function validate1(date) {
92     var today = new Date();
93     if ( date < today ) {
94         return true;
95      } else {
96         return false;
97      }
98 }