{% extends "base.html" %}

{% block title %}Bulletins{% endblock %}

{% block content %}
<div class="bbs-header">
    <h1><i class="bi bi-newspaper"></i> Bulletins</h1>
    <p>System announcements and news from the sysop.</p>
</div>

<div class="card">
    <div class="card-body p-0">
    {% if bulletins %}
        <table class="table table-hover mb-0">
            <thead><tr><th>Title</th><th>Posted</th><th>Status</th></tr></thead>
            <tbody>
            {% for b in bulletins %}
                <tr>
                    <td>
                        {% if b.is_pinned %}<i class="bi bi-pin-fill text-warning" title="Pinned"></i> {% endif %}
                        <a href="{{ url_for('bulletins.view', bulletin_id=b.id) }}">
                            <strong>{{ b.title }}</strong>
                        </a>
                    </td>
                    <td>{{ b.created_at.strftime('%Y-%m-%d %H:%M') }}</td>
                    <td>
                        {% if b.expires_at %}
                            <small class="text-muted">expires {{ b.expires_at.strftime('%Y-%m-%d') }}</small>
                        {% endif %}
                    </td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    {% else %}
        <div class="p-3 text-muted">No active bulletins.</div>
    {% endif %}
    </div>
</div>
{% endblock %}
