<!DOCTYPE html>
<html lang="fr">

<!-- Head -->
<head>
    {% include 'head.html' %}
</head>
<!-- End of Head -->

<body id="page-top">

<!-- Page Wrapper -->
<div id="wrapper">

    <!-- Sidebar -->
    {% include 'sidebar.html' %}
    <!-- End of Sidebar -->

    <!-- Content Wrapper -->
    <div id="content-wrapper" class="d-flex flex-column">

        <!-- Main Content -->
        <div id="content">

            <!-- Topbar -->
            <nav class="navbar navbar-expand navbar-light bg-white topbar mb-4 static-top shadow">
                {% include 'topbar.html' %}
            </nav>
            <!-- End of Topbar -->

            <!-- Begin Page Content -->
            <div class="container-fluid">
                {% if usermanage_div==0 %}
                <div class="card bg-success text-white shadow">
                    <div class="card-body">
                        L'utilisateur proche a été ajouté avec succès à {{prenom_user}} {{name_user}}
                    </div>
                </div>
                {% endif %}
                {% if usermanage_div==1 %}
                <div class="card bg-danger text-white shadow">
                    <div class="card-body">
                        L'utilisateur patient n'a pas été ajouté à {{prenom_user}} {{name_user}} car les données ne sont
                        pas identiques
                    </div>
                </div>
                {% endif %}
                {% if usermanage_div==2 %}
                <div class="card bg-danger text-white shadow">
                    <div class="card-body">
                        L'utilisateur {{prenom_user}} {{name_user}} n'existe pas
                    </div>
                </div>
                {% endif %}
                {% if usermanage_div==3 %}
                <div class="card bg-danger text-white shadow">
                    <div class="card-body">
                        L'utilisateur {{prenom_user}} {{name_user}} n'est pas un proche
                    </div>
                </div>
                {% endif %}

                <h1>Gestion accès utilisateur</h1>
                <!-- Forms -->
                <form method="post" action="user_manageinput" class="user">
                    <div class="form-group row">
                        <label class="col-sm-2 col-form-label text-center">Utilisateur proche</label>
                        <div class="col">
                            <input name="prenom" type="text" class="form-control" placeholder="Prénom">
                        </div>
                        <div class="col">
                            <input name="nom" type="text" class="form-control" placeholder="Nom de famille">
                        </div>
                        <div class="col">
                            <button type="submit" class="btn btn-primary">Confirmer</button>
                        </div>
                    </div>
                </form>

                {% if datatable==1 %}
                <div class="card shadow mb-4">
                    <div class="card-header py-3">
                        <h6 class="m-0 font-weight-bold text-primary">Liste de tous les patients</h6>
                    </div>
                    <div class="card-body">
                        <div class="table-responsive">
                            <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
                                <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>Nom</th>
                                    <th>Prénom</th>
                                    <th>Téléphone</th>
                                    <th>Administré par {{prenom_user}} {{name_user}}</th>
                                </tr>
                                </thead>
                                <tbody>
                                {% for list_final in accounts %}
                                <tr>
                                    <td>{{ list_final[0] }}</td>
                                    <td>{{ list_final[1] }}</td>
                                    <td>{{ list_final[2] }}</td>
                                    <td>{{ list_final[3] }}</td>
                                    <td>{{ list_final[4] }}</td>
                                </tr>
                                {% endfor %}
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>

                <!-- Forms -->
                <form method="post" action="user_manageaccount" class="user">
                    <div class="form-group row">
                        <label class="col-sm-2 col-form-label text-center">Utilisateur patient</label>
                        <div class="col">
                            <input name="prenom" type="text" class="form-control" placeholder="Prénom">
                        </div>
                        <div class="col">
                            <input name="nom" type="text" class="form-control" placeholder="Nom de famille">
                        </div>
                        <div class="col">
                            <button type="submit" class="btn btn-primary">Confirmer</button>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label class="col-sm-2 col-form-label text-center">ID de l'utilisateur</label>
                        <div class="col-sm-2 col-form-label">
                            <select name="id" class="form-control" id="exampleFormControlSelect1">
                                {% for list in accounts %}
                                <option>{{ list[0] }}</option>
                                {% endfor %}
                            </select>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label class="col-sm-2 col-form-label text-center">Supprimer ?</label>
                        <div class="col-sm-2 col-form-label">
                            <select name="askDelete" class="form-control" id="exampleFormControlSelect">
                                <option>Oui</option>
                                <option>Non</option>
                            </select>
                        </div>
                    </div>
                </form>
                {% endif %}

            </div>
            <!-- /.container-fluid -->

        </div>
        <!-- End of Main Content -->

        <!-- Footer -->
        {% include 'footer.html' %}
        <!-- End of Footer -->

    </div>
    <!-- End of Content Wrapper -->

</div>
<!-- End of Page Wrapper -->

<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
    <i class="fas fa-angle-up"></i>
</a>

<!-- Logout Modal-->
<div class="modal fade" id="logoutModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
     aria-hidden="true">
    {% include 'auth/logout_modal.html' %}
</div>

</body>

</html>
