@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 class="font-weight-bold">Liste des clients</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="#exampleModal">
 Nouveu client
</button>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">


      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>
            </ol>
          </div><!-- /.col -->
        </div><!-- /.row -->
      </div><!-- /.container-fluid -->
    </div>
    <!-- /.content-header -->

    <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>  clients
          <span class="badge badge-pill badge-warning" style="font-size:20px;"> {{$clients->count() }}</span>
      </div>
            </div>  

                    <div class="card">
              <div class="card-header">
                <h3 class="card-title">     <span class="badge badge-pill badge-danger" style="font-size:20px;"> creance  :{{$clientsum}}DH</span></h3> 
              </div>
              <!-- /.card-header -->
              <div class="card-body">
              <table id="example1" class="table table-bordered table-striped">
                <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;">caqtegorie</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;">pourcentage</th>
                <th style="color: blue;font-weight: bold;">action</th>
                </tr>
                </thead>
                <tbody>
                    @foreach($clients as $client)
                    <tr>
                    <td> {{$client->id}} </td>
             <td> {{$client->nom}} </td>
             <td> {{$client->statut->statut}} </td>
             <td>  {{$client->catclientfrn->cat}} </td>
       
             <td> {{$client->ville->ville}} </td>
             <td> {{$client->monton}} </td>
             <td> {{$client->tele}} </td>
             <td> {{$client->email}} </td>
             <td> {{$client->pourcentage}} %</td>
             <td>
            
            <!-- Button trigger modal -->

<a class="btn btn-primary btn-sm" href="#">
                              <i class="fas fa-folder">
                              </i>
                              View
                          </a>
                          <a  data-bs-toggle="modal" data-bs-target="#exampleModa{{$client->id}}" class="btn btn-info btn-sm" href="#">
                              <i class="fas fa-pencil-alt">
                              </i>
                              Edit
                          </a>
                          <a class="btn btn-danger btn-sm" href="#">
                              <i class="fas fa-trash">
                              </i>
                              Delete
                          </a>
<!-- Modal -->
<div class="modal fade" id="exampleModa{{$client->id}}" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
      <form method="POST" action="{{asset('modifclient/'.$client->id)}}" enctype="multipart/form-data">      
   @csrf  
  <div class="form-group">
    <label for="exampleInputEmail1">changer Taux remise client</label>
    <input name="taux" type="text" class="form-control" placeholder="Enter categorie">
    
  </div>
     <button type="submit" class="btn btn-primary">enregistrer</button>
 <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</form>
      </div>
      <div class="modal-footer">
        
     
      </div>
    </div>
  </div>
</div>

            
            
            </td>
              </tr>
             @endforeach
          </tbody>
        </table>

              </div>
              <!-- /.card-body -->
            </div>
            <!-- /.card -->
          </div>
          <!-- /.col -->
        </div>
        <!-- /.row -->
      </div>
      <!-- /.container-fluid -->
    </section>
    <!-- /.content -->
  </div>

</div></div>
<!-- ./wrapper -->

@endsection
<!-- jQuery -->

<script src="{{asset('dash/plugins/jquery/jquery.min.js')}}"></script>







<script>
$(document).ready( function () {
  $('#example1').DataTable({


  
 }
  );
} );
</script>
</body>
</html>
