<?php include 'includes/session.php'; ?>
<?php include 'includes/sessions.php'; ?>
<?php include 'includes/header.php'; ?>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

  <?php include 'includes/navbar.php'; ?>
  <?php include 'includes/menubar.php'; ?>

            <?php 
              $isread=1;
              // $aid = (isset($_GET['aid']) ? $_GET['aid'] : '');
              // $did=intval($_GET['aid']);  
              date_default_timezone_set('Asia/Dhaka');
              $sql = "UPDATE attendance SET isread=:isread WHERE id = :aid";
              $query = $dbh -> prepare($sql);
              $query->bindParam(':isread',$isread,PDO::PARAM_STR);
              $query->bindParam(':aid',$aid,PDO::PARAM_STR);
              $query->execute();
            ?>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper"> 
    <!-- Content Header (Page header) -->
   <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        Dashboard
      </h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
        <li class="active">Dashboard</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">
      
       <!-- Small boxes (Stat box) -->
      <div class="row">
        <div class="col-lg-3 col-xs-6">
          <!-- small box -->
          <div class="small-box bg-orange"> 
            <div class="inner">
              <?php
                $sql = "SELECT * FROM users WHERE name !='admin'";
                $query = $conn->query($sql);

                echo "<h3>".$query->num_rows."</h3>";
              ?>

              <p>Total Users</p>
            </div>
            <div class="icon">
              <i class="ion ion-person-stalker"></i> 
            </div>
            <a href="users.php" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
          </div>
        </div>
        <!-- ./col -->
        
        <!-- ./col -->
        
        <!-- ./col -->
        
        <!-- ./col -->
      </div>
      <!-- /.row -->

           <!-- /.row -->
      <div class="row">
    <div class="col-xs-6">
        <div class="box">
            <h3 style="display: inline-block;">Total Users</h3>
            <h4 style="display: inline-block; margin-left: 10px;"> <?php
                $sql = "SELECT * FROM users WHERE name !='admin'";
                $query = $conn->query($sql);

                echo $query->num_rows;
              ?></h4>
        </div>
         <div class="box">
            <h3 style="display: inline-block;">Total Active Users</h3>
            <h4 style="display: inline-block; margin-left: 10px;"> <?php
                $sql = "SELECT * FROM users WHERE status='Active' and name!='admin'";
                $query = $conn->query($sql);

                echo $query->num_rows;
              ?></h4>
        </div>

        <div class="box">
            <h3 style="display: inline-block;">Total Inactive Users</h3>
            <h4 style="display: inline-block; margin-left: 10px;"> <?php
                $sql = "SELECT * FROM users WHERE status='Inactive' ";
                $query = $conn->query($sql);

                echo $query->num_rows;
              ?></h4>
        </div>

    
        <div class="box">
            <h3 style="display: inline-block;">Today Active Users</h3>
            <h4 style="display: inline-block; margin-left: 10px;"> <?php
            $currentDates = date('Y-m-d');
               $sql = "SELECT * FROM users WHERE status='Active' and created_at='$currentDates'";
               $query = $conn->query($sql);

                echo $query->num_rows;
              ?></h4>
        </div>
        
    </div>

    <div class="col-xs-6">
        <div class="box">
            <h3 style="display: inline-block;">Daily Rol</h3>
            <a href="daily_profit.php" style="display: inline-block; margin-left: 16px;"><font size="4">Run</font> </a>
        </div>

        <div class="box">
            <h3 style="display: inline-block;">Level 1</h3>
            <a href="levelonebonus.php" style="display: inline-block; margin-left: 16px;"><font size="4">Run</font> </a>
        </div>

        <div class="box">
            <h3 style="display: inline-block;">Level 2</h3>
            <a href="leveltwobonus.php" style="display: inline-block; margin-left: 16px;"><font size="4">Run</font> </a>
        </div>

        <div class="box">
            <h3 style="display: inline-block;">Level 3</h3>
            <a href="levelthreebonus.php" style="display: inline-block; margin-left: 16px;"><font size="4">Run</font> </a>
        </div>

        <div class="box">
            <h3 style="display: inline-block;">Level 4</h3>
            <a href="levelfourbonus.php" style="display: inline-block; margin-left: 16px;"><font size="4">Run</font> </a>
        </div>

        <div class="box">
            <h3 style="display: inline-block;">Level 5</h3>
            <a href="levelfivebonus.php" style="display: inline-block; margin-left: 16px;"><font size="4">Run</font> </a>
        </div>

        <div class="box">
            <h3 style="display: inline-block;">Level 6</h3>
            <a href="levelsixbonus.php" style="display: inline-block; margin-left: 16px;"><font size="4">Run</font> </a>
        </div>

        <div class="box">
            <h3 style="display: inline-block;">Level 7</h3>
            <a href="levelsevenbonus.php" style="display: inline-block; margin-left: 16px;"><font size="4">Run</font> </a>
        </div>

        <div class="box">
            <h3 style="display: inline-block;">Level 8</h3>
            <a href="leveleightbonus.php" style="display: inline-block; margin-left: 16px;"><font size="4">Run</font> </a>
        </div>

        <div class="box">
            <h3 style="display: inline-block;">Level 9</h3>
            <a href="levelninebonus.php" style="display: inline-block; margin-left: 16px;"><font size="4">Run</font> </a>
        </div>

        <div class="box">
            <h3 style="display: inline-block;">Level 10</h3>
            <a href="leveltenbonus.php" style="display: inline-block; margin-left: 16px;"><font size="4">Run</font> </a>
        </div>
        
          <div class="box">
            <h3 style="display: inline-block;">Level 11</h3>
            <a href="levelelevenbonus.php" style="display: inline-block; margin-left: 16px;"><font size="4">Run</font> </a>
        </div>
          <div class="box">
            <h3 style="display: inline-block;">Level 12</h3>
            <a href="leveltwelvebonus.php" style="display: inline-block; margin-left: 16px;"><font size="4">Run</font> </a>
        </div>
        
          <div class="box">
            <h3 style="display: inline-block;">Level 13</h3>
            <a href="levelthirteenbonus.php" style="display: inline-block; margin-left: 16px;"><font size="4">Run</font> </a>
        </div>
        
          <div class="box">
            <h3 style="display: inline-block;">Level 14</h3>
            <a href="levelfourteenbonus.php" style="display: inline-block; margin-left: 16px;"><font size="4">Run</font> </a>
        </div>
        
          <div class="box">
            <h3 style="display: inline-block;">Level 15</h3>
            <a href="levelfifteenbonus.php" style="display: inline-block; margin-left: 16px;"><font size="4">Run</font> </a>
        </div>
        
       

    </div>
</div>
    </section>   
  </div>
    
  <?php include 'includes/footer.php'; ?>
  <?php include 'includes/users_modal.php'; ?>
</div>
<?php include 'includes/scripts.php'; ?>
<script>
$(function(){
  $('.edit').click(function(e){
    e.preventDefault();
    $('#edit').modal('show');
    var id = $(this).data('id');
    getRow(id);
  });

  $('.delete').click(function(e){
    e.preventDefault();
    $('#delete').modal('show');
    var id = $(this).data('id');
    getRow(id);
  });
});

function getRow(id){
  $.ajax({
    type: 'POST',
    url: 'users_row.php',
    data: {id:id},
    dataType: 'json',
    success: function(response){

      $('#del_user_id').val(response.id);
    }
  });
}
</script>
</body>
</html>
