
<?php ob_start(); ?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Admin| Users</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <!-- Font Awesome -->
  <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
  <!-- DataTables -->
  <link rel="stylesheet" href="../plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
  <link rel="stylesheet" href="../plugins/datatables-responsive/css/responsive.bootstrap4.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="../dist/css/adminlte.min.css">
  <!-- Google Font: Source Sans Pro -->
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
</head>
<body class="hold-transition sidebar-mini">
<div class="wrapper">
  <!-- Navbar -->
  <nav class="main-header navbar navbar-expand navbar-white navbar-light">
    <!-- Left navbar links -->
    <ul class="navbar-nav">
      <li class="nav-item">
        <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
      </li>
      <li class="nav-item d-none d-sm-inline-block">
       
      </li>
      <li class="nav-item d-none d-sm-inline-block">
   
      </li>
    </ul>

    <!-- SEARCH FORM -->
    
    <!-- Right navbar links -->
    <ul class="navbar-nav ml-auto">
      <!-- Messages Dropdown Menu -->
      
      <!-- Notifications Dropdown Menu -->
      
      <li class="nav-item">
        <a class="nav-link" data-widget="control-sidebar" data-slide="true" href="#" role="button">
          <i class="fas fa-th-large"></i>
        </a>
      </li>
    </ul>
  </nav>
  <!-- /.navbar -->

  <!-- Main Sidebar Container -->


  <aside class="main-sidebar sidebar-dark-primary elevation-4">
    <!-- Brand Logo -->
    <a href="../../index3.html" class="brand-link">
      <img src="../dist/img/AdminLTELogo.png"
           alt="AdminLTE Logo"
           class="brand-image img-circle elevation-3"
           style="opacity: .8">
      <span class="brand-text font-weight-light">Admin</span>
    </a>

    <!-- Sidebar -->

    <?php include"includes/sidebar.php" ?>        
 
    <!-- /.sidebar -->
  </aside>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1>  Funds</h1>
          </div>
          <div class="col-sm-6">
            
          </div>
        </div>
      </div><!-- /.container-fluid -->
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-12">
           
            <!-- /.card -->

            <div class="card">
              <div class="card-header">
                <h3 class="card-title">Funds</h3>
              </div>
              <!-- /.card-header -->
              <div class="card-body">
                <table id="example1" class="table table-bordered table-striped ">
                  <thead>
                  <tr>
                                                        <th scope="col">#</th>
                                                        <th scope="col">User</th>
                                                        <th scope="col">Amount</th>
                                                        <th scope="col">Date</th>
                                                        <th scope="col">Proof</th>
                                                        <th scope="col">Status</th>
                                                        <th scope="col">Edit</th>      
                                                        <th scope="col">Delete</th>                                                    
                                                    </tr>
                  </thead>
                  <tbody> 
                  <?php
                  include"../connect/db.php";
                                                        $tosin = mysqli_query($con,"SELECT * FROM funds");
                                                        $transactions = mysqli_num_rows($tosin);
                                                        if( $transactions == 0 ){
                                                            echo'
                                                                <tr>
                                                                    <td colspan="8">Oops! No Funds Request have been made</td>
                                                                </tr>
                                                            '
                                                            ;
                                                        }
                                                        else{
                                                            $i = 1;
                                                            while( $tosin_req = mysqli_fetch_assoc($tosin) ){
                                                                if( $tosin_req['img'] == "nothing" ){
                                                                    $proof =
                                                                    '
                                                                        <span  class="btn btn-secondary" >Nothing Yet...</span>
                                                                        
                                                                    ';
                                                                }
                                                                else{
                                                                    $proof =
                                                                    '
                                                                        <span onclick={viewimg("'.$tosin_req['id'].'","'.$tosin_req['user'].'")} class="btn btn-success" >View</span>
                                                                    ';
                                                                }
                                                                echo'
                                                                    <tr>
                                                                        <td>'.$i.'</td>
                                                                        <td>'.$tosin_req['user'].'</td>
                                                                        <td>$'.$tosin_req['amount'].'</td>
                                                                        <td>'.$tosin_req['date_trans'].'</td>
                                                                        <td>'.$proof.'</td>
                                                                        <td>'.$tosin_req['status'].'</td>
                                                                        <td><a href="editfunds.php?id='.$tosin_req['id'].'" ><span class="btn btn-dark" ><i class="fa fa-edit" ></i></span></a></td>
                                                                        <td>
                                                                        <div class="btn-group-prepend show">
                                        
                                                                                 <button type="button" class="btn btn-danger" data-toggle="dropdown" aria-expanded="false">Delete</button>
                                                                              <span class="sr-only">Toggle Dropdown</span>
                                                                              <div class="dropdown-menu" role="menu" style="
                                                                          min-width: 13rem;transform: translate3d(56px, 233px, 0px);     text-align: center;left: 19px!important">
                                                                      <p  style="font-size:15px"class="dropdown-item" href="#">Are you sure you want to delete?</p>
                                                                                             <p class="dropdown-item" href="#"><span onclick=deletefunds("'.$tosin_req['id'].'") class="btn btn-md btn-danger">Yes</span> <span class="btn btn-md btn-dark">No</span></p>
                                        
                                                                                     <div class="dropdown-divider"></div>
                                        
                                                                              </div>
                                                                                                 </button>
                                                                                         </div>
                                                                  
                                                                        
                                                                     </td>       
                                                                    </tr>
                                                                '
                                                                ;
                                                                $i++ ;
                                                            }                                                    
                                                        }
                                                    ?>                                    
                </tbody>
                  <tfoot>
                  <tr>
                                                        <th scope="col">#</th>
                                                        <th scope="col">User</th>
                                                        <th scope="col">Amount</th>
                                                        <th scope="col">Date</th>
                                                        <th scope="col">Proof</th>
                                                        <th scope="col">Status</th>
                                                        <th scope="col">Edit</th>      
                                                        <th scope="col">Delete</th>                                                    
                                                    </tr>
                  </tfoot>
                </table>
              </div>
              <!-- /.card-body -->
            </div>
            <!-- /.card -->
          </div>
          <!-- /.col -->
        </div>
        <!-- /.row -->
      </div>
      <!-- /.container-fluid -->
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
  </div>
  <span id="scambtn"  data-toggle="modal" data-target="#exampleModal"></span>


  <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">Proof Payment</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
              </div>
              <div class="modal-body viewimg">
                
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
              </div>
            </div>
          </div>
        </div>
  <footer class="main-footer">
    <div class="float-right d-none d-sm-block">
      <b>Version</b> 1.0.0
    </div>
    <strong>Copyright &copy; 2021 <a href="#">Swagalomo's Admin</a>.</strong> All rights
    reserved.
  </footer>

  <!-- Control Sidebar -->
  <aside class="control-sidebar control-sidebar-dark">
    <!-- Control sidebar content goes here -->
  </aside>
  <!-- /.control-sidebar -->
</div>
<!-- ./wrapper -->

<!-- jQuery -->
<script src="../plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="../plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- DataTables -->
<script src="../plugins/datatables/jquery.dataTables.min.js"></script>
<script src="../plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="../plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="../plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
<!-- AdminLTE App -->
<script src="../dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../dist/js/demo.js"></script>
<!-- page script -->
<script>
  $(function () {
    $("#example1").DataTable({
      "responsive": true,
      "autoWidth": false,
    });
    $('#example2').DataTable({
      "paging": true,
      "lengthChange": false,
      "searching": false,
      "ordering": true,
      "info": true,
      "autoWidth": false,
      "responsive": true,
    });
  });
</script>

<script src="js/sweetalert2.all.min.js"></script>
    <!-- Main JS-->
    <script src="js/main.js"></script>
    <script src="js/custom.js"></script>
</body>
</html>
