{% extends "bee_django_message/base.html" %}
{% load bee_django_message_filter %}
{% block styles %}
    <style>
        .bold {
            font-weight: 900;
            color: #CC3434;
        }
    </style>
{% endblock %}
{% block content %}
    <div class="text-center"><h3>{{ message.name|default:'发送' }}列表</h3></div>
    {% if message %}
        {% include 'bee_django_message/record/_search.html' %}
    {% endif %}
    <table class="table">
        <tr>
            <th>发送人</th>
            <th>接受人</th>
            <th>标题</th>
            <th>发送时间</th>
            <th></th>
        </tr>
        {% for record in record_list %}
            <tr>
                <td class="col-xs-2">
                    {% if record.from_user %}
                        <a href="{{ record.from_user.get_user_search_link }}">{{ record.from_user }}</a>
                    {% else %}
                        {{ record.from_user|get_send_name }}
                    {% endif %}
                </td>
                <td class="col-xs-2">
                    {% if record.to_user %}
                        <a href="{{ record.to_user.get_user_search_link }}">{{ record.to_user }}</a>
                    {% endif %}
                </td>
                <td class="col-xs-6">{{ record.title }}</td>
                <td>{{ record.sent_at }}</td>
                <td>
                    <a href="{% url 'bee_django_message:record_detail' record.id %}">详情</a>
                    {% if record.message.need_done %}
                        {% if not record.is_done %}
                            <a href="{% url 'bee_django_message:record_update' record.id %}">去处理</a>
                        {% else %}
                            已处理
                        {% endif %}
                    {% endif %}
                </td>
            </tr>

        {% endfor %}
    </table>
    {% include 'bee_django_message/paginator.html' %}

{% endblock %}
