@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">
           
              
          
           @if($produit->stock > 0) 
 <h1 > {{$produit->nom}} <span  class="text-success font-weight-bold">(disponible)</span> </h1>
           @elseif($produit->stock == 0) 
 <h1 class="text-danger font-weight-bold">  {{$produit->nom}} (non disponible)</h1>       
           @endif
            
            
            
          </div><!-- /.col -->
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="#">Home</a></li>
              <li class="breadcrumb-item active">Starter Page</li>
            </ol>
          </div><!-- /.col -->
        </div><!-- /.row -->
      </div><!-- /.container-fluid -->
    </div>
    <!-- /.content-header -->

    <!-- Main content -->
    <div class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-lg-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>  Detaille
      </div> 
      <div class="col-md-3 font-weight-bold"><i class="fas  fa fa-users"></i>  Detaille

              <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>
          
                  <tr>
             <td>{{$produit->id}}</td>
             <td> {{$produit->nom}}</a>  </td>
             <td>{{$produit->categorie_id}}</td>
             <td>{{$produit->prixun}}</td>
             <td>{{$produit->stock}}</td>
             <td>{{$produit->datemajoration}}</td>
             <td>action</td>
              </tr>
         
          </tbody>
        </table>



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

                </section>
                <section>
          
      <div class="container-fluid">
        <div class="row">
          <div class="col-4">
          <h3 class="m-0 text-dark">dernier mouvement</h3>
          <table id="example1" class="table table-bordered table-striped">
                <thead>
                <tr>
                  <th>Ref</th>
                  <th>designation</th>
                  <th>quantité</th>
                  <th>mouvement</th>
                  <th>date</th>
             
                </tr>
                </thead>
                <tbody>
                    @foreach($stocks as $stock)
                    <tr>
             <td> {{$stock->id}} </td> 
             <td><a class="text-primary font-weight-bold" href="{{asset('detaille/'.$produit->id)}}"> {{$produit->nom}}</a>  </td>
             @if($stock->mouvement_id==1)
             <td class="text-success font-weight-bold">+ {{$stock->qty}} </td> 
             <td class="text-success font-weight-bold"> {{$stock->mouvement->mouvement}} </td> 
@elseif($stock->mouvement_id==2)
<td class="text-danger font-weight-bold">- {{$stock->qty}} </td> 
             <td class="text-danger font-weight-bold"> {{$stock->mouvement->mouvement}} </td> 
@endif
             <td> {{$stock->created_at}} </td> 
            </tr>
             @endforeach
          </tbody>
        </table>
             </div>
          <div class="col-4">
          <h3 class="m-0 text-dark">tarif</h3>
          </div> 
          <div class="col-4">3</div> 





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