1 /* global flatpickr_dateformat_string flatpickr_timeformat_string */
2 $(document).ready(function() {
3 $("#CheckAllExports").on("click",function(){
4 $(".export:visible").prop("checked", true);
7 $("#UncheckAllExports").on("click",function(){
8 $(".export:visible").prop("checked", false);
12 $('#patronlists').tabs({
13 activate: function( event, ui ) {
14 $("a", ui.newTab ).click();
18 $("#borrower_messages .cancel").on("click",function(){
19 $("#add_message_form").hide();
20 $("#addmessage").show();
23 $("#addmessage").on("click",function(){
25 $("#add_message_form").show();
28 $("input.radio").on("click",function(){
29 radioCheckBox($(this));
32 $("#duedatespec").flatpickr({
34 dateFormat: flatpickr_dateformat_string + " " + flatpickr_timeformat_string,
36 $("#barcode").focus();
40 $("#newduedate, #newonholdduedate input").flatpickr({
42 dateFormat: flatpickr_dateformat_string + " " + flatpickr_timeformat_string,
45 $(".clear_date").on("click", function(){
46 $("#stickyduedate").prop( "checked", false );
49 $("#export_submit").on("click",function(){
50 export_checkouts($("#issues-table-output-format").val());
54 var circ_settings = $(".circ-settings");
55 var circ_settings_icon = $(".circ-settings-icon");
57 // If any checkboxes in the circ settings are selected, show the settings by default
58 if ( $(".circ-settings input:checked,#duedatespec[value!='']").length ) {
60 circ_settings_icon.removeClass("fa-caret-right").addClass("fa-caret-down");
63 circ_settings_icon.removeClass("fa-caret-down").addClass("fa-caret-right");
66 $("#show-circ-settings a").on("click",function(){
67 if( circ_settings.is(":hidden")){
69 circ_settings_icon.removeClass("fa-caret-right").addClass("fa-caret-down");
71 $("#barcode").focus();
73 circ_settings_icon.removeClass("fa-caret-down").addClass("fa-caret-right");
77 $(".circ_setting").on("click",function(){
78 $("#barcode").focus();
81 $("#itemSearchFallback").ready(function(){
82 $("#itemSearchFallback").modal("show");
86 $("div#reldebarments .remove_restriction").on("click",function(){
87 return confirm( __("Remove restriction?") );
89 var mrform = $("#manual_restriction_form");
90 var mrlink = $("#add_manual_restriction");
92 mrlink.on("click",function(e){
97 $("#cancel_manual_restriction").on("click",function(e){
102 $(".clear-date").on("click",function(e){
104 var fieldID = this.id.replace("clear-date-","");
105 $("#" + fieldID).val("");
111 function export_checkouts(format) {
112 if ($("input:checkbox[name='biblionumbers']:checked").length < 1){
113 alert( __("You must select checkout(s) to export") );
117 $("input:checkbox[name='biblionumbers']").each( function(){
118 var input_item = $(this).siblings("input:checkbox");
119 if ( $(this).is(":checked") ) {
120 $(input_item).prop("checked", true);
122 $(input_item).prop("checked", false);
126 if (format == 'iso2709_995') {
128 $("#dont_export_item").val(0);
129 } else if (format == 'iso2709') {
130 $("#dont_export_item").val(1);
133 document.getElementById("output_format").value = format;
134 document.issues.submit();