{% extends "base.html" %}

{% block title %}{{ title }} - Admin{% endblock %}

{% block content %}
<div class="bbs-header">
    <h1><i class="bi bi-collection"></i> {{ title }}</h1>
</div>

<div class="row justify-content-center">
    <div class="col-md-6">
        <div class="card">
            <div class="card-header">{{ title }}</div>
            <div class="card-body">
                <form method="post">
        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
                    {{ form.hidden_tag() }}

                    <div class="mb-3">
                        {{ form.name.label(class="form-label") }}
                        {{ form.name(class="form-control") }}
                        {% for error in form.name.errors %}
                            <div class="text-danger">{{ error }}</div>
                        {% endfor %}
                    </div>

                    <div class="mb-3">
                        {{ form.description.label(class="form-label") }}
                        {{ form.description(class="form-control", rows="3") }}
                    </div>

                    <div class="mb-3">
                        {{ form.order.label(class="form-label") }}
                        {{ form.order(class="form-control") }}
                    </div>

                    <div class="row g-2 mb-3">
                        <div class="col-md-6">
                            {{ form.min_access_level.label(class="form-label") }}
                            {{ form.min_access_level(class="form-control", min=0, max=255) }}
                            <small class="text-muted">0=everyone, 10=registered (default), 50=VIP, 100=sysop</small>
                        </div>
                        <div class="col-md-6">
                            {{ form.min_write_level.label(class="form-label") }}
                            {{ form.min_write_level(class="form-control", min=0, max=255) }}
                            <small class="text-muted">Leave blank to use the read level for posting too</small>
                        </div>
                    </div>

                    <div class="mb-3 form-check">
                        {{ form.is_active(class="form-check-input") }}
                        {{ form.is_active.label(class="form-check-label") }}
                    </div>

                    <div class="d-flex gap-2">
                        {{ form.submit(class="btn btn-primary") }}
                        <a href="{{ url_for('admin.boards') }}" class="btn btn-secondary">Cancel</a>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{% endblock %}
