<?php
require_once("../../app/config.php");
$title="Withdraw methods";
require_once('../include/user_header.php');
require_once('../include/user_navbar.php');
require_once('../include/user_sidebar.php');
$data = mysqli_query($dbc, "SELECT * FROM withdrawm ORDER BY withdrawm.id DESC"); 
?>
<div class="content-wrapper">

      <!-- Page header -->
      <div class="page-header page-header-light">
        <div class="page-header-content header-elements-md-inline">
          <div class="page-title d-flex">
            <h4><i class="icon-share mr-2"></i> <span class="font-weight-semibold">Withdraw methods</span></h4>
          </div>
        </div>

        <div class="breadcrumb-line breadcrumb-line-light header-elements-md-inline">
          <div class="d-flex">
            <div class="breadcrumb">
              <a href="./dashboard" class="breadcrumb-item"><i class="icon-home2 mr-2"></i>Dashboard</a>
            </div>
          </div>

          <div class="header-elements d-none">
            <div class="breadcrumb justify-content-center">
            </div>
          </div>
        </div>
      </div>
      <!-- /page header -->
<div class="content">
  <?php
  if(mysqli_num_rows(mysqli_query($dbc, "SELECT * FROM currency WHERE d_value=1"))==0){?>
          <div class="alert bg-danger alert-styled-left alert-dismissible">
          <button type="button" class="close" data-dismiss="alert"><span>&times;</span></button>
          <h6 class="alert-heading font-weight-semibold mb-1">System error</h6>
          The system has detected no currency is set as default. 
          </div>
  <?php }?>
        <div class="card">
        <div class="card-header header-elements-inline">
          <h6 class="card-title font-weight-semibold">Create withdraw method</h6>
              <div class="header-elements">
                <div class="list-icons text-orange-600">
                <a class="list-icons-item" data-action="collapse"></a>
              </div>
            </div>
        </div>

        <div class="card-body">
          <form action="<?php admin_url('wmethods');?>" method="post">
              <div class="form-group row">
                <label class="col-form-label col-lg-2">Name</label>
                <div class="col-lg-10">
                  <input type="text" name="method" class="form-control" required>
                </div>
              </div>               
            <div class="text-right">
              <button type="submit" class="btn bg-success">Submit form <i class="icon-paperplane ml-2"></i></button>
            </div>
          </form>
        </div>
      </div>
        <div class="card">
          <div class="card-header header-elements-inline">
            <h6 class="card-title font-weight-semibold">Methods</h6>
          </div>
          <div class="table-responsive">
          <table class="table table-bordered">
            <thead>
              <tr>
              <th>S/N</th>
              <th>Method</th>
              <th>Status</th>
              <th class="text-center">Action</th>    
              </tr>
            </thead>
            <tbody>
<?php
$bf=mysqli_query($dbc, "SELECT * FROM withdrawm  ORDER BY withdrawm.id DESC");
while($df=mysqli_fetch_array($bf)){
?>
            <tr>
              <td><?php echo $index++; ?>.</td>
              <td><?php echo $df['method'];?></td>
              <td><?php if($df['status']==1){echo'<span class="badge badge-success">Published</span>';}
                  else{echo'<span class="badge badge-danger">Pending</span>';}?></td>   
              <td class="text-center">
                <div class="list-icons">
                  <div class="dropdown">
                      <a href="#" class="list-icons-item" data-toggle="dropdown">
                        <i class="icon-menu9"></i>
                      </a>
                    <div class="dropdown-menu dropdown-menu-right">
                      <?php 
                      if($df['status']=='0'){?> 
                      <a class='dropdown-item' href ='../app/admin?id=pmethod&stat=<?php echo $df['id'];?>'><i class="icon-eye mr-2"></i>Activate</a>
                      <?php }else{?>
                      <a class='dropdown-item' href ='../app/admin?id=unmethod&stat=<?php echo $df['id']; ?>'><i class="icon-eye-blocked2 mr-2"></i>Disable</a>
                      <?php }?> 
                    </div>
                  </div>
                </div>
              </td>                   
            </tr>
 <div id="<?php echo $df['id'];?>delete" class="modal fade" tabindex="-1">
          <div class="modal-dialog modal-xs">
            <div class="modal-content">
              <div class="modal-header">
               
                <button type="button" class="close" data-dismiss="modal">&times;</button>
              </div>

              <div class="modal-body">
                <h6 class="font-weight-semibold">Are you sure you want to delete this?</h6>
              </div>

              <div class="modal-footer">
                <button type="button" class="btn btn-link" data-dismiss="modal">Close</button>
                <a  href="../app/admin?id=dmethod&stat=<?php echo $df['id']; ?>" class="btn bg-danger">Proceed</a>
              </div>
            </div>
          </div>
        </div>  
<?php } ?>               
          </tbody>                    
        </table>
      </div>
      </div>