@extends('layouts.appadmin')

@section('content')
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <div class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1 style="color: blue;font-weight: bold;"">Liste des fournisseurs</h1>
          </div><!-- /.col -->
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
<!-- Button trigger modal -->
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#modal-xl">
 + Nouveau fournisseur
</button>
<!-- Modal -->
<div class="modal fade" id="modal-xl">
          <div class="modal-dialog modal-xl">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">ajouter fournisseur</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
      <form method="POST" action="{{asset('addfournisseur')}}" enctype="multipart/form-data">      
              @csrf 
   
              <div class="row">
 <div class="col-md-6">
   <div class="form-group">
     <label for="exampleInputEmail1">nom</label>
     <input name="nom" type="text" class="form-control" placeholder="Enter categorie">
     </div>  
     
     <div class="form-group">
     <label for="exampleInputEmail1">Monton</label>
     <input name="monton" type="text" class="form-control" placeholder="Enter categorie">
     </div>  
     <div class="form-group">
     <label for="exampleInputEmail1">telephone</label>
     <input name="tele" type="text" class="form-control" placeholder="Enter categorie">
     </div>  
     <div class="form-group">
     <label for="exampleInputEmail1">email</label>
     <input name="email" type="text" class="form-control" placeholder="Enter categorie">
     </div>  </div>  
    
    <div class="col-md-6">

     <div class="form-group">
     <label for="exampleFormControlSelect1">ville</label>
     <select name="ville" class="form-control" id="exampleFormControlSelect1">
     @foreach($villes as $ville)
       <option value="{{$ville->id}}">{{$ville->ville}}</option>
      
       @endforeach
     </select>
 
   </div> 
   <div class="form-group">
     <label for="exampleFormControlSelect1">statut</label>
     <select name="statut" class="form-control" id="exampleFormControlSelect1">
     @foreach($statuts as $statut)
       <option value="{{$statut->id}}">{{$statut->statut}}</option>
      
       @endforeach
     </select>
 
   </div> 
   </div>  
   <button  type="submit" class="btn btn-primary">enregistrer</button>
 </form>
      </div>
     
    </div>
  </div>
</div>
            </ol>
          </div><!-- /.col -->
        </div><!-- /.row -->
      </div><!-- /.container-fluid -->
    </div>
    <!-- /.content-header -->


               <!-- Main content -->
    <section class="content">
      <div class="row">
        <div class="col-12">
          <div class="card">
          <div class="card-header  bg-info">
          <div class="col-md-3 font-weight-bold"><i class="fas  fa fa-users"></i>  fournisseurs
          <span class="badge badge-pill badge-warning" style="font-size:20px;">  {{$fournisseurs->count() }}</span>
      </div>
            </div>  

 





            <!-- /.card-header -->
            <div class="card-body">
            <div class="table-responsive">
            <table  class="table table-bordered display nowrap" cellspacing="0" width="100%">
                <thead>
                <tr>
                <th style="color: blue;font-weight: bold;">Ref</th>
                <th style="color: blue;font-weight: bold;">nom complet</th>
                <th style="color: blue;font-weight: bold;">statut</th>
    
               
                <th style="color: blue;font-weight: bold;">ville</th>
                <th style="color: blue;font-weight: bold;">cp</th>
                <th style="color: blue;font-weight: bold;">tele</th>
                <th style="color: blue;font-weight: bold;">email</th>
                <th style="color: blue;font-weight: bold;">action</th>
                </tr>
                </thead>
                <tbody>
                    @foreach($fournisseurs as $fournisseur)
                    <tr>
             <td> {{$fournisseur->id}} </td>
             <td> {{$fournisseur->nom}} </td>
             <td> {{$fournisseur->statut->statut}} </td>
        
       
             <td> {{$fournisseur->ville->ville}} </td>
             <td> {{$fournisseur->monton}} </td>
             <td> {{$fournisseur->tele}} </td>
             <td> {{$fournisseur->email}} </td>
            <td> 
            <button type="button" class="btn btn-info" data-toggle="modal" data-target="#modal-xl{{ $fournisseur->id  }}">
Modifier
</button>
<!-- Modal -->
<div class="modal fade" id="modal-xl{{ $fournisseur->id  }}">
          <div class="modal-dialog modal-xl">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">ajouter fournisseur</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
      <form method="POST" action="{{asset('mdiffr/'.$fournisseur->id)}}" enctype="multipart/form-data">      
              @csrf 
   
              <div class="row">
 <div class="col-md-6">
   <div class="form-group">
     <label for="exampleInputEmail1">nom</label>
     <input name="nom" value="{{$fournisseur->nom}}" type="text" class="form-control" placeholder="Enter categorie">
     </div>  
     
     <div class="form-group">
     <label for="exampleInputEmail1">Monton</label>
     <input name="monton" value="{{$fournisseur->monton}}" type="text" class="form-control" placeholder="Enter categorie">
     </div>  
     <div class="form-group">
     <label for="exampleInputEmail1">telephone</label>
     <input name="tele" value="{{$fournisseur->tele}}" type="text" class="form-control" placeholder="Enter categorie">
     </div>  
     <div class="form-group">
     <label for="exampleInputEmail1">email</label>
     <input name="email" value="{{$fournisseur->email}}" type="text" class="form-control" placeholder="Enter categorie">
     </div>  </div>  
    
    <div class="col-md-6">

     <div class="form-group">
     <label for="exampleFormControlSelect1">ville</label>
     <select name="ville" class="form-control" id="exampleFormControlSelect1">
     @foreach($villes as $ville)
       <option value="{{$ville->id}}">{{$ville->ville}}</option>
      
       @endforeach
     </select>
 
   </div> 
   <div class="form-group">
     <label for="exampleFormControlSelect1">statut</label>
     <select name="statut" class="form-control" id="exampleFormControlSelect1">
     @foreach($statuts as $statut)
       <option value="{{$statut->id}}">{{$statut->statut}}</option>
      
       @endforeach
     </select>
 
   </div> 
  
   <button  type="submit" class="btn btn-primary">enregistrer</button>
 </form>
      </div>
     
    </div>
  </div>
</div></div></div>
<a class="btn btn-danger btn-sm" href="{{asset('fournissersup/'.$fournisseur->id)}}">
                              <i class="fas fa-trash">
                              </i>
                           supprimer
                          </a>
        
            </td>
            
            
            </tr>
             @endforeach
          </tbody>
        </table>
        <div class="d-flex justify-content-center mt-4">
          {{ $fournisseurs->links('pagination::bootstrap-4') }}
      </div>


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

                </section>
    </div>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
  
        @endsection
        <script src="{{asset('dash/plugins/jquery/jquery.min.js')}}"></script>








</body>
</html>