{% extends 'base.html' %}
{% load static %}

{% block title %}Announcements - Rapha-Bethel BNPS{% endblock %}

{% block content %}
<div class="container-fluid">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <h1 class="h3 mb-0 text-gray-800">Announcements</h1>
        <a href="/admin/communication/announcement/add/" class="btn btn-primary">
            <i class="fas fa-plus"></i> New Announcement
        </a>
    </div>

    <div class="row">
        {% for announcement in announcements %}
        <div class="col-md-6 mb-4">
            <div class="card shadow h-100 {% if announcement.priority == 'urgent' %}border-danger{% endif %}">
                <div class="card-header d-flex justify-content-between align-items-center">
                    <h5 class="mb-0">{{ announcement.title }}</h5>
                    <span class="badge bg-{% if announcement.priority == 'urgent' %}danger{% elif announcement.priority == 'high' %}warning{% else %}info{% endif %}">
                        {{ announcement.get_priority_display }}
                    </span>
                </div>
                <div class="card-body">
                    <p>{{ announcement.content }}</p>
                    <p class="text-muted small">
                        <i class="far fa-clock"></i> Published: {{ announcement.publish_date }}
                    </p>
                    <p class="text-muted small">
                        <i class="fas fa-users"></i> Audience: {{ announcement.get_audience_display }}
                    </p>
                </div>
            </div>
        </div>
        {% empty %}
        <div class="col-12">
            <p class="text-center">No announcements yet</p>
        </div>
        {% endfor %}
    </div>
</div>
{% endblock %}