@extends('layouts.header-Admin')
@section('adminPage')
    <style>
        .dtHorizontalVerticalExampleWrapper {
            max-width: 600px;
            margin: 0 auto;
        }

        #dtHorizontalVerticalExample th,
        td {
            white-space: nowrap;
        }

        table.dataTable thead .sorting:after,
        table.dataTable thead .sorting:before,
        table.dataTable thead .sorting_asc:after,
        table.dataTable thead .sorting_asc:before,
        table.dataTable thead .sorting_asc_disabled:after,
        table.dataTable thead .sorting_asc_disabled:before,
        table.dataTable thead .sorting_desc:after,
        table.dataTable thead .sorting_desc:before,
        table.dataTable thead .sorting_desc_disabled:after,
        table.dataTable thead .sorting_desc_disabled:before {
            bottom: .5em;
        }
        
    </style>
    <div class="pagetitle">
        <div class="row">
            <h1 class="col-10">Listes des recherches </h1>
            <div class="col text-end">
                <a href="{{ route('admin.index') }}">
                    <button type="button" class="btn btn-success">Retour</button>
                </a> 

            </div>
            <nav>
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="#">Tableau</a></li>
                </ol>
                
            </nav>
        </div><!-- End Page Title -->


        <section class="section">
            <div class="row">
                <div class="col-lg">
                    <!--------->
                    <div class="card-body">

                        <div class="dataTable-wrapper dataTable-loading no-footer sortable searchable fixed-columns">
                            <div class="dataTable-container">
                                <table id="dtHorizontalVerticalExample"  class="table table-striped table-bordered table-sm" cellspacing="0" width="100%">
                                    <thead>
                                        <tr>
                                            <th>Matricule</th>
                                            <th>Nom</th>
                                            <th>Prenoms</th>
                                            <th>Taille</th>
                                            <th>Sexe</th>
                                            <th>Actions</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        @if (!empty($admins) && $admins->count())
                                            @foreach ($admins as $admin)
                                                <tr>
                                                    <td>{{ $admin->matricule }}</td>
                                                    <td>{{ $admin->nom }}</td>
                                                    <td>{{ $admin->prenoms }}</td>
                                                    <td>{{ $admin->taille }}</td>
                                                    <td>{{ $admin->sexe }}</td>
                                                    <td>

                                                        <div class=" d-flex grid ">
                                                            <div class="g-col-4">
                                                                <button class="btn bg-primary">
                                                                    <a href="{{ route('admin.show', $admin->id) }}">
                                                                        <img class="pointer" src="{{ asset('assets/img/detail.png') }}"
                                                                            alt="" srcset="">
                                                                    </a>
                                                                </button>
                                                            </div>
                                                            <div class="g-col-4 ms-2">
                                                                <button class="btn bg-warning">
                                                                    <a href="{{ route('admin.edit', $admin->id) }}">
                                                                        <img class="pointer" src="{{ asset('assets/img/refresh.png') }}"
                                                                            alt="" srcset="">
                                                                    </a>
                                                                </button>
                                                            </div>
                                                        </div>

                                                    </td>


                                                </tr>
                                            @endforeach
                                            @elseif(request()->input())
                                            <h3 class="text-danger"> {{$admins->total()}} .résultat pour la recherche."{{request()->search }} "</h3>
                                        @endif
                                    </tbody>
                                </table>
                            </div>
                            <div class="dataTable-bottom">
                                <div class="dataTable-info">
                                </div>
                                <nav class="dataTable-pagination">
                                    <ul class="dataTable-pagination-list">
                                      
                                    </ul>
                                </nav>
                            </div>
                        </div>
                    </div>
                    <!------->

                </div>
            </div>

            <script>
                $(document).ready(function() {
                    $('#dtHorizontalVerticalExample').DataTable({
                        "scrollX": true,
                        "searching": false,
                    });
                    $('.dataTables_length').addClass('bs-select');
                });
            </script>

        </section>
    @endsection









