$(document).ready(function() { // Download Excel button $('#downloadBtn').click(function() { window.location.href = '/download_excel'; }); // View ticket modal $('.view-btn').click(function() { const ticketId = $(this).data('id'); // In a real app, you would fetch the ticket details from the server // For now, we'll just show a sample modal $('#viewTicketModal').modal('show'); }); // Delete ticket button $('.delete-btn').click(function() { const ticketId = $(this).data('id'); if (confirm('Are you sure you want to delete this ticket?')) { // In a real app, you would send a DELETE request to the server alert('Ticket would be deleted here (implementation needed)'); } }); // Refresh button $('.refresh-btn').click(function() { location.reload(); }); // Search functionality $('.search-box input').on('keyup', function() { const value = $(this).val().toLowerCase(); $('table tbody tr').filter(function() { $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1) }); }); // Simulate loading data setTimeout(function() { $('.table-responsive').addClass('loaded'); }, 500); });