@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;">1Factures de vente ({{$bonlivraisons->count()}})</h3>
          </div><!-- /.col -->
          <div class="col-sm-6">
          <ol class="breadcrumb float-sm-right">
            <a href="{{asset('bonlivraisons')}}" class="btn btn-info">+facture</a>
            </ol>
         </div>  </div>  </div>
     

    <section class="content">
      <div class="row">
        <div class="col-12">
          <div class="card">
          <div class="card-header  bg-info">
          <div class="col-md-6 font-weight-bold"><i class="fas  fa fa-users"></i> 
          vous avez 2 facture(s) arrivant a échéance.
      </div> 
      </div> 


 





            <!-- /.card-header -->
            <div class="card-body">
            <div class="table-responsive">
            <table id="example1" class="table table-bordered display nowrap" cellspacing="0" width="100%">
                <thead>
                <tr>
                  <th>Ref facture</th>
                  <th>client</th>
                  <th>date</th>
                  <th>Mode réglement</th>
                  <th>Total TTC</th>
                  <th>Etat</th>
                  <th>Echeance</th>
                  <th width="100">action</th>
             
                </tr>
                </thead>
                <tbody>
                    @foreach($bonlivraisons as $vente)
                    <tr>
                      <td>{{$vente->id}} </td>

             <td class="text-primary font-weight-bold"> <a href="">{{$vente->client->nom}}</a>   </td> 
             <td>{{date('d-m-Y', strtotime($vente->createf_at))}}  </td> 
                <td> {{$vente->modepayement->mode}} </td> 
              <td class="text-success font-weight-bold"> {{$vente->prixtotal}} DH</td> 
             <td> {{$vente->encour->etat}} </td> 
             <td> {{$vente->dateecheance}} </td> 
            
             <td>
             <a class="btn btn-primary btn-sm" href="{{asset('bonlivraisonpdf/'.$vente->id)}}">
                              <i class="fas fa-folder">
                              </i>
                              View pdf
                          </a>

             <!-- Button trigger modal -->

<!-- Modal -->
<div class="modal fade" id="exampleModal{{$vente->id}}" 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 text-success font-weight-bold" id="exampleModalLabel ">changer etat facture :{{$vente->id}}</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        cette factur doit etre régiée avant le {{$vente->dateecheance}} (11)
      {{$vente->id}}
    <h2>versement:200 DH</h2>  
    <h2>rest:300 DH</h2>  
      <form>
  <div class="form-group">
    <label for="exampleInputEmail1">Nouveau vercement</label>
    <input type="text" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter">
    </div>  
    <div class="form-group">
    <label for="exampleFormControlSelect1">changer etat</label>
    <select class="form-control" id="exampleFormControlSelect1">
      @foreach($encour as $etat)
      <option value="$etat->id">{{$etat->etat}}</option>
 @endforeach
    </select>
  </div>
    <div class="form-group">
    <label for="exampleInputEmail1">Modifier le date d'écheance </label>
    <input type="date" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter">
    </div> 
</form>
      </div>
      <div class="modal-footer">

        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>
             </td>
            </tr>
             @endforeach
          </tbody>
        </table>



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

                </section>
    </div>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
  
        @endsection

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







<script>
$(document).ready( function () {
    $('#example1').DataTable( {
      responsive:true
    });
} );
</script>
</body>
</html>