@extends('layouts.appadmin')
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/datetime/1.5.1/css/dataTables.dateTime.min.css">
@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">
           <h3 style="color: blue;font-weight: bold;">Liste commande ({{$boncommandes->count()}})</h3>
          </div><!-- /.col -->
          <div class="col-sm-6">
          <ol class="breadcrumb float-sm-right">
            <a href="{{asset('commande')}}" class="btn btn-primary">+Commande</a>
            </ol>
         </div>  </div>  </div>
         <form method="GET" action="{{asset('cherchefacturcommande')}}">
  <div class="row mb-4">
    <div class="col-md-3">
      <label for="start_date">Date de début</label>
      <input type="date" name="start_date" id="start_date" class="form-control" value="{{ request('start_date') }}">
    </div>
    <div class="col-md-3">
      <label for="end_date">Date de fin</label>
      <input type="date" name="end_date" id="end_date" class="form-control" value="{{ request('end_date') }}">
    </div>
    <div class="col-md-3">
      <label for="reference">Référence</label>
      <input type="text" name="reference" id="reference" class="form-control" value="{{ request('reference') }}">
    </div>
    <div class="col-md-3">
      <button type="submit" class="btn btn-primary" style="margin-top: 32px;">Rechercher</button>
    </div>
  </div>
</form>


    <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> 
         bon de commandes
      </div> 
      </div> 


            <!-- /.card-header -->
            <div class="card-body">
            <div class="table-responsive">
            <table id="examp" class="table table-bordered display nowrap" cellspacing="0" width="100%">
                <thead>
                <tr>
                <th>Ref facture</th>
                  <th>fournisseur</th>
                  <th>date</th>
             
                  <th>Total TTC</th>
              
       
                  <th style="width: 300px;">Action</th>
             
                </tr>
                </thead>
                <tbody>
                    @foreach($boncommandes as $facturbon)
                    <tr>
             <td> {{$facturbon->id}} </td> 
             <td class="text-primary font-weight-bold"> <a href="">{{$facturbon->fournisseur->nom}}</a>   </td> 
             <td>{{date('d-m-Y', strtotime($facturbon->created_at))}}  </td> 
          
              <td class="text-success font-weight-bold"> {{$facturbon->prixtotal}} DH</td> 
           
             <td>
             
<a class="btn btn-info btn-sm mx-1" href="{{asset('boncommandepdf/'.$facturbon->id)}}">
        <i class="fas fa-file-pdf"></i> PDF
    </a>
            
             
    <form style="display:inline">
        @csrf
        <button class="btn btn-primary btn-sm mx-1" type="submit">
            <i class="fas fa-edit"></i> Modifier
        </button>
    </form>
    <form style="display:inline" method="" action="">
    
        <button class="btn btn-danger btn-sm mx-1" type="submit">
            <i class="fas fa-trash"></i> Supprimer
        </button>
    </form> 
              
            </td> 
       
            </tr>
             @endforeach
          </tbody>
        </table>

        <div class="d-flex justify-content-center mt-4">
                                                {{ $boncommandes->links('pagination::bootstrap-4') }}
                                            </div>

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

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

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



