@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">
          
            <h3 class="font-weight-bold">Liste des articles22</h3>
          </div><!-- /.col -->
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
 + nouveau
</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">
      <form method="POST" action="{{asset('addproduit')}}" enctype="multipart/form-data">      
   @csrf 
   
   <div class="form-group">
    <label for="exampleFormControlSelect1">Example select</label>
    <select name="cat" class="form-control" id="exampleFormControlSelect1">
    @foreach($categories as $cat)
      <option value="{{$cat->id}}">{{$cat->cat}}</option>
     
      @endforeach
    </select>
  </div> 
  <div class="form-group">
    <label for="exampleInputEmail1">designation</label>
    <input name="nom" type="text" class="form-control" placeholder="Enter categorie">
    
  </div>
  <div class="form-group">
    <label for="exampleInputEmail1">prix unitair</label>
    <input name="prixunitair" type="text" class="form-control" placeholder="Enter categorie">
    
  </div>
  <div class="form-group">
    <label for="exampleInputEmail1">stock</label>
    <input name="stock" type="text" class="form-control" placeholder="Enter categorie">
    
  </div>
  <button type="submit" class="btn btn-primary">Submit</button>
</form>
      </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-warning">
          <div class="col-md-3 font-weight-bold"><i class="fas  fa fa-users"></i> Produits
      </div> 
      </div> 




            <!-- /.card-header -->
            <div class="card-body">
              <table id="example1" class="table table-bordered table-striped">
                <thead>
                <tr >
                  <th>Ref</th>
                  <th >Designation</th>
                  <th>categorie</th>
                  <th>prix unitair</th>
                  <th>stock</th>
                  <th>date</th>
                  <th>action</th>
                </tr>
                </thead>
                <tbody>
                  @foreach($produits as $produit)
                  <tr>
             <td>{{$produit->id}}22</td>
             <td><a class="text-primary font-weight-bold" href="{{asset('detaille/'.$produit->id)}}"> {{$produit->nom}}</a>  </td>
             <td>{{$produit->categorie->cat}}</td>
             
             <td class="text-success font-weight-bold">{{$produit->prixun}}</td>
             <td >{{$produit->stock}}</td>
             <td>{{$produit->datemajoration}}</td>
             <td>action</td>
              </tr>
             @endforeach
          </tbody>
        </table>



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

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

        