@extends('layouts.app')
@section('content')
<div class="coman-bg">
         <div class="container mt-5">
            <div class="row">
               <div class="col-lg-7 col-sm-12 col-12">
                  <div class="mendas-data">
                     <h4 class="text-center mb-5">{{$user_type}}s</h4>
<div> <form action="{{route($user_type.'s.index')}}" method="get">
                    	<div class="form-group">
                    		<div class="input-group">
                    		<label class='w-25'>Rechercher</label>
                              <input type="text" class="form-control form-text-field mr-3" value="{{request()->nom}}" id="nom" name="nom" placeholder="Nom" aria-label="nom" aria-describedby="basic-addon2">
                              <div class="input-group-prepend w-25">
                                <button onclick="document.getElementById('nom').value='';" class="btn-color  cancel mr-3"   type="submit" ><i class="fas fa-window-close"></i></button>
                             
                                <button class="btn-color mr-3" style='width: 44%;' type="submit"><i class="fas fa-search"></i></button>
                              </div>
                            </div>
                    	</div>
                    </form>
				</div>
				@if(session()->has('message'))
        				<div class="alert alertToolsBar alert-info alert-dismissible fade show }}"> 
                        {!! session('message') !!}
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                          </button>
                        </div>
    			@endif
                     <div class="table-responsive">
                        <table  id="example" class="table" style="width:100%">
                        <thead>
                           <tr>
                               <th><strong>NOM</strong></th>
                               <th></th>
                               <th></th>
                               <th></th>
                           </tr>
                        </thead>
                        <tbody>
						@foreach ($users as $user)
                           <tr>
                              <td><a class="" href="{{route('users.show',$user->id)}}"><i class="fas fa-eye"></i></a></td>
                              <td> <a href="{{route('users.show',$user->id)}}"> {{ $user->name}}<br>{{$user->surname }}</td>
                              <td><a href="{{route('users.edit',$user->id)}}"><i class="fas fa-edit"></i></a></td>
                              <td>
							  <form action="{{route('users.destroy', $user->id)}}" method ="POST">
			                            @csrf
										{{ method_field('DELETE') }}
			                            <button type="submit" class="btn-back" onclick="return confirm('Vraiment supprimer cet utilisateur ?')"><i class="fas fa-trash"></i></button>
			                        </form>	  </td>
                           </tr>
						   @endforeach
                          

                           
                        </tbody>
                     </table>
					 {{$users->links()}}
                     </div>
					 <p><a href="{{route('demandes.create')}}" class="text-dark"><i class="fas fa-chevron-left mr-2"></i>Retour</a></p>
                  </div>
               </div>
            </div>
         </div>

         <img src="image/PersonnageMécanicien.png" class="comman-image-all3">
      </div>
      

@endsection
