HEX
Server: Apache
System: Linux WWW 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64
User: web11 (1011)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/test.kaunokolegija.lt/kk_wp_content/plugins/events/admin/events-list.php
<?php
// Prevent direct access
if (!defined('ABSPATH')) {
    exit;
}

global $wpdb;

// Handle actions
if (isset($_GET['action']) && isset($_GET['event_id'])) {
    $event_id = intval($_GET['event_id']);
    $action = sanitize_text_field($_GET['action']);
    
    if ($action === 'delete' && wp_verify_nonce($_GET['_wpnonce'], 'delete_event_' . $event_id)) {
        $events_table = $wpdb->base_prefix . 'kauno_events';
        $result = $wpdb->delete($events_table, array('id' => $event_id, 'site_id' => get_current_blog_id()));
        if ($result) {
            $success_message = __('Event deleted successfully.', 'kauno-events');
        } else {
            $error_message = __('Error deleting event.', 'kauno-events');
        }
    }
}


// Handle filters
$filter_status = isset($_GET['filter_status']) ? sanitize_text_field($_GET['filter_status']) : '';
$filter_language = isset($_GET['filter_language']) ? sanitize_text_field($_GET['filter_language']) : '';
$filter_date_from = isset($_GET['filter_date_from']) ? sanitize_text_field($_GET['filter_date_from']) : '';
$filter_date_to = isset($_GET['filter_date_to']) ? sanitize_text_field($_GET['filter_date_to']) : '';
$search_query = isset($_GET['search']) ? sanitize_text_field($_GET['search']) : '';

// Build query with filters
$site_id = get_current_blog_id();
$events_table = $wpdb->base_prefix . 'kauno_events';

$where_conditions = array("site_id = %d");
$query_params = array($site_id);

// Apply filters
if (!empty($filter_status)) {
    $where_conditions[] = "status = %s";
    $query_params[] = $filter_status;
}

if (!empty($filter_language)) {
    $where_conditions[] = "language = %s";
    $query_params[] = $filter_language;
}

if (!empty($filter_date_from)) {
    $where_conditions[] = "event_date >= %s";
    $query_params[] = $filter_date_from;
}

if (!empty($filter_date_to)) {
    $where_conditions[] = "event_date <= %s";
    $query_params[] = $filter_date_to;
}

if (!empty($search_query)) {
    $where_conditions[] = "(title LIKE %s OR description LIKE %s OR location LIKE %s)";
    $search_term = '%' . $wpdb->esc_like($search_query) . '%';
    $query_params[] = $search_term;
    $query_params[] = $search_term;
    $query_params[] = $search_term;
}

$where_clause = implode(' AND ', $where_conditions);
$query = "SELECT * FROM $events_table WHERE $where_clause ORDER BY event_date DESC";

$events = $wpdb->get_results($wpdb->prepare($query, $query_params));

$total_events = count($events);
$upcoming_events = count(array_filter($events, function($event) {
    return strtotime($event->event_date) > time();
}));
$past_events = $total_events - $upcoming_events;
$active_events = count(array_filter($events, function($event) {
    return $event->status === 'active';
}));
?>

<style>
.kauno-events-admin {
    background: #f8fafc;
    margin: 0 -20px;
    padding: 0;
    min-height: 100vh;
}

.events-header {
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
    color: white;
    padding: 2rem 2rem 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
}

.header-left h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-subtitle {
    font-size: 0.875rem;
    opacity: 0.8;
    font-weight: 500;
}

.header-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    line-height: 1;
}

.btn-primary {
    background: rgba(255, 255, 255, 0.9);
    color: #0d9488;
}

.btn-primary:hover {
    background: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

.events-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stat-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon.total {
    background: #dbeafe;
    color: #1d4ed8;
}

.stat-icon.upcoming {
    background: #dcfce7;
    color: #16a34a;
}

.stat-icon.past {
    background: #f3f4f6;
    color: #6b7280;
}

.stat-icon.active {
    background: #fef3c7;
    color: #d97706;
}

.stat-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #64748b;
    margin: 0;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.events-table-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.table-header {
    background: #f8fafc;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: #1e293b;
}

.table-filters {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.filter-select {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    background: white;
}

.events-table {
    width: 100%;
    border-collapse: collapse;
}

.events-table th {
    background: #f8fafc;
    padding: 1rem 1.5rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
    border-bottom: 1px solid #e2e8f0;
}

.events-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
}

.event-row {
    transition: background-color 0.2s;
}

.event-row:hover {
    background: #f8fafc;
}

.event-row.upcoming {
    border-left: 4px solid #16a34a;
}

.event-row.past {
    opacity: 0.7;
    border-left: 4px solid #6b7280;
}

.event-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.event-title {
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    font-size: 1rem;
}

.event-description {
    font-size: 0.875rem;
    color: #64748b;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.event-date-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.event-date {
    font-weight: 600;
    color: #1e293b;
}

.event-time {
    font-size: 0.75rem;
    color: #64748b;
}

.date-upcoming {
    color: #16a34a;
}

.date-past {
    color: #6b7280;
}

.language-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.language-lt {
    background: #fef3c7;
    color: #92400e;
}

.language-en {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-active {
    background: #dcfce7;
    color: #166534;
}

.status-inactive {
    background: #fecaca;
    color: #dc2626;
}

.actions-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 6px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-edit {
    background: #dbeafe;
    color: #1d4ed8;
}

.btn-edit:hover {
    background: #bfdbfe;
}

.btn-view {
    background: #dcfce7;
    color: #166534;
}

.btn-view:hover {
    background: #bbf7d0;
}

.btn-delete {
    background: #fecaca;
    color: #dc2626;
}

.btn-delete:hover {
    background: #fca5a5;
}

.no-events {
    text-align: center;
    padding: 3rem 2rem;
    color: #64748b;
}

.no-events-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state-subtitle {
    color: #9ca3af;
    margin-bottom: 1.5rem;
}

.empty-state-action {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: #0d9488;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s;
}

.empty-state-action:hover {
    background: #0f766e;
    transform: translateY(-1px);
}

.notice-success {
    background: #dcfce7;
    color: #166534;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    border: 1px solid #bbf7d0;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.notice-error {
    background: #fecaca;
    color: #dc2626;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    border: 1px solid #fca5a5;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Responsive */
@media (max-width: 1200px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .events-header {
        padding: 1.5rem 1rem 1rem;
    }

    .events-content {
        padding: 0 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .table-header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .events-table th,
    .events-table td {
        padding: 0.75rem 1rem;
    }

    .actions-group {
        flex-direction: column;
    }
}

/* Filters */
.filters-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.filters-header {
    background: #f8fafc;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filters-header h3 {
    margin: 0;
    color: #374151;
    font-size: 1rem;
    font-weight: 600;
}

.btn-clear-filters {
    background: #fecaca;
    color: #dc2626;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-clear-filters:hover {
    background: #fca5a5;
}

.filters-form {
    padding: 1.5rem;
}

.filters-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: end;
}

.filters-row:last-child {
    margin-bottom: 0;
}

.filter-group-event-list {
    display: flex
;
    flex-direction: column;
    gap: 0.5rem;
    box-sizing: border-box;
    position: relative;
    float: left;
    margin: 0 1% 0 0;
    padding: 20px 10px 10px;
    width: 24%;
    background: #fff;
    box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
}

.filter-group-event-list.filter-actions {
    justify-content: flex-end;
}

.filter-group-event-list label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.25rem;
}

.filter-input,
.filter-select {
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.2s;
    background: white;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: #0d9488;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.filter-input::placeholder {
    color: #9ca3af;
}

.btn-filter {
    background: #0d9488;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-filter:hover {
    background: #0f766e;
    transform: translateY(-1px);
}

.table-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.results-count {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
}

@media (max-width: 768px) {
    .filters-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .events-table {
        font-size: 0.875rem;
    }

    .btn-small {
        padding: 0.25rem 0.5rem;
        font-size: 0.6875rem;
    }
    
    .filters-form {
        padding: 1rem;
    }
}
</style>

<div class="wrap kauno-events-admin">
    <!-- Header -->
    <div class="events-header">
        <div class="header-content">
            <div class="header-left">
                <h1>
                    <span>📅</span>
                    <?php _e('Events Manager', 'kauno-events'); ?>
                </h1>
                <div class="header-subtitle"><?php _e('Manage all your events and registrations', 'kauno-events'); ?></div>
            </div>
            <div class="header-actions">
                <a href="<?php echo admin_url('admin.php?page=kauno-events-add'); ?>" class="btn btn-primary">
                    ✨ <?php _e('Add New Event', 'kauno-events'); ?>
                </a>
                <a href="<?php echo admin_url('admin.php?page=kauno-events-submissions'); ?>" class="btn btn-secondary">
                    📋 <?php _e('View Submissions', 'kauno-events'); ?>
                </a>
            </div>
        </div>
    </div>

    <div class="events-content">
        <!-- Success/Error Messages -->
        <?php if (isset($success_message)): ?>
            <div class="notice-success">
                <span>✅</span>
                <span><?php echo esc_html($success_message); ?></span>
            </div>
        <?php endif; ?>

        <?php if (isset($error_message)): ?>
            <div class="notice-error">
                <span>❌</span>
                <span><?php echo esc_html($error_message); ?></span>
            </div>
        <?php endif; ?>

        <!-- Stats Grid -->
        <div class="stats-grid">
            <div class="stat-card">
                <div class="stat-header">
                    <div class="stat-icon total">📊</div>
                    <div>
                        <h3 class="stat-title"><?php _e('Total Events', 'kauno-events'); ?></h3>
                    </div>
                </div>
                <p class="stat-number"><?php echo $total_events; ?></p>
            </div>
            
            <div class="stat-card">
                <div class="stat-header">
                    <div class="stat-icon upcoming">🚀</div>
                    <div>
                        <h3 class="stat-title"><?php _e('Upcoming Events', 'kauno-events'); ?></h3>
                    </div>
                </div>
                <p class="stat-number"><?php echo $upcoming_events; ?></p>
            </div>
            
            <div class="stat-card">
                <div class="stat-header">
                    <div class="stat-icon past">📚</div>
                    <div>
                        <h3 class="stat-title"><?php _e('Past Events', 'kauno-events'); ?></h3>
                    </div>
                </div>
                <p class="stat-number"><?php echo $past_events; ?></p>
            </div>
            
            <div class="stat-card">
                <div class="stat-header">
                    <div class="stat-icon active">✅</div>
                    <div>
                        <h3 class="stat-title"><?php _e('Active Events', 'kauno-events'); ?></h3>
                    </div>
                </div>
                <p class="stat-number"><?php echo $active_events; ?></p>
            </div>
        </div>

        <!-- Filters -->
        <div class="filters-card">
            <div class="filters-header">
                <h3><?php _e('Filter Events', 'kauno-events'); ?></h3>
                <button type="button" id="clearFilters" class="btn-clear-filters"><?php _e('Clear All', 'kauno-events'); ?></button>
            </div>
            <form method="GET" class="filters-form" id="filtersForm">
                <input type="hidden" name="page" value="kauno-events">
                
                <div class="filters-row">
                    <div class="filter-group-event-list">
                        <label for="search"><?php _e('Search', 'kauno-events'); ?></label>
                        <input type="text" 
                               name="search" 
                               id="search"
                               value="<?php echo esc_attr($search_query); ?>"
                               placeholder="<?php _e('Search by title, description or location...', 'kauno-events'); ?>"
                               class="filter-input">
                    </div>
                    
                    <div class="filter-group-event-list">
                        <label for="filter_status"><?php _e('Status', 'kauno-events'); ?></label>
                        <select name="filter_status" id="filter_status" class="filter-select">
                            <option value=""><?php _e('All Status', 'kauno-events'); ?></option>
                            <option value="active" <?php selected($filter_status, 'active'); ?>><?php _e('Active', 'kauno-events'); ?></option>
                            <option value="inactive" <?php selected($filter_status, 'inactive'); ?>><?php _e('Inactive', 'kauno-events'); ?></option>
                        </select>
                    </div>
                    
                    <div class="filter-group-event-list">
                        <label for="filter_language"><?php _e('Language', 'kauno-events'); ?></label>
                        <select name="filter_language" id="filter_language" class="filter-select">
                            <option value=""><?php _e('All Languages', 'kauno-events'); ?></option>
                            <option value="lt" <?php selected($filter_language, 'lt'); ?>><?php _e('Lithuanian', 'kauno-events'); ?></option>
                            <option value="en" <?php selected($filter_language, 'en'); ?>><?php _e('English', 'kauno-events'); ?></option>
                        </select>
                    </div>

                    <div class="filter-group-event-list">
                        <label for="filter_date_from"><?php _e('Date From', 'kauno-events'); ?></label>
                        <input type="date" 
                               name="filter_date_from" 
                               id="filter_date_from"
                               value="<?php echo esc_attr($filter_date_from); ?>"
                               class="filter-input">
                    </div>
                    
                    <div class="filter-group-event-list">
                        <label for="filter_date_to"><?php _e('Date To', 'kauno-events'); ?></label>
                        <input type="date" 
                               name="filter_date_to" 
                               id="filter_date_to"
                               value="<?php echo esc_attr($filter_date_to); ?>"
                               class="filter-input">
                    </div>
                    
                    <div class="filter-group-event-list filter-actions">
                        <button type="submit" class="btn-filter"><?php _e('Apply Filters', 'kauno-events'); ?></button>
                    </div>
                </div>
            </form>
        </div>

        <!-- Events Table -->
        <div class="events-table-card">
            <div class="table-header">
                <h2 class="table-title"><?php _e('All Events', 'kauno-events'); ?></h2>
                <div class="table-meta">
                    <?php if ($search_query || $filter_status || $filter_language || $filter_date_from || $filter_date_to): ?>
                        <span class="results-count"><?php printf(__('%d events found', 'kauno-events'), count($events)); ?></span>
                    <?php endif; ?>
                </div>
            </div>
            
            <div class="table-container">
                <table class="events-table">
                    <thead>
                        <tr>
                            <th><?php _e('Event', 'kauno-events'); ?></th>
                            <th><?php _e('Date & Time', 'kauno-events'); ?></th>
                            <th><?php _e('Location', 'kauno-events'); ?></th>
                            <th><?php _e('Language', 'kauno-events'); ?></th>
                            <th><?php _e('Status', 'kauno-events'); ?></th>
                            <th><?php _e('Actions', 'kauno-events'); ?></th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php if (empty($events)): ?>
                            <tr>
                                <td colspan="6" class="no-events">
                                    <div class="no-events-icon">📅</div>
                                    <div class="empty-state-text"><?php _e('No events found', 'kauno-events'); ?></div>
                                    <div class="empty-state-subtitle"><?php _e('Start by creating your first event to engage your audience', 'kauno-events'); ?></div>
                                    <a href="<?php echo admin_url('admin.php?page=kauno-events-add'); ?>" class="empty-state-action">
                                        ✨ <?php _e('Create First Event', 'kauno-events'); ?>
                                    </a>
                                </td>
                            </tr>
                        <?php else: ?>
                            <?php foreach ($events as $event): ?>
                                <?php 
                                $is_upcoming = strtotime($event->event_date) > time();
                                $event_class = $is_upcoming ? 'upcoming' : 'past';
                                ?>
                                <tr class="event-row <?php echo $event_class; ?>" data-status="<?php echo $event->status; ?>" data-time="<?php echo $event_class; ?>">
                                    <td>
                                        <div class="event-info">
                                            <div class="event-title"><?php echo esc_html($event->title); ?></div>
                                            <?php if ($event->description): ?>
                                                <div class="event-description" title="<?php echo esc_attr($event->description); ?>">
                                                    <?php echo esc_html(wp_trim_words($event->description, 10)); ?>
                                                </div>
                                            <?php endif; ?>
                                        </div>
                                    </td>
                                    <td>
                                        <div class="event-date-info">
                                            <div class="event-date <?php echo $is_upcoming ? 'date-upcoming' : 'date-past'; ?>">
                                                <?php echo date('M j, Y', strtotime($event->event_date)); ?>
                                            </div>
                                            <div class="event-time">
                                                <?php echo date('H:i', strtotime($event->event_date)); ?>
                                                <?php if ($event->end_date): ?>
                                                    - <?php echo date('H:i', strtotime($event->end_date)); ?>
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                    </td>
                                    <td>
                                        <?php if ($event->location): ?>
                                            <div style="font-weight: 500; color: #374151;">
                                                <?php echo esc_html($event->location); ?>
                                            </div>
                                            <?php if ($event->address): ?>
                                                <div style="font-size: 0.75rem; color: #64748b; margin-top: 0.25rem;">
                                                    <?php echo esc_html(wp_trim_words($event->address, 5)); ?>
                                                </div>
                                            <?php endif; ?>
                                        <?php else: ?>
                                            <span style="color: #9ca3af;">-</span>
                                        <?php endif; ?>
                                    </td>
                                    <td>
                                        <span class="language-badge language-<?php echo $event->language; ?>">
                                            <?php echo strtoupper($event->language); ?>
                                        </span>
                                    </td>
                                    <td>
                                        <span class="status-badge status-<?php echo $event->status; ?>">
                                            <?php echo ucfirst($event->status); ?>
                                        </span>
                                    </td>
                                    <td>
                                        <div class="actions-group">
                                            <a href="<?php echo admin_url('admin.php?page=kauno-events-add&edit=' . $event->id); ?>" 
                                               class="btn-small btn-edit">✏️ <?php _e('Edit', 'kauno-events'); ?></a>
                                            
                                            <a href="<?php echo home_url('/event/' . $event->event_slug . '/'); ?>" 
                                               class="btn-small btn-view" 
                                               target="_blank">👁 <?php _e('View', 'kauno-events'); ?></a>
                                            
                                            <a href="<?php echo wp_nonce_url(admin_url('admin.php?page=kauno-events&action=delete&event_id=' . $event->id), 'delete_event_' . $event->id); ?>" 
                                               class="btn-small btn-delete" 
                                               onclick="return confirm('<?php _e('Are you sure you want to delete this event? This action cannot be undone.', 'kauno-events'); ?>')">🗑 <?php _e('Delete', 'kauno-events'); ?></a>
                                        </div>
                                    </td>
                                </tr>
                            <?php endforeach; ?>
                        <?php endif; ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

<script>
jQuery(document).ready(function($) {
    // Clear filters functionality
    $('#clearFilters').click(function() {
        // Clear all form inputs
        $('#filtersForm')[0].reset();
        
        // Submit the form to refresh page without filters
        var form = $('#filtersForm');
        var url = form.attr('action') || window.location.pathname;
        var hiddenInput = form.find('input[name="page"]').val();
        
        // Navigate to clean URL
        window.location.href = url + '?page=' + hiddenInput;
    });
    
    // Auto-submit on filter change for better UX (optional)
    $('.filter-select').change(function() {
        if ($(this).val() !== '') {
            $('#filtersForm').submit();
        }
    });
    
    // Enter key support for search
    $('#search').keypress(function(e) {
        if (e.which === 13) {
            $('#filtersForm').submit();
        }
    });
});
</script>