@extends('layouts.app')
@section('morecss')
<style>
a.btn-color:hover {
  color: white !important;
}
a.btn-color{
	text-align: center;
}
</style>
@endsection
@section('content')
<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"><i class="fab fa-product-hunt"></i> Communes</h4>
					 @if(session()->has('message'))
				<div class="alert alertToolsBar alert-info alert-dismissible fade show }} mb-5"> 
                {!! 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>Code postal</strong></th>
                               <th><strong>NOM</strong></th>
                               <th></th>
                               <th></th>
                               <th></th>
                           </tr>
                        </thead>
                        <tbody>
						@foreach ($communes as $commune)
                           <tr>
						   <td>{{ $commune->code_postal}}</td>
				                    <td>{{ $commune->nom }}</td>
                              <td><a href="{{route('communes.edit',$commune->id)}}"><i class="fas fa-edit"></i></a></td>
                              <td><form action="{{route('communes.destroy', $commune->id)}}" method ="POST">
				                            @csrf
											{{ method_field('DELETE') }}
				                            <button type="submit" class="btn-back" onclick="return confirm('Vraiment supprimer cette commune ?')"><i class="fas fa-trash"></i></button>
				                        </form></td>
                           </tr>
						   @endforeach
                                                     
                        </tbody>
                     </table>
					 <a href="{{route('communes.create')}}" class="btn-color pull-right w-50">Créer une nouvelle commune</a>
                    {{ $communes->links() }}
                     </div>
                  </div>
				  <p><a href="{{route('home')}}" class="text-dark"><i class="fas fa-chevron-left mr-2"></i>Retour</a></p>

               </div>
            </div>
         </div>

         <img src="{{asset('image/PersonnageMecanicien.png')}}" class="comman-image-all3">

@endsection
