{% extends 'webapp/base.html' %}
{% load i18n %}
{% load bootstrap_pagination %}
{% block page_content %}
    <div class="row">
        <section id="data-table">
            <h3><i class="icon-envelope-alt"></i> {% trans "Messages" %}</h3>
            {% if object_list %}
                <table class="table table-striped table-bordered" width="100%">
                    <thead>
                    <tr>
                        <th>{% trans "Date" %}</th>
                        <th>{% trans "Mobile" %}</th>
                        <th>{% trans "Text" %}</th>
                        <th>{% trans "Direction" %}</th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for message in object_list %}
                        <tr>
                            <td class="moment">{{ message.date|date:"H:i:s d/m/Y" }}</td>
                            <td>{{ message.connection.identity }}</td>
                            <td>{{ message.text }}</td>
                            <td>{{ message.get_direction_display }}</td>
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>
            {% else %}
                <p>{% trans "No messages" %}</p>
            {% endif %}
        </section>
        {% if is_paginated %}
            <section id="pager">
                {% bootstrap_paginate page_obj range=10 %}
            </section>
        {% endif %}
    </div>
{% endblock %}
