<!DOCTYPE html>
<html>
<head>
    <title>Admin Dashboard</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
    <div class="container">
        <h1 class="mt-5">Admin Dashboard</h1>
        <a href="{{ url_for('admin_logout') }}" class="btn btn-danger float-right">Logout</a>
        <h2 class="mt-4">Pending Requests</h2>
        <table class="table table-bordered mt-3">
            <thead>
                <tr>
                    <th>URL/Domain</th>
                    <th>Reason</th>
                    <th>Status</th>
                    <th>Date & Time</th>
                    <th>IP Address</th>
                    <th>MAC Address</th>
                    <th>Action</th>
                </tr>
            </thead>
            <tbody>
                {% for req in requests %}
                <tr>
                    <td>{{ req.url }}</td>
                    <td>{{ req.reason }}</td>
                    <td>{{ req.status }}</td>
                    <td>{{ req.timestamp }}</td>
                    <td>{{ req.ip_address }}</td>
                    <td>{{ req.mac_address }}</td>
                    <td>
                        <form method="post" class="d-inline">
                            <input type="hidden" name="url" value="{{ req.url }}">
                            <input type="hidden" name="action" value="approve">
                            <button type="submit" class="btn btn-success btn-sm">Approve</button>
                        </form>
                        <form method="post" class="d-inline">
                            <input type="hidden" name="url" value="{{ req.url }}">
                            <input type="hidden" name="action" value="reject">
                            <button type="submit" class="btn btn-danger btn-sm">Reject</button>
                        </form>
                    </td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
        <h2 class="mt-4">Whitelisted URLs/Domains</h2>
        <ul class="list-group mt-3">
            {% for url in whitelist %}
            <li class="list-group-item">
                {{ url.url }}
                <form method="post" class="d-inline float-right">
                    <input type="hidden" name="url" value="{{ url.url }}">
                    <input type="hidden" name="action" value="revoke">
                    <button type="submit" class="btn btn-warning btn-sm">Revoke</button>
                </form>
            </li>
            {% endfor %}
        </ul>
    </div>
    <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.4/dist/umd/popper.min.js"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</body>
</html>