@extends('admin.layout')
@section('title','Gestion utilisateurs')
@section('content')



                        <!-- [ Main Content ] start -->

                            <!-- [ Hover-table ] start -->
                            <div class="col-xl-12">
                                <div class="card">
                                    <div class="card-header">
                                        <h5>Utilisateurs</h5>
                                        <span class="d-block m-t-5">Listes des admins</span>
                                    </div>
                                    <div class="card-block table-border-style">
                                        <div class="table-responsive">
                                            <table class="table table-hover">
                                                <thead>
                                                    <tr>
                                                        <th>#</th>
                                                        <th>Nom</th>
                                                        <th>Prenom</th>
                                                        <th>Contact</th>
                                                        <th>Adresse</th>
                                                        <th>Email</th>
                                                        <th>Action</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    @forelse ($users as $u)
                                                    <tr>
                                                        <th scope="row">{{$u->id}}</th>
                                                        <td>{{$u->nom}}</td>
                                                        <td>{{$u->prenom}}</td>
                                                        <td>{{$u->phone}}</td>
                                                        <td>{{$u->adresse}}</td>
                                                        <td>{{$u->email}}</td>
                                                        <td>
                                                            <a class="btn btn-primary" title="Modifier utilisateur" data-toggle="tooltip" href="{{asset('edit_user/'.$u->id)}}">Modifier</a>
                                                            <button type="button" class="btn btn-danger" title="Supprimer" onclick="delete_typo{{$u->id}}()" data-toggle="tooltip"><i class="fas fa-trash"></i></button>
                                                        </td>
                                                    </tr>
                                                    <script type="text/javascript">
                                                        function delete_typo{{$u->id}}(){
                                                          if(confirm("Voulez-vous vraiment supprimer cet admin !"))
                                                            location.href='{{ url("/delete_user/$u->id") }}';
                                                        }
                                                      </script>
                                                    @empty

                                                    @endforelse

                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!-- [ Hover-table ] end -->



@endsection
