@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;">Produits</h1>
          </div><!-- /.col -->
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">

            </ol>
          </div><!-- /.col -->
        </div><!-- /.row -->
      </div><!-- /.container-fluid -->
    </div>
    <!-- /.content-header -->

    <form id="search-form" class="mb-3" method="Get" action="{{asset('/searchinv/')}}">        
    <div class="input-group">
        <input name="search" type="text" id="search" class="form-control" placeholder="Rechercher par référence" value="{{ request('search') }}">
        <button class="btn btn-success" type="submit">Chercher</button>
    </div>
</form>

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


 



     
              

            <!-- /.card-header -->
            <div class="card-body"> 
            <div class="table-responsive">
            <table id="example" 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</th>
                <th style="color: blue;font-weight: bold;">qty</th>
                <th style="width:180px;">action</th>
             
                </tr>
                </thead>
                <tbody>   <tr>
                  @foreach($produits as $produit)
                  <td>  {{$produit->id}}</td>
          
             <td class="text-primary font-weight-bold"> {{$produit->nom}}  </td>
             <td> {{$produit->stock}}  </td>
             <td>
          
                          <a type="button" class="btn btn-info btn-sm"  data-toggle="modal" data-target="#exampleModal{{$produit->id}}">
                          <i class="fas fa-pencil-alt">
                              </i>
                             
                         
</a>

<!-- Modal -->
<div class="modal fade" id="exampleModal{{$produit->id}}" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
  <div class="modal-content bg-info text-white">
 
      <div class="modal-body">
      <form method="POST" action="{{asset('inventairupdat/'.$produit->id)}}" enctype="multipart/form-data">

@csrf  

  
    <div class="form-group">
    <label for="exampleInputEmail1">qty</label>
    <input value="{{$produit->stock}}" name="qty" type="text" class="form-control" placeholder="Enter categorie">
    </div>  
   
<div class="form-group">

<img style="width: 25px;height: 25px;" src="{{asset('img/'.$produit->img)}}" alt="">

</div>



<button type="button" class="btn btn-secondary" data-dismiss="modal">quitter</button>
  <button type="submit" class="btn btn-warning float-right">modifier</button> 
</form>
      </div>

    </div>
  </div>
</div>
                          <a class="btn btn-danger btn-sm" href="{{asset('topcatsup/'.$produit->id)}}">
                              <i class="fas fa-trash">
                              </i>
                        
                          </a>
             </td>
           
           </tr> 
             @endforeach
          </tbody>
        </table>
        <div class="d-flex justify-content-center mt-4">
                                                {{ $produits->links('pagination::bootstrap-4') }}
                                            </div>
        </div>


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

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








</body>
</html>