@extends('layouts.super-Admin')
@section('listes')
    <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">Listes des policiers enregistrées</h1>
            <div class="col ">
                {{--
                @if (session()->has('info'))
                    <div class="alert alert-warning alert-dismissible fade show" role="alert">
                        {{ session('info') }}
                        <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                    </div>
                @elseif(session()->has('modif'))
                    <div class="alert alert-success alert-dismissible fade show" role="alert">
                        {{ session('modif') }}
                        <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                    </div>
                @endif
--}}
                 @include('sweetalert::alert')


            </div>
            <nav>
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="#">Listes des policiers enregistrées</a></li>
                </ol>
            </nav>
        </div><!-- End Page Title -->
        <div class="mb-5 row">
            <div class="col">
                <a href="{{ route('admins.create') }}" class=" btn bg-success text-white"> Ajouter un policier</a>
            </div>
            <div class="col text-end">
                <a href="{{ route('pdf.index') }}" class="">
                    <button type="button" class="text-end btn btn-primary">Télécharger les cartes</button>
                </a>
            </div>

        </div>

        <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-top">
                                <div class="dataTable-dropdown"><label><select class="dataTable-selector">
                                            <option value="5">5</option>
                                            <option value="10" selected="">10</option>
                                            <option value="15">15</option>
                                            <option value="20">20</option>
                                            <option value="25">25</option>
                                           </select>Show entries</label></div>
                                                <div class="dataTable-search">
                                                <form action="{{ route('search') }}">
                                                    <div class="input-group">
                                                        <div id="search-autocomplete" class="form-outline">
                                                            <input type="search" name="search" id="form1"  class="form-control" placeholder="Search..." />
                                                        </div>
                                                    </div>
                                                </form>
                                            </div>
                                                </form>
                                            </div>
                            </div>
                            <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">

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

                                                                    <a href="{{ route('admins.edit', $admin->id) }}">
                                                                    <button class="btn bg-warning">
                                                                        <img class="pointer" src="{{ asset('assets/img/refresh.png') }}"
                                                                            alt="" srcset="">
                                                                    </button>
                                                                    </a>
                                                            </div>
                                                            <div class="g-col-4 ms-2">
                                                                <form action="{{ route('admins.destroy', $admin->id) }}" method="post">
                                                                    @csrf
                                                                    @method('DELETE')
                                                                    <button class="btn bg-danger" type="submit" >
                                                                    <img src="{{ asset('assets/img/delete.png') }}" alt="" srcset="">

                                                                    </button>
                                                                </form>
                                                            </div>
                                                        </div>

                                                    </td>


                                                </tr>
                                            @endforeach
                                        @else
                                            <tr></tr>
                                        @endif
                                    </tbody>
                                </table>
                            </div>
                            <div class="dataTable-bottom">
                                <div class="dataTable-info">
                                    <p class="small text-muted">
                                        {!! __('Showing') !!}
                                        <span class="fw-semibold">{{ $admins->firstItem() }}</span>
                                        {!! __('to') !!}
                                        <span class="fw-semibold">{{ $admins->lastItem() }}</span>
                                        {!! __('of') !!}
                                        <span class="fw-semibold">{{ $admins->total() }}</span>
                                        {!! __('results') !!}
                                    </p>
                                </div>
                                <nav class="dataTable-pagination">
                                    <ul class="dataTable-pagination-list">
                                        {{ $admins->links() }}
                                    </ul>
                                </nav>
                            </div>
                        </div>
                    </div>
                    <!------->

                </div>
            </div>

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

        </section>
    @endsection









