@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 class="font-weight-bold">caegorie de depense</h1>
          </div><!-- /.col -->
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
<!-- Button trigger modal -->
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#exampleModal">
 + categorie
</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 bg-info text-white">

      <div class="modal-body">
      <form method="POST" action="{{asset('addcatdepense')}}" enctype="multipart/form-data">      
   @csrf  
  <div class="form-group">
    <label for="exampleInputEmail1">Ajouter une categoriie</label>
    <input name="cat" type="text" class="form-control" placeholder="Enter Lieu">
    
  </div>
  <div class="form-group">
    <label for="exampleInputEmail1">Prix</label>
    <input name="prix" type="text" class="form-control" placeholder="Enter Lieu">
    
  </div>
       <button type="button" class="btn btn-secondary" data-dismiss="modal">quitter</button>
        <button type="submit" class="btn btn-warning float-right">enregistrer</button>
</form>
      </div>
 
    </div>
  </div>
</div>
            </ol>
          </div><!-- /.col -->
        </div><!-- /.row -->
      </div><!-- /.container-fluid -->
    </div>
    <!-- /.content-header -->


         <!-- 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>  Lieu de stock  
          <span class="badge badge-pill badge-warning" style="font-size:20px;">  {{$catdepense->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;">categorie</th>
                  <th style="color: blue;font-weight: bold;">prix</th>
                  <th style="width:180px;">action</th>
       
             
                </tr>
                </thead>
                <tbody>
                  @foreach($catdepense as $cat)
                <tr>   <td>  {{$cat->id}}</td>
             <td>
              {{$cat->cat}}
             
             </td>
             <td>
              {{$cat->prix}}
             
             </td>
            <td>
 
                          <a type="button" class="btn btn-info btn-sm" data-toggle="modal" data-target="#exampleModal{{$cat->id}}">
  
                          <i class="fas fa-folder">
                              </i>
                          modifier
</a>

<!-- Modal -->
<div class="modal fade" id="exampleModal{{$cat->id}}" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      
      <div class="modal-body bg-info text-white">
      <form method="POST" action="{{asset('modifcatdepense/'.$cat->id)}}" enctype="multipart/form-data">      
   @csrf  
  <div class="form-group">
    <label for="exampleInputEmail1">modifier categorie</label>
    <input name="cat" value=" {{$cat->cat}}"  type="text" class="form-control" placeholder="Enter Lieu">
    
  </div>
  <div class="form-group">
    <label for="exampleInputEmail1">modifier prix</label>
    <input name="prix" value=" {{$cat->prix}}"  type="text" class="form-control" placeholder="Enter Lieu">
    
  </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('supcatdepense/'.$cat->id)}}">
                              <i class="fas fa-trash">
                              </i>
                             supprimer
                          </a>

                          
            </td>
            
            
            </tr> 
             @endforeach
          </tbody>
        </table>




    </div>
  
  </div>

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







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