jQuery(document).ready(function() { if (jQuery.browser.msie) jQuery('.wats_select').css("width","auto"); wats_js_page_list_bind(); jQuery('#filter').click(function() { jQuery('#filter').attr('disabled','disabled'); var view = 1; var wats_select_ticket_type_tl = jQuery('#wats_select_ticket_type_tl option:selected').val(); var wats_select_ticket_priority_tl = jQuery('#wats_select_ticket_priority_tl option:selected').val(); var wats_select_ticket_status_tl = jQuery('#wats_select_ticket_status_tl option:selected').val(); var wats_select_ticket_status_operator = jQuery('#wats_select_ticket_status_operator option:selected').val(); if (jQuery('#wats_select_ticket_product_tl option:selected').val()) var wats_select_ticket_product_tl = jQuery('#wats_select_ticket_product_tl option:selected').val(); else var wats_select_ticket_product_tl = 0; if (jQuery('#wats_select_ticket_author_tl option:selected').val()) var wats_select_ticket_author_tl = jQuery('#wats_select_ticket_author_tl option:selected').val(); else if (jQuery('#wats_select_ticket_author_tl').val()) var wats_select_ticket_author_tl = jQuery('#wats_select_ticket_author_tl').val(); else var wats_select_ticket_author_tl = 0; if (jQuery('#wats_select_ticket_author_meta_value_tl option:selected').val()) var wats_select_ticket_author_meta_value_tl = jQuery('#wats_select_ticket_author_meta_value_tl option:selected').val(); else var wats_select_ticket_author_meta_value_tl = 0; if (jQuery('#wats_select_ticket_owner_tl option:selected').val()) var wats_select_ticket_owner_tl = jQuery('#wats_select_ticket_owner_tl option:selected').val(); else if (jQuery('#wats_select_ticket_owner_tl').val()) var wats_select_ticket_owner_tl = jQuery('#wats_select_ticket_owner_tl').val(); else var wats_select_ticket_owner_tl = 0; var categoryfilter = jQuery('#categoryfilter').val(); var categorylistfilter = jQuery('#categorylistfilter').val(); if (jQuery('#wats_page_list_tl option:selected').val()) var wats_page_list_tl = jQuery('#wats_page_list_tl option:selected').val(); else var wats_page_list_tl = 0; if (jQuery('#wats_tickets_per_page_list_tl option:selected').val()) var wats_tickets_per_page_list_tl = jQuery('#wats_tickets_per_page_list_tl option:selected').val(); else var wats_tickets_per_page_list_tl = 0; var customfieldlist = new Array(); var j = 0; jQuery("input[name*='wats_cf']").each(function() { customfieldlist[j] = {}; customfieldlist[j][jQuery(this).attr("id")] = jQuery(this).val(); j++; }); jQuery("input[name*='wats_textarea_cf']").each(function() { customfieldlist[j] = {}; customfieldlist[j][jQuery(this).attr("id")] = jQuery(this).val(); j++; }); jQuery("select[name*='wats_select_cf']").each(function() { customfieldlist[j] = {}; customfieldlist[j][jQuery(this).attr("id")] = jQuery(this).children(':selected').val(); j++; }); liste = JSON.stringify(customfieldlist); wats_loading(document.getElementById("resultticketlist"),watsmsg[0]); jQuery.post(ajaxurl, {action:"wats_ticket_list_ajax_processing", _ajax_nonce:jQuery("#_wpnonce_ticket_list").val(), view:view, wats_select_ticket_type_tl:wats_select_ticket_type_tl, wats_select_ticket_priority_tl:wats_select_ticket_priority_tl, wats_select_ticket_status_tl:wats_select_ticket_status_tl, wats_select_ticket_product_tl:wats_select_ticket_product_tl, wats_select_ticket_author_tl:wats_select_ticket_author_tl, wats_select_ticket_owner_tl:wats_select_ticket_owner_tl, wats_select_ticket_author_meta_value_tl:wats_select_ticket_author_meta_value_tl, categoryfilter:categoryfilter, categorylistfilter:categorylistfilter, wats_select_ticket_status_operator:wats_select_ticket_status_operator, liste:liste, wats_page_list_tl:wats_page_list_tl, wats_tickets_per_page_list_tl:wats_tickets_per_page_list_tl}, function(res) { jQuery('#filter').removeAttr('disabled'); wats_stop_loading(document.getElementById("resultticketlist"),res); jQuery('#tableticket').tablesorter(); wats_js_page_list_bind(); jQuery(".wrapper1").on("scroll", function(){ jQuery("#tableticket-container") .scrollLeft(jQuery(".wrapper1").scrollLeft()); }); jQuery("#tableticket-container").on("scroll", function(){ jQuery(".wrapper1") .scrollLeft(jQuery("#tableticket-container").scrollLeft()); }); }); return false; }); if (jQuery('#tableticket').length > 0) jQuery('#tableticket').tablesorter(); function wats_js_page_list_bind() { jQuery('#wats_tickets_per_page_list_tl').change(function() { jQuery('#wats_page_list_tl').val(1); jQuery('#filter').click(); return false; }); jQuery('#wats_page_list_tl').change(function() { jQuery('#filter').click(); return false; }); return false; } var wats_select_ticket_author_tl_ac = 0; if (jQuery("#wats_select_ticket_author_tl_ac").is("input")) { jQuery('#wats_select_ticket_author_tl_ac').autocomplete({ source: function(request,response) { jQuery.ajax({ url: ajaxurl+"?action=wats_ajax_frontend_get_user_list", dataType: "json", data: { value:jQuery('#wats_select_ticket_author_tl_ac').val(), _ajax_nonce:jQuery("#_wpnonce_ticket_list").val(), type:'ftlauthorlist', 'cookie': encodeURIComponent(document.cookie) }, success: function(data) { if (jQuery.isEmptyObject(data) == true) jQuery('#wats_select_ticket_author_tl').val("0"); response( jQuery.map(data, function(item) { return{value:item.label,label:item.label,hidden:item.value} })); } }); }, select: function(event,ui) { wats_select_ticket_author_tl_ac = 1; jQuery('#wats_select_ticket_author_tl').val(ui.item.hidden); }, close : function(event,ui) { if (wats_select_ticket_author_tl_ac == 0) jQuery('#wats_select_ticket_author_tl').val("0"); wats_select_ticket_author_tl_ac = 0; }, minLength:3, delay:300 }); } var wats_select_ticket_owner_tl_ac = 0; if (jQuery("#wats_select_ticket_owner_tl_ac").is("input")) { jQuery('#wats_select_ticket_owner_tl_ac').autocomplete({ source: function(request,response) { jQuery.ajax({ url: ajaxurl+"?action=wats_ajax_frontend_get_user_list", dataType: "json", data: { value:jQuery('#wats_select_ticket_owner_tl_ac').val(), _ajax_nonce:jQuery("#_wpnonce_ticket_list").val(), type:'ftlownerlist', 'cookie': encodeURIComponent(document.cookie) }, success: function(data) { if (jQuery.isEmptyObject(data) == true) jQuery('#wats_select_ticket_owner_tl').val("0"); response( jQuery.map(data, function(item) { return{value:item.label,label:item.label,hidden:item.value} })); } }); }, select: function(event,ui) { wats_select_ticket_owner_tl_ac = 1; jQuery('#wats_select_ticket_owner_tl').val(ui.item.hidden); }, close : function(event,ui) { if (wats_select_ticket_owner_tl_ac == 0) jQuery('#wats_select_ticket_owner_tl').val("0"); wats_select_ticket_owner_tl_ac = 0; }, minLength:3, delay:300 }); } return false; });