{% extends "base.html" %}

{% load static %}

{% load crispy_forms_tags %}

{% block content %}


      <!-- End Navbar -->
      <div class="content">
        <div class="container-fluid">
          <div class="row">

            

            {% if user.is_superuser %}
            <a href="{% url 'registro' %}" class="btn btn-info float-right" >Crear Usuario IB</a>
            
            {% endif %}
            

            <div class="col-md-12">
              <div class="card">
                <div class="card-header card-header-primary">
                  <h4 class="card-title ">USUARIOS</h4>
                  <p class="card-category">USUARIOS</p>
                </div>
                <div class="card-body">
                  <div class="table-responsive">
                    <table class="table" id="data">
                      <thead class=" text-primary">
                      <tr>
                        <th>__</th>
                        <th>USUARIO Ó IB</th>
                        <th>NOMBRE</th>
                        <th>APELLIDOS</th>
                        <th>ULTIMA CONEXION</th>
                        <th>ES ADMIN</th>
                        <th>ACCIONES</th>
                      </tr>  
                      </thead>
                       

                      <tbody>
                        {% for dato in datos %}
                        <tr>
                          <td></td>
                          <td>{{ dato.username }}</td>
                          <td>{{ dato.first_name }}</td>
                          <td>{{ dato.last_name }}</td>
                          <td>{{ dato.last_login }}</td>
                          <td>
                            {% if dato.is_superuser %}
                              <p>Admin</p>
                            {% else %}
                              <p>Usuario</p>
                            {% endif %}
                          </td>
                          <td>{% if user.is_superuser %}<a href="{% url 'userupdate' dato.id %}" class="btn btn-primary">Actualizar</a>{% endif %}</td>
                          
                        </tr>
                        {% endfor %}
                        

                      </tbody>
                    </table>
                    
                  </div>
                </div>
              </div>
            </div>
            
            
            
          </div>
        </div>
      </div>

      {% endblock content %}

      