@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;">depenses2
              
            <span class="badge badge-pill badge-success" style="font-size:20px;"></span>          
            
            
            </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">
 + depense
</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('adddeense')}}" enctype="multipart/form-data">      
   @csrf  
   <label for="exampleInputEmail1">Ajouter nouveau depense</label>
   <input name="depense"   type="text" class="form-control" placeholder="Enter depense">
   <br>
  
   <input name="montant"  type="text" class="form-control" placeholder="Enter montant">
 <br>
  
       <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>  depenses 
          <span class="badge badge-pill badge-warning" style="font-size:20px;">  {{$depenses->count() }}</span>
         
         
          </div> 
            </div>  


 




<form method="GET" action="{{ route('recherche.depense') }}" class="form-inline mb-3">
    <label class="mr-2">Du :</label>
    <input type="date" name="date_debut" class="form-control mr-2" value="{{ request('date_debut') }}">

    <label class="mr-2">Au :</label>
    <input type="date" name="date_fin" class="form-control mr-2" value="{{ request('date_fin') }}">

    <button type="submit" class="btn btn-primary">Rechercher</button>
</form>

            <!-- /.card-header -->
            <div class="card-body">
            <div class="table-responsive">
            <table id="" 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;">montant</th>
                  <th style="width:180px;">action</th>
       
             
                </tr>
                </thead>
                <tbody>
                  @foreach($depenses as $dep)
                <tr>   <td>  {{$dep->id}}</td>
                <td>
              
             {{$dep->depense}}
             </td>
             <td>
              
              {{$dep->montant}}
             </td>
            <td>
 
                          <a type="button" class="btn btn-info btn-sm" data-toggle="modal" data-target="#exampleModal{{$dep->id}}">
  
                          <i class="fas fa-folder">
                              </i>
                          modifier
</a>

<!-- Modal -->
<div class="modal fade" id="exampleModal{{$dep->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('modifdepense/'.$dep->id)}}" enctype="multipart/form-data">      
   @csrf  

  <div class="form-group">
    <label for="exampleInputEmail1">modifier depense</label>
    <input name="depense" value=" {{$dep->depense}}"  type="text" class="form-control" placeholder="Enter depense">
  <br>
    <input name="montant" value=" {{$dep->montant}}"  type="text" class="form-control" placeholder="Enter montant">
  </div>
  <br>
  
       <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('supdepense/'.$dep->id)}}">
                              <i class="fas fa-trash">
                              </i>
                             supprimer
                          </a>

                          
            </td>
            
            
            </tr> 
             @endforeach
          </tbody>
        </table>
        <div class="d-flex justify-content-center mt-4">
          {{ $depenses->links('pagination::bootstrap-4') }}
      </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>