{% extends "crowdsec_base.html" %}

{% block title %}대시보드 - RealNAS security{% endblock %}

{% block content %}
<!DOCTYPE html>
<html lang="ko">
<head>
    <meta charset="UTF-8" />
    <title>RealNAS Security 차단 IP 목록</title>
    <style>
        body {
            font-family: 'Malgun Gothic', Arial, sans-serif;
            background: #f8f9fb;
            color: #222;
            margin: 0;
            padding: 20px;
        }
        h1 {
            margin-bottom: 20px;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            font-size: 14px;
        }
        th, td {
            border: 1px solid #ddd;
            padding: 10px 12px;
            text-align: left;
        }
        th {
            background: #f0f2f7;
            font-weight: 600;
            color: #555;
        }
        input[type="checkbox"] {
            transform: scale(1.2);
            cursor: pointer;
        }
        button {
            background: #369;
            color: white;
            border: none;
            padding: 10px 18px;
            border-radius: 5px;
            cursor: pointer;
            font-size: 14px;
            margin-top: 15px;
        }
        button:hover {
            background: #246;
        }
        .no-data {
            text-align: center;
            font-style: italic;
            color: #888;
            padding: 20px 0;
        }
        a {
            text-decoration: none;
            color: #369;
        }
    </style>
</head>
<body>

<h1>RealNAS Security 차단 IP 목록</h1>

<form method="POST" action="{{ url_for('crowdsec_unban') }}">
    <table>
        <thead>
            <tr>
                <th>IP 주소</th>
                <th>차단 이유</th>
                <th>차단 시작 시간</th>
                <th>차단 만료 시간</th>
                <th>선택</th>
            </tr>
        </thead>
        <tbody>
            {% if blocks %}
                {% for block in blocks %}
                <tr>
    <td>{{ block.value }}</td>
    <td>{{ block.origin }}</td>
    <td>{{ block.start }}</td>
    <td>{{ block.stop }}</td>
    <td><input type="checkbox" name="ips_to_unban" value="{{ block.value }}"></td>
</tr>

                {% endfor %}
            {% else %}
                <tr>
                    <td colspan="5" class="no-data">차단된 IP가 없습니다.</td>
                </tr>
            {% endif %}
        </tbody>
    </table>
    <button type="submit">선택된 IP 차단 해제</button>
</form>



</body>
</html>
{% endblock %}