{% extends "admin/base.html" %}
{% load i18n %}
{% load botsfilters %}

{% block content %}
<form action="{{ form.action }}" method="post">{% csrf_token %}
    <input onClick="history.back()" type="button" value="{% trans 'Back' %}" />
    <input type="submit" name="2select" value="{% trans 'Change selection' %}" />
    <input type="submit" name="2incoming" value="{% trans 'Incoming (same selection)' %}" />
    <input type="submit" name="2process" value="{% trans 'Process Errors (same selection)' %}" />
    <input type="submit" name="2confirm" value="{% trans 'Confirm (same selection)' %}" />
    <input type="submit" name="resendall" value="{% trans 'Resend All' %}" />
    {% include "bots/paginator.html" %}

    <table id="botstable">
        {% for hidden in form.hidden_fields %}
            {{ hidden }}
        {% endfor %}
        <thead>
            <tr>
                <th></th>
                <th><button class="botsheader" type="submit" name="order" value="statust" >{% trans 'Status' %}</button></th>
                <th><button class="botsheader" type="submit" name="order" value="retransmit" title="Resend" >{% trans 'Resend' %}</button></th>
                <th><button class="botsheader" type="submit" name="order" value="numberofresends" >{% trans '#send' %}</button></th>
                <th><button class="botsheader" type="submit" name="order" value="ts" >{% trans 'Date/time' %}</button></th>
                <th><button class="botsheader" type="submit" name="order" value="filename" >{% trans 'File' %}</button></th>
                <th><button class="botsheader" type="submit" name="order" value="nrmessages" >{% trans '#mes' %}</button></th>
                <th><button class="botsheader" type="submit" name="order" value="editype" >{% trans 'Editype' %}</button></th>
                <th><button class="botsheader" type="submit" name="order" value="messagetype" >{% trans 'Messagetype' %}</button></th>
                <th><button class="botsheader" type="submit" name="order" value="idroute" >{% trans 'Route' %}</button></th>
                <th><button class="botsheader" type="submit" name="order" value="tochannel" >{% trans 'ToChannel' %}</button></th>
                <th><button class="botsheader" type="submit" name="order" value="frompartner" >{% trans 'FromPartner' %}</button></th>
                <th><button class="botsheader" type="submit" name="order" value="topartner" >{% trans 'ToPartner' %}</button></th>
                <th><button class="botsheader" type="submit" name="order" value="charset" >{% trans 'Charset' %}</button></th>
                <th><button class="botsheader" type="submit" name="order" value="contenttype" >{% trans 'Contenttype' %}</button></th>
                <th><button class="botsheader" type="submit" name="order" value="testindicator" >{% trans 'Test' %}</button></th>
            </tr>
        </thead>
        <tbody>
        {% for row in queryset.object_list %}
            <tr class="{% cycle 'row1' 'row2' %}">
                <td>
                    <div class="dropdown"><img class="action" src="/media/images/star.png" />
                        <ul>
                            <li><button class="botsheader" onclick="document.location.href='/detail/?outidta={{row.idta}}'; return false;" >{% trans 'View detail' %}</button></li>
                            <li><button class="botsheader" type="submit" name="retransmit" value="{{row.idta}}" >{% trans 'Resend' %}</button></li>
                            {% if row.statust == 1 %}
                            <li><button class="botsheader" type="submit" name="noautomaticretry" value="{{row.idta}}" >{% trans 'No automatic retry' %}</button></li>
                            {% endif %}
                        </ul>
                    </div>
                </td>
                <td>{{ row.get_statust_display}}</td>
                <td><input disabled="True" type="checkbox" {% if row.retransmit %}checked{% endif %}/></td>
                <td class="nowrap">{{row.numberofresends}}</td>
                <td class="nowrap">{{row.ts|date:"Y-m-d H:i:s"}}</td>
                <td><a href="/filer/?action=this&amp;idta={{row.idta}}" target="_blank" class="botslink" title="{{row.filename}}" >{{row.filename|shortpath}}</a></td>
                <td>{{row.nrmessages}}</td>
                <td class="nowrap">{{row.editype}}</td>
                <td class="nowrap">{{row.messagetype}}</td>
                <td class="nowrap">{{row.idroute}}</td>
                <td class="nowrap">{{row.tochannel}}</td>
                <td class="nowrap">{{row.frompartner}}</td>
                <td class="nowrap">{{row.topartner}}</td>
                <td>{{row.charset}}</td>
                <td>{{row.contenttype}}</td>
                <td>{{row.testindicator}}</td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
</form>
{% endblock %}

