{% extends 'veriport_dashboard/base.html' %}
{% load i18n %}

{% block title %}{% trans 'Accounts' %}{% endblock %}

{% block users_active %}active{% endblock %}

{% block content %}
    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header">
                        <h3 class="box-title">{% trans 'Accounts' %}</h3>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <table id="accountTable" class="table table-bordered table-hover">
                            {% if accounts.exists %}
                                <thead>
                                    <tr>
                                      <th>{% trans 'Name' %}</th>
                                      <th>{% trans 'Parent' %}</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    {% for account in accounts %}
                                        <tr>
                                            <td>
                                                <a href="{{ account.get_absolute_url }}">
                                                    {{ account.name }}
                                                </a>
                                            </td>
                                            <td>
                                                <a href="{{ account.parent_account.get_absolute_url }}">
                                                    {{ account.parent_account.name }}
                                                </a>
                                            </td>
                                        </tr>
                                    {% endfor %}
                                </tbody>
                                <tfoot>
                                    <tr>
                                      <th>{% trans 'Name' %}</th>
                                      <th>{% trans 'Parent' %}</th>
                                    </tr>
                                </tfoot>
                            {% else %}
                                <thead>
                                    <tr>
                                        <th>{% trans 'No accounts yet.' %}</th>
                                    </tr>
                                </thead>
                            {% endif %}
                        </table>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
        </div>
        <!-- /.row -->
  </section>
  <!-- /.content -->
{% endblock %}

{% block extra_js %}
    <script src="{% static 'plugins/datatables/jquery.dataTables.min.js' %}"></script>
    <script src="{% static 'plugins/datatables/dataTables.bootstrap.min.js' %}"></script>
    <script type="text/javascript">
        $(function() {
            $("#accountTable").DataTable();
        });
    </script>
{% endblock %}