{% extends 'cabinet/_internal_base.html' %}

{% block breadcrumbs %}
    <li><span>Bot list</span></li>
{% endblock %}

{% block content %}
    <section class="card">
        <header class="card-header">
            <div class="card-button-actions">
                <div class="dropdown">
                    <button class="btn btn-primary btn-sm dropdown-toggle" type="button" data-toggle="dropdown">
                        Add new bot
                    </button>
                    <div class="dropdown-menu dropdown-menu-right">
                        {% for module in bot_modules %}
                            <a class="dropdown-item"
                               href="{% url 'cabinet:bots:new' content_type=module.content_type.model %}">{{ module.MODULE_NAME }}</a>
                        {% endfor %}
                    </div>
                </div>
            </div>
            <h2 class="card-title">Your bots</h2>
        </header>
        <div class="card-body">
            <table class="table table-hover table-responsive-md mb-0">
                <thead>
                <tr>
                    <th>Title</th>
                    <th>Module</th>
                </tr>
                </thead>
                {% for bot in object_list %}
                <tr class="clickable-row" data-href="{% url 'cabinet:bots:edit' pk=bot.pk %}">
                    <td>{{ bot.title }}</td>
                    <td>{{ bot.config.MODULE_NAME }}</td>
                </tr>
                {% empty %}
                <tfoot>
                <tr>
                    <td colspan="4">No bots added</td>
                </tr>
                </tfoot>
                {% endfor %}
            </table>
        </div>
    </section>
{% endblock %}
