{% load i18n %}

<div id="menu"
     class="site-actions" style="padding-left:20px">
    <ul class="sf-menu">
        <li>
            <a href="{% url 'lfc_add_user' %}">{% trans "Add User" %}</a>
        </li>
    </ul>
</div>

<div style="padding-left:30px">
    <form action="{% url 'lfc_manage_set_users_filter' %}"
          method="GET">

        <table class="users-navigation">
            <tr>
                <td class="discreet">
                    {% trans "Pages" %}
                </td>
                <td class="discreet">
                    {% trans "Name" %}
                </td>
                <td class="discreet">
                    {% trans "Active" %}
                </td>
                <td></td>
                <td class="discreet">
                    {% trans "Reset" %}
                </td>
            </tr>
            <tr>
                <td class="">
                    {% if page.has_previous %}
                        <a class="ajax-link"
                           href="{% url 'lfc_manage_set_users_page' %}?page=1">
                           <img src="{{ STATIC_URL }}lfc/icons/resultset_first.png" alt="{% trans 'First' %}" />
                        </a>

                        <a class="ajax-link"
                           href="{% url 'lfc_manage_set_users_page' %}?page={{ page.previous_page_number }}">
                           <img src="{{ STATIC_URL }}lfc/icons/resultset_previous.png" alt="{% trans 'Previous' %}" />
                        </a>
                    {% else %}
                        <a><img src="{{ STATIC_URL }}lfc/icons/resultset_first.png" alt="{% trans 'First' %}" /></a>
                        <a><img src="{{ STATIC_URL }}lfc/icons/resultset_previous.png" alt="{% trans 'Previous' %}" /></a>
                    {% endif %}

                    {{ page.number }} {% trans "of" %} {{ paginator.num_pages }}

                    {% if page.has_next %}
                        <a class="ajax-link"
                           href="{% url 'lfc_manage_set_users_page' %}?page={{ page.next_page_number }}">
                           <img src="{{ STATIC_URL }}lfc/icons/resultset_next.png" title="{% trans 'Next' %}"/>
                        </a>

                        <a class="ajax-link"
                           href="{% url 'lfc_manage_set_users_page' %}?page={{ paginator.num_pages }}">
                           <img src="{{ STATIC_URL }}lfc/icons/resultset_last.png" title="{% trans 'Last' %}"/>
                        </a>
                    {% else %}
                        <a><img src="{{ STATIC_URL }}lfc/icons/resultset_next.png" title="{% trans 'Next' %}"/></a>
                        <a><img src="{{ STATIC_URL }}lfc/icons/resultset_last.png" title="{% trans 'Last' %}"/></a>
                    {% endif %}
                </td>
                <td>
                    <input style="padding-top:2px" name="users_name_filter" type="text" value="{{ name_filter }}" />
                </td>
                <td>
                    <select class="users-active-filter" name="users_active_filter">
                        <option value="">---</option>
                        <option value="1" {% ifequal active_filter "1" %}selected="selected"{% endifequal %}>{% trans "Yes" %}</option>
                        <option value="0" {% ifequal active_filter "0" %}selected="selected"{% endifequal %}>{% trans "No" %}</option>
                    </select>
                </td>
                <td>
                    <input type="submit" value="{% trans 'Go!' %}" class="ajax-submit" />
                </td>
                <td>
                    <a class="ajax-link reset-link"
                       href="{% url 'lfc_manage_reset_users_filter' %}">
                       <img class="icon" src="{{ STATIC_URL }}lfc/icons/cancel.png" title="{% trans 'Last' %}"/>
                    </a>
                </td>
            </tr>
        </table>
    </form>
</div>

<div id="data" style="margin-top: 10px; margin-left: 30px; ">
    <form action="{% url 'lfc_manage_change_users' %}"e
          method="POST">
        {% csrf_token %}
        <table class="users lfs-manage-table full">
            <tr class="header">
                <th class="tiny padr">
                    <input class="select-all" value="1" type="checkbox" />
                </th>
                <th>
                    {% trans "Fullname" %}
                </th>
                <th class="large">
                    {% trans "Username" %}
                </th>
                <th class="large">
                    {% trans "E-Mail" %}
                </th>
                <th class="small">
                    <input class="select-all" value="2" type="checkbox" />
                    {% trans "Active" %}
                </th>
                <th class="small">
                    {% trans "Edit" %}
                </th>
            </tr>
            {% for user in page.object_list %}
                <tr>
                    <td>
                        <input type="hidden" name="user_ids" value="{{ user.id }}" />
                        <input type="checkbox" name="delete_ids" value="{{ user.id }}" class="select-1" />
                    </td>
                    <td>
                        <a href="{% url 'lfc_manage_user' user.id %}">
                            {{ user.first_name }} {{ user.last_name }}
                        </a>
                    </td>
                    <td>
                        <a href="{% url 'lfc_manage_user' user.id %}">
                            {{ user.username }}
                        </a>
                    </td>
                    <td>
                        {% if user.email %}
                            <a href="mailto:{{ user.email }}">
                                {{ user.email }}
                            </a>
                        {% endif %}
                    </td>
                    <td>
                        <input type="checkbox" name="active_ids" value="{{ user.id }}" class="select-2" {% if user.is_active %}checked="checked"{% endif %} />
                    </td>
                    <td>
                        <a href="{% url 'lfc_manage_user' user.id %}">
                            <img src="{{ STATIC_URL }}lfc/icons/edit.png"
                                 title="{% trans "Edit" %}"
                                 alt="{% trans "Edit" %}" />
                        </a>
                    </td>
                </tr>
            {% endfor %}
        </table>
        <input type="submit" name="delete" class="ajax-submit" value="{% trans 'Delete' %}"/>
        <input type="submit" name="update" class="ajax-submit" value="{% trans 'Update' %}"/>
    </form>
</div>
