<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
    <title>System Activity Logs - INWAY Service Control Panel</title>
    <link rel="stylesheet" href="{{ @ASSET_PATH }}/css/variables.css">
    <link rel="stylesheet" href="{{ @ASSET_PATH }}/css/base.css">
    <link rel="stylesheet" href="{{ @ASSET_PATH }}/css/layout.css">
    <link rel="stylesheet" href="{{ @ASSET_PATH }}/css/components.css">
    <link rel="stylesheet" href="{{ @ASSET_PATH }}/css/animations.css">
</head>
<body>
    <div class="app-container">
        <include href="super-admin/_sidebar.html" />
        
        <main class="main-content">
            <header class="header">
                <div class="header-left">
                    <button class="menu-toggle">
                        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" 
                            d="M4 6h16M4 12h16M4 18h16" />
                        </svg>
                    </button>
                    <h1 class="page-title">System Activity Logs</h1>
                </div>
            </header>
            
            <div class="content-area page-transition">
                <div class="glass-card" style="padding: 0; overflow: hidden;">
                    <table class="data-table">
                        <thead>
                            <tr>
                                <th>Date & Time</th>
                                <th>User</th>
                                <th>Action</th>
                                <th>Activity Details</th>
                                <th>IP Address</th>
                            </tr>
                        </thead>
                        <tbody>
                            <repeat group="{{ @logs }}" value="{{ @log }}">
                                <tr>
                                    <td>{{ date('M d, Y H:i', strtotime(@log.created_at)) }}</td>
                                    <td>
                                        <div style="font-weight: 600;">{{ @log.user_name }}</div>
                                        <div style="font-size: 12px; color: var(--text-muted);">
                                            {{ @log.user_email }}
                                        </div>
                                    </td>
                                    <td>
                                        <check if="{{ @log.action == 'login' }}">
                                            <true><span class="badge badge-success">Login</span></true>
                                            <false>
                                                <check if="{{ @log.action == 'logout' }}">
                                                    <true><span class="badge badge-secondary">Logout</span></true>
                                                    <false>
                                                        <check if="{{ @log.action == 'create' }}">
                                                            <true><span class="badge badge-info">Created Record</span></true>
                                                            <false>
                                                                <check if="{{ @log.action == 'update' }}">
                                                                    <true><span class="badge badge-warning">Updated Record</span></true>
                                                                    <false>
                                                                        <check if="{{ @log.action == 'delete' }}">
                                                                            <true><span class="badge badge-danger">Deleted Record</span></true>
                                                                            <false>
                                                                                <span class="badge badge-primary">
                                                                                    {{ ucfirst(@log.action) }}
                                                                                </span>
                                                                            </false>
                                                                        </check>
                                                                    </false>
                                                                </check>
                                                            </false>
                                                        </check>
                                                    </false>
                                                </check>
                                            </false>
                                        </check>
                                    </td>
                                    <td>{{ @log.details }}</td>
                                    <td style="font-family: monospace; font-size: 12px;">
                                        {{ @log.ip_address }}
                                    </td>
                                </tr>
                            </repeat>

                            <check if="{{ count(@logs) == 0 }}">
                                <true>
                                    <tr>
                                        <td colspan="5" style="text-align: center; padding: 40px; color: var(--text-muted);">
                                            No system activity found
                                        </td>
                                    </tr>
                                </true>
                            </check>
                        </tbody>
                    </table>
                </div>
            </div>
        </main>
    </div>
    
    <div class="toast-container"></div>
    <script src="{{ @ASSET_PATH }}/js/app.js"></script>
    <script src="{{ @ASSET_PATH }}/js/api.js"></script>
    <script src="{{ @ASSET_PATH }}/js/ui.js"></script>
</body>
</html>