{% extends "message/message_layout.html" %}
{% block message_content %}
<table class="table table-bordered">
    <thead>
        <tr>
            <th>To</th>
            <th>Subject</th>
            <th>Date</th>
            <th>Options</th>
        </tr>
    </thead>
    <tbody>
        {% for message in messages %}
        <tr>
            <td><a href="{{ url_for('user.profile', username=message.to_user.username) }}">{{ message.to_user.username }}</a></td>
            <td><a href="{{ url_for('user.view_message', id=message.id) }}">{% if message.subject %}{{ message.subject }}{% else %}(No Subject){% endif %}</a></td>
            <td>{{ message.date_created|format_date('%d %B %Y') }}</td>
            <td><a href="{{ url_for('user.delete_message', id=message.id) }}">Delete</a> |
                <a href="{{ url_for('user.move_message', id=message.id) }}">Move</a></td>
        </tr>
        {% else %}
        <tr>
            <td colspan="4">
                This message folder is empty.
            </td>
        </tr>
        {% endfor %}
    </tbody>
</table>
{% endblock %}
