{% extends 'gakusei/layout.html' %}

{% block body %}

    <div class="container">

        <a href="{% url 'index' %}" class="mb-4 btn bg-success-subtle text-reset"><i class="fa-solid fa-angles-left"></i> Regresar al Index</a>        
        
        <div class="card">
            <div class="card-body">
                <h1 class="card-title mb-4">Listado de Senseis</h1>
                
                
                <div class="d-flex d-md-block justify-content-between">
                    
                    <a href="{% url 'sensei-create' %}" class="mb-4 btn btn-lg bg-success-subtle text-reset"><i class="fa-solid fa-plus"></i> Registrar Sensei</a>                    
                    
                    <a href="{% url 'sensei-filter' %}" class="mb-4 btn btn-lg bg-primary-subtle text-reset"><i class="fa-solid fa-magnifying-glass"></i> <span class="d-none d-md-inline">Buscar Registro</span></a>
                    
                </div>
                
                
                <div class="table-responsive">
                    <table class="table table-striped table-hover table-bordered">
                        <thead class="table-primary">
                            <th>Cédula</th>
                            <th>Nombre Completo</th>
                            <th>Nivel JP</th>
                            <th>Nivel EN</th>
                            <th>Telefono</th>
                            <th></th>
                        </thead>
                        <tbody>
                            {% for sensei in object_list %}
                            <tr>
                                <td>{{sensei.cedula}}</td>
                                <td>{{sensei.full_name}}</td>
                                <td>{{sensei.JP_level}}</td>
                                <td>{{sensei.EN_level}}</td>
                                <td>{{sensei.personal_data.telefono}}</td>
                                <td class="text-center align-middle"><a href="{% url 'sensei-detail' sensei.id %}"><i class="fs-4 fa-solid fa-eye"></i></a></td>
                            </tr>
                            {% empty %}
                            <tr>
                                <td colspan="6" class="text-center fw-bold fst-italic">Sin Registros</td>
                            </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>
            </div>

            <div class="card-footer text-body-secondary">
                <ul class="pagination justify-content-center mb-0">
                    
                    {% if page_obj.has_previous %}
                        <li class="page-item"><a class="page-link" href="?page=1">&laquo;</a></li>
                        <li class="page-item"><a class="page-link" href="?page={{ page_obj.previous_page_number }}">Atrás</a></li>
                    {% endif %}
            
                        <li class="page-item"><span class="page-link">{{ page_obj.number }} de {{ page_obj.paginator.num_pages }}</span></li>
            
            
                    {% if page_obj.has_next %}
                        <li class="page-item"><a class="page-link" href="?page={{ page_obj.next_page_number }}">Siguiente</a></li>
                        <li class="page-item"><a class="page-link" href="?page={{ page_obj.paginator.num_pages }}">&raquo;</a></li>
                    {% endif %}
                    
                </ul>
            </div>
        </div>
    </div>

        
{% endblock %}