{% 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>{{ user_name }}的消息记录</h3></div>

    <hr style="margin: 10px auto;">
    {% for record in record_list %}
        <div class="row" onclick="click_record_div('{{ record.id }}')">
            <div class="col-sm-6 {% if not record.is_view%}bold{% endif %}">{{ record.title }}</div>
            {% if record.url %}
                <div class="col-xs-6 col-sm-2">点击查看</div>
            {% endif %}
            <div class="col-xs-12 col-sm-4  text_div">{{ record.sent_at|local_datetime|date:"Y-m-d H:i:s" }}</div>
        </div>
        <hr style="margin: 10px auto;">

    {% endfor %}
    {% include 'bee_django_message/paginator.html' %}
{% endblock %}
{% block scripts %}
    <script>
        function click_record_div(record_id) {
            $.post("{% url 'bee_django_message:user_record_click' %}", {"record_id": record_id}, function (res) {
                console.log(res);
                if (res["url"]) {
                    location.href = res["url"];
                } else {
                    location.reload();
                }
            });
        }
    </script>
{% endblock %}