{% extends 'base.html' %}
{% load crispy_forms_tags %}
{% block loader %}
{% endblock %}
{% block content %}

<div class="main-content">
    <section class="section">
        {% block entete %}
        <div class="col-12 col-md-12 col-lg-12">
            <div class="card">
                <div class="card-header">
                    <h4>RECHERCHE UNE REUION :</h4>
                </div>
                <div class="card-body">
                    <form accept-charset="utf-8" action="" class="form-inline md-form mr-auto mb-6 ml-3 mt-3"  method="get">
                        <div>
                            <div class="form-group row">
                                <label class="col-sm-12 col-md-2 col-form-label"></label>
                                <div class="col-sm-12 col-md-12">
                                    <input class="form-control" id="searchbox" name="q" type="text" required>
                                </div>
                            </div>
                        </div>
                        <button class="btn btn-primary btn-rounded btn-sm my-0 ml-5" type="submit">RECHERCHE</button>
                    </form>
                </div>
                <div class="card-footer">
                </div>
            </div>
        </div>
        {% endblock %}
        {% block board %}
        <div class="row">
            <div class="col-12">
                <div class="card">
                    <div class="card-header">
                        <h4>LISTE DES REUNIONS DE CERCLE</h4>
                        <div class="card-header-action">
                            <div class=" row justify-content-center text-center">
                                <button class="btn btn-primary btn-lg btn-block" data-toggle="modal" data-target="#addReunionModal">Créer nouveau</button>
                            </div>
                        </div>
                    </div>
                    <div class="card-body">
                        <div class="table-responsive">
                            <table class="table table-striped table-hover" id="tableExport" style="width:100%;">
                                <thead>
                                <tr>
                                    <th>TITRE</th>
                                    <th>DATE</th>
                                    <th>DUREE</th>
                                    <th>LIEU</th>
                                    <th>THEME</th>
                                    <th>MODERATEUR</th>
                                    <th>BUDGET</th>
                                    <th>ACTION</th>

                                </tr>
                                </thead>
                                <tbody>
                                {% for reunion in reunions %}
                                <tr>
                                    <td>
                                        {{reunion.titre_reunion}}
                                    </td>
                                    <td>{{reunion.date}}</td>
                                    <td>{{reunion.duree}}</td>
                                    <td>{{reunion.lieu}}</td>
                                    <td>{{reunion.theme}}</td>
                                    <td>{{reunion.modérateur}}</td>
                                    <td>{{reunion.budget}}</td>
                                    <td>

                                        <div class="dropdown">
                                            <a href="#" data-toggle="dropdown" class="btn btn-primary dropdown-toggle">Options</a>
                                            <div class="dropdown-menu">
                                                <a href="{{reunion.get_absolute_url}}" class="dropdown-item has-icon"><i class="fas fa-eye"></i>Detail</a>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                {% endfor %}
                                </tbody>
                            </table>
                            <nav aria-label="Page navigation">
                                <ul class="pagination justify-content-end">
                                    {% if page_obj.has_previous %}
                                    <li class="page-item">
                                        <a class="page-link" href="?page={{ page_obj.previous_page_number }}">Prec</a>
                                    </li>
                                    {% endif %}

                                    <!-- Affiche les numéros de page -->
                                    {% for num in paginator.page_range %}
                                    {% if page_obj.number == num %}
                                    <!-- Page actuelle (lien désactivé) -->
                                    <li class="page-item active">
                                        <a class="page-link" href="#">{{ num }}</a>
                                    </li>
                                    {% elif num > page_obj.number|add:'-5' and num < page_obj.number|add:'5' %}
                                    <!-- Lien pour d'autres pages -->
                                    <li class="page-item">
                                        <a class="page-link" href="?page={{ num }}">{{ num }}</a>
                                    </li>
                                    {% endif %}
                                    {% endfor %}

                                    {% if page_obj.has_next %}
                                    <li class="page-item">
                                        <a class="page-link" href="?page={{ page_obj.next_page_number }}">Suiv</a>
                                    </li>
                                    {% endif %}
                                </ul>
                            </nav>

                        </div>
                    </div>
                </div>
            </div>
        </div>
        {% endblock %}
        {% block chart %}

        {% endblock %}
        {% block tache %}

        {% endblock %}
        {% block ticket %}

        {% endblock %}
    </section>
</div>
{% include 'ajoutreunioncercle.html' %}

 {% endblock %}

<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<div class="modal fade" id="errorModal" tabindex="-1" role="dialog" aria-labelledby="errorModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="errorModalLabel">Erreur</h5>
            </div>
            <div class="modal-body">
                <p id="errorText" class="text-danger"></p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal" id="closeModalBtn">Fermer</button>
            </div>
        </div>
    </div>
</div>
<script>