@extends('app')
@section('title', 'Gestion des utilisateurs')
@section('link')
    <!-- Data Table Css -->
    <link rel="stylesheet" href="{{asset('bower_components/datatables.net-bs4/css/dataTables.bootstrap4.min.css')}}">
    <link rel="stylesheet" href="{{asset('assets/pages/data-table/css/buttons.dataTables.min.css')}}">
    <link rel="stylesheet" href="{{asset('bower_components/datatables.net-responsive-bs4/css/responsive.bootstrap4.min.css')}}">
    <link rel="stylesheet" href="{{asset('assets/pages/data-table/extensions/autofill/css/autoFill.dataTables.min.css')}}">
    <link rel="stylesheet" href="{{asset('assets/pages/data-table/extensions/autofill/css/select.dataTables.min.css')}}">
    <style>
        .dataTables_length{
            display: none;
        }
    </style>
@endsection
@section('content')
<div class="pcoded-inner-content">
    @include('includes._alert')
    <div class="main-body">
        <div class="page-wrapper">
            <div class="page-body">
                <div class="row">
                    <div class="col-sm-12">
                        <div class="card">
                            <div class="card-header mb-0 pb-0">
                                <div class="d-flex justify-content-between pb-2">
                                    <h4>Gestion Enseignants</h4>
                                    <span>
                                        <a href="{{route('user.create')}}" class="btn btn-inverse btn-outline-inverse  btn-sm mx-1 py-1" title="Add Teacher"> <i class="fas fa-plus mx-0"></i></a>
                                        <a href="{{route('user.index1')}}" class="btn btn-inverse btn-outline-inverse  btn-sm mx-1 py-1" title="User List"> <i class="fab fa-cloudsmith m-0"></i></a>
                                        <a href="{{route('user.inactif')}}" class="btn btn-inverse btn-outline-inverse  btn-sm mx-1 py-1" title="Disabled"> <i class="fas fa-underline m-0"></i></a>
                                    </span>
                                </div>
                            </div>
                            <hr class="my-0 mx-3">
                            <div class="card-block">
                                <div class="dt-responsive table-responsive">
                                    <div class="tab-content card-block">
                                        <table id="autofill" class="table table-striped table-bordered nowrap">
                                            <thead>
                                                <tr>
                                                    <th class="text-center" style="width:15px">N°</th>
                                                    <th>Nom</th>
                                                    <th>Prénoms</th>
                                                    <th>Sexe</th>
                                                    <th>E-mail</th>
                                                    <th>Téléphone</th>
                                                    <th>Profil</th>
                                                    <th class="text-center">Actions</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                @php $i = 1; @endphp
                                                @foreach ($profs as $user)
                                                <tr>
                                                    <th class="text-center">{{$i <= 9 ? '0'.$i++:$i++}}</th>
                                                    <td>{{strtoupper($user->first_name)}}</td>
                                                    <td>{{ucwords($user->last_name)}}</td>
                                                    <td>{{$user->sexe == 'F' ? ucfirst('Femme'):ucfirst('Homme')}}</td>
                                                    <td>{{$user->email}}</td>
                                                    <td>{{$user->telephon}}</td>
                                                    <td class="text-center">{{ucfirst($user->typeEnseignant == 'professeur' ? ('professeur'.($user->sexe == 'F' ? 'e':'')):'Institut'.($user->sexe == 'F' ? 'rice':'eur'))}}</td>
                                                    <td class="py-0">
                                                        <div class="card-block remove-label mt-2 p-0 text-center">
                                                            <a href="{{route('user.show',$user->id)}}" class="btn btn-sm btn-primary text-center px-2" title="Detail"><i class="fas fa-ellipsis-h mx-0"></i></a>
                                                            <a href="{{route('user.edit',$user->id)}}" class="btn btn-sm btn-info text-center px-2" title="Edit"><i class="fas fa-edit mx-0"></i></a>
                                                            {{-- <button class="userDelete btn btn-sm btn-danger text-white text-center px-2" title="Delete" data-id="{{$user->id}}" data-toggle="modal" data-target="#userModel"><i class="far fa-trash-alt mx-0"></i></button> --}}
                                                        </div>
                                                    </td>
                                                </tr>
                                                @endforeach
                                            </tbody>
                                        </table>
                                    </div> 
                                </div> 
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
@section('script')
    <!-- data-table js -->
    <script src="{{asset('bower_components/datatables.net/js/jquery.dataTables.min.js')}}"></script>
    <script src="{{asset('bower_components/datatables.net-buttons/js/dataTables.buttons.min.js')}}"></script>
    <script src="{{asset('assets/pages/data-table/js/jszip.min.js')}}"></script>
    <script src="{{asset('assets/pages/data-table/js/pdfmake.min.js')}}"></script>
    <script src="{{asset('assets/pages/data-table/js/vfs_fonts.js')}}"></script>
    <script src="{{asset('assets/pages/data-table/extensions/autofill/js/dataTables.autoFill.min.js')}}"></script>
    <script src="{{asset('assets/pages/data-table/extensions/autofill/js/dataTables.select.min.js')}}"></script>
    <script src="{{asset('bower_components/datatables.net-buttons/js/buttons.print.min.js')}}"></script>
    <script src="{{asset('bower_components/datatables.net-buttons/js/buttons.html5.min.js')}}"></script>
    <script src="{{asset('assets/pages/data-table/js/dataTables.bootstrap4.min.js')}}"></script>
    <script src="{{asset('bower_components/datatables.net-responsive/js/dataTables.responsive.min.js')}}"></script>
    <script src="{{asset('bower_components/datatables.net-responsive-bs4/js/responsive.bootstrap4.min.js')}}"></script>
    <!-- Custom js -->
    <script src="{{asset('assets/pages/data-table/extensions/autofill/js/extensions-custom.js')}}"></script>
    <script src="{{asset('assets/js/pcoded.min.js')}}"></script>
    <script src="{{asset('assets/js/vartical-layout.min.js')}}"></script>
    <script src="{{asset('assets/js/jquery.mCustomScrollbar.concat.min.js')}}"></script>
    <script>
        $(document).ready(function(){
            
        })
    </script>
@endsection