{% extends "base.html" %}
{% block title %}Messages ENT — GMAO{% endblock %}

{% block content %}
<div class="container-fluid">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <h1><i class="bi bi-envelope"></i> Boîte de réception ENT</h1>
    </div>
    <div class="card"><div class="card-body">
        {% if messages %}
        <div class="table-responsive">
            <table class="table table-hover">
                <thead><tr><th>Date</th><th>Expéditeur</th><th>Sujet</th><th>Actions</th></tr></thead>
                <tbody>
                    {% for msg in messages %}
                    <tr>
                        <td>{{ msg.received_at|dateformat if msg.received_at else '-' }}</td>
                        <td>{{ msg.sender }}</td>
                        <td>{{ msg.subject }}</td>
                        <td><a href="{{ url_for('ent.message_detail', msg_id=msg.id) }}" class="btn btn-sm btn-outline-primary">Voir</a></td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
        {% else %}
        <p class="text-muted text-center">Aucun message.</p>
        {% endif %}
    </div></div>
</div>
{% endblock %}