{% extends 'base.html' %}
{% load static %}
{% load i18n %}
{% load common_tags %}

{% block custom_head_css_js %}
    <link href="{% static "css/plugins/footable/footable.core.css" %}" rel="stylesheet">
{% endblock %}
{% block content %}
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="panel-options">
                        <ul class="nav nav-tabs">
                            <li class="active">
                                <a href="#" class="text-center"> {% trans 'Proxy log detail' %} </a>
                            </li>
                        </ul>
                    </div>
                    <div class="tab-content">
                        <div class="col-sm-11" style="padding-left: 0;">
                            <div class="ibox float-e-margins">
                                <div class="ibox-title">
                                    <span style="float: left">{% trans 'Command log list' %} <b>{{ user_object.name }}</b></span>
                                    <div class="ibox-tools">
                                        <a class="collapse-link">
                                            <i class="fa fa-chevron-up"></i>
                                        </a>
                                        <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                                            <i class="fa fa-wrench"></i>
                                        </a>
                                        <ul class="dropdown-menu dropdown-user">
                                        </ul>
                                        <a class="close-link">
                                            <i class="fa fa-times"></i>
                                        </a>
                                    </div>
                                </div>
                                <div class="ibox-content">
                                    <table id="command-log" class="footable table table-stripped toggle-arrow-tiny" data-page-size="10">
                                        <thead>
                                        <tr>
                                            <th data-toggle="true">ID</th>
                                            <th>Command</th>
                                            <th data-hide="all">Output</th>
                                            <th>Datetime</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        {% for command in object_list %}
                                            <tr>
                                                <td>{{ command.command_no }}</td>
                                                <td>{{ command.command }}</td>
                                                <td><pre style="border: none;background: none">{{ command.output|to_html|safe}}</pre></td>
                                                <td>{{ command.timestamp|ts_to_date}}</td>
                                            </tr>
                                        {% endfor %}
                                        </tbody>
                                        <tfoot>
                                            <tr>
                                                <td colspan="5">
                                                    <ul class="pagination pull-right"></ul>
                                                </td>
                                            </tr>
                                        </tfoot>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

{% endblock %}
{% block custom_foot_js %}
    <script src="{% static "js/plugins/footable/footable.all.min.js" %}"></script>
    <script>
        $(document).ready(function () {
            $('.footable').footable();
        });
    </script>
{% endblock %}
