 <?php
include 'header.php';
 ?>
  <!-- Content Wrapper. Contains page content -->

    <!-- /.content-header -->

    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <!-- Small boxes (Stat box) -->
    <div class="row">
          <div class="col-lg-3 col-6">
            <!-- small box -->
<?php
$query ="SELECT sum(price) as pending_amount from order_link where status = 'Pending'";
$result = mysqli_query($con,$query);
$row = mysqli_fetch_assoc($result);
?>
            <div class="small-box bg-info">
              <div class="inner">
                <h3>$<?php echo $row['pending_amount']?></h3>

                <p>Total Pending Amount</p>
              </div>
              <div class="icon">
                <i class="ion ion-bag"></i>
              </div>
              
            </div>
          </div>
          <!-- ./col -->
          <div class="col-lg-3 col-6">
            <!-- small box --><?php
$query ="SELECT count(*) as pending_leads from order_link where status = 'Pending'";
$result = mysqli_query($con,$query);
$row = mysqli_fetch_assoc($result);
?>
            <div class="small-box bg-success">
              <div class="inner">
                <h3><?php echo $row['pending_leads']?></h3>

                <p>Total Pending Leads</p>
              </div>
              <div class="icon">
                <i class="ion ion-stats-bars"></i>
              </div>
              
            </div>
          </div>
          <!-- ./col -->
          <div class="col-lg-3 col-6">
            <!-- small box --><?php
$query ="SELECT sum(price) as paid_amount from order_link where status = 'Paid'";
$result = mysqli_query($con,$query);
$row = mysqli_fetch_assoc($result);
?>
            <div class="small-box bg-warning">
              <div class="inner">
                <h3>$<?php echo $row['paid_amount']?></h3>

                <p>Total Paid Amount</p>
              </div>
              <div class="icon">
                <i class="ion ion-person-add"></i>
              </div>
             
            </div>
          </div>
          <!-- ./col -->
          <div class="col-lg-3 col-6">
                <!-- small box --><?php
$query ="SELECT count(*) as paid_leads from order_link where status = 'Paid'";
$result = mysqli_query($con,$query);
$row = mysqli_fetch_assoc($result);
?>
            <div class="small-box bg-danger">
              <div class="inner">
                <h3><?php echo $row['paid_leads']?></h3>

                <p>Total Paid Leads</p>
              </div>
              <div class="icon">
                <i class="ion ion-pie-graph"></i>
              </div>
              
            </div>
          </div>
          <!-- ./col -->
        </div>
        <!-- /.row -->
        <!-- Main row -->
        <div class="row">
          
         <div class="col-md-12">
            <!-- general form elements -->
            <div class="card card-primary">
              <div class="card-header">
                <h3 class="card-title">Users Property <a href="javascript:void(0)" class="btn btn-info pull-right" id="addUser" data-toggle="modal" data-target="#modal-sm"> Add User</a></h3>

              </div>
           
              <!-- form start -->
                <div class="card-body">
                  <?php
                    $query = "SELECT * FROM adminuser order by id desc ";
                    $result = mysqli_query($con,$query);
                ?>
                <div class="table-responsive">
              <table id="example2" class="table table-bordered table-striped">
                <thead>
                <tr>
                  <th>Email</th>
                  <th>Password</th>
                  <th>Status</th>
                  <th>Created At</th>
                  <th>Action</th>
                </tr>
                </thead>
                <tbody>
                  <?php
                      while($row = mysqli_fetch_assoc($result)){
              
                  ?>              
                <tr role="row" class="odd">
                 
                  <td><?php echo $row['email']?></td>
                  <td><?php echo $row['password']?></td>
               
                  <td>
                    <?php echo $row['status'];?>
                  
                  </td>
                  <td><?php echo $row['created_at'];?></td>
                  
                  <td>
                       <a class="btn btn-warning btn-sm userMenu" data-value="<?php echo $row['id']?>" >Domains Asign</a>
                      <a class="btn btn-danger btn-sm" id="userId" href="response.php?order_leadDl=<?php echo $row['id'];?>">Delete</a>
                  </td>
                </tr>
                <?php } ?>
                 </tbody>              
              </table>
              </div>
                </div>
                <!-- /.card-body -->

            </div>
            <!-- /.card -->
</div>
          </div>
        </div>
      
        <!-- /.row (main row) -->
      </div><!-- /.container-fluid -->
    </section>
    <!-- /.content -->

  </div>





 <?php
include 'footer.php';
 ?>



<script type="text/javascript">

  $(document).ready(function(){
   
     $(".status").change(function(){
      var status = $(this).val();
      var id = $(this).data("value");
      $.get("response.php",{order_linkStatus:status,linkorder_id:id},function(data){

              alert("status Upated..");
      });
     })

       $(".userMenu").click(function(){
            id = $(this).data("value");

            $.get("response.php",{userMenu:id},function(data){
                $("#MenuShow").html(data);
                $(".bs-example-modal-lg").modal('show');
            })
        })
  });
</script>
 <div class="modal fade" id="modal-sm"  role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-md" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Insert User</h5>
        <a class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </a>
      </div>
      <div class="modal-body">
        <form action="response.php" id="veneuForm" method="POST" enctype="multipart/form-data">
          <div class="form-group">
            <label for="inputAddress">User Email</label>
            <input type="email" class="form-control" name="email" placeholder="Enter Email" required="required">
          </div>
        
          <div class="form-group">
            <label for="inputAddress">Password</label>
            <input type="text" class="form-control" name="password" placeholder="Enter Password" required="required">
          </div>
          <div class="form-group">
            <label for="inputAddress">Select Status</label>
            <select class="form-control" name="status" id="location" required>
              <option value=" " >Select Status</option>
              <option value="sub-admin" >Sub Admin</option>
              <option value="admin" >Admin</option>
            </select>
          </div>
          <button type="submit" name="Addadminuser" class="btn btn-primary pull">Add</button>
        </form>
      </div>
      <div class="modal-footer">
        <a class="btn btn-secondary" data-dismiss="modal">Close</a>
      </div>
    </div>
  </div>
</div>



<div class="modal fade  bs-example-modal-lg" id="exampleModal3dd" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" style="margin-left:20%">
  <div class="modal-dialog modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Insert Menus</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        
             <form action="response.php" method="POST">
        <div class="form-row" id="MenuShow">
       
        </div>
           <input type="submit" name="menusAdd">
         </form>  
      </div>
      <div class="modal-footer">
        <button type="button"  class="btn btn-secondary" data-dismiss="modal">Close</button>
      
      </div>
    </div>
  </div>
</div>