document.addEventListener("DOMContentLoaded",function(){const i=window.ticketListConfig;if(!i)return;const e=document.getElementById("ticketSearch"),n=document.getElementById("statusFilter"),r=document.getElementById("priorityFilter"),c=document.getElementById("clearFilters"),l=document.querySelectorAll("tbody tr");if(!e||!n||!r)return;function s(){const f=e.value.toLowerCase(),d=n.value.toLowerCase(),u=r.value.toLowerCase();l.forEach(function(t){const g=t.querySelector("td:first-child").textContent.toLowerCase(),p=(t.getAttribute("data-priority")||"").toLowerCase(),L=(t.getAttribute("data-status")||"").toLowerCase(),E=g.includes(f),S=!d||L.includes(d);E&&S&&(!u||p===u)?t.style.display="":t.style.display="none"});var y=Array.from(l).filter(function(t){return t.style.display!=="none"}),a=document.getElementById("emptyState");if(y.length===0&&!a){var h=document.querySelector("tbody"),v=document.querySelectorAll("thead th").length,o=document.createElement("tr");o.id="emptyState",o.innerHTML='<td colspan="'+v+'" class="text-center py-4 text-muted"><i class="fas fa-search fa-2x mb-2"></i><br>'+i.translations.noTicketsFound+"</td>",h.appendChild(o)}else y.length>0&&a&&a.remove()}function m(){e.value="",n.selectedIndex=0,r.selectedIndex=0,s()}e.addEventListener("input",s),n.addEventListener("change",s),r.addEventListener("change",s),c&&c.addEventListener("click",m)});
