<?php include 'header.php'; ?>
<?php include 'navbar.php'; ?>
<?php include '../../conn.php'; ?>

<?php 
if($_SESSION["name"]){
    header("location:../pages/login.php");
    $name=$_SESSION["name"];
}

?>
<!--//////////////////////////////admin fetch array///////////////-->
 <?php
           
    $adminsql="select * from admin order by id desc";
    $adminresult = mysqli_query($con,$adminsql);
  
    while($adminrow = mysqli_fetch_array($adminresult)){
        $email=$adminrow['email'];
        $password=$adminrow['password'];
        $name=$adminrow['name'];
        $image=$adminrow['image'];
    }
             
 ?>
<!--//////////////////////////////admin fetch array///////////////-->
<!--//////////////////////////////users fetch array///////////////-->
 <?php
       $noofusers=0;    
    $usersql="select * from users  ";
    $userresult = mysqli_query($con,$usersql);
  
    while($userrow = mysqli_fetch_array($userresult)){
        $noofusers=$noofusers+1;
    }
             
 ?>
<!--//////////////////////////////users fetch array///////////////-->
<!--//////////////////////////////doctors fetch array///////////////-->
 <?php
       $noofdoctors=0;    
    $doctorssql="select * from doctors  ";
    $doctorsresult = mysqli_query($con,$doctorssql);
  
    while($doctorsrow = mysqli_fetch_array($doctorsresult)){
        $noofdoctors=$noofdoctors+1;
    }
             
 ?>
<!--//////////////////////////////doctors fetch array///////////////-->
<!-- ///////////////////edit profile sadmin up funcation////////////////// -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function (e) {
 $("#form").on('submit',(function(e) {
  e.preventDefault();
  $.ajax({
   url: "api/adminedit.php",
   type: "POST",
   data:  new FormData(this),
   contentType: false,
         cache: false,
   processData:false,
   beforeSend : function()
   {
    //$("#preview").fadeOut();
    $("#err").fadeOut();
   },
   success: function(data)
      {
      //  alert(data)
    if(data == 101)
    {
    
     
  window.location.href = "index.php";
    }
    
    else{
     $("#successmessage").html("! User not authorization ").fadeIn().style.color.red;
    }
      },
     error: function(e) 
      {
   $("#successmessage").html("Some thing went  worng").fadeIn().style.color.red;
      }          
    });
 }));
});
</script>
<!-- //////////////////edit profile sadmin//////////////////////////// -->
<div class="content-wrapper">


<div class="container-fluid">
<div class="row">
<div class="main-header">
<h4>Dashboard</h4>
</div>
</div>

<div class="row dashboard-header">
<div class="col-lg-3 col-md-4">
<div class="card dashboard-product">
<span>Users</span>
<h2 class="dashboard-total-products"><?php echo $noofusers?></h2>
<span class="label label-warning">View</span>Total
<div class="side-box">
<i class="fa fa-users" style="color:#19F9DC"></i>
</div>
</div>
</div>
<div class="col-lg-3 col-md-4">
<div class="card dashboard-product">
<span>Doctor</span>
<h2 class="dashboard-total-products"><?php echo $noofdoctors?></h2>
<span class="label label-primary">Views</span>Total
<div class="side-box ">
<i class="fa fa-user-md" style="color:#05D85C"></i>
</div>
</div>
</div>
<!--<div class="col-lg-3 col-md-4">-->
<!--<div class="card dashboard-product">-->
<!--<span>Products</span>-->
<!--<h2 class="dashboard-total-products">$<span>30,780</span></h2>-->
<!--<span class="label label-success">Sales</span>Reviews-->
<!--<div class="side-box">-->
<!--<i class="ti-direction-alt text-success-color"></i>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--<div class="col-lg-3 col-md-4">-->
<!--<div class="card dashboard-product">-->
<!--<span>Products</span>-->
<!--<h2 class="dashboard-total-products">$<span>30,780</span></h2>-->
<!--<span class="label label-danger">Sales</span>Reviews-->
<!--<div class="side-box">-->
<!--<i class="ti-rocket text-danger-color"></i>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
</div>


<div class="row">
<div class="col-lg-4">
<div class="card">
<div class="user-block-2">
<img class="img-fluid" src="<?php echo $image; ?>" alt="user-header">
<h5><?php echo $name; ?></h5>
<h6>Admin</h6>
</div>
<div class="card-block">
<div class="user-block-2-activities">
<form method="post" id="form"  enctype="multipart/form-data" novalidate>
<i class="icofont icofont-email"></i> 
<input class="user-block-2-active" type="text" id="email" name="email" value="<?php echo $email; ?>">
</div>
<div class="user-block-2-activities">

<i class="icofont icofont-ui-password"></i> 
<input class="user-block-2-active" type="password" id="password" name="password" value="<?php echo $password; ?>">


</div>

<div class="text-center">
<!--<button type="button" class="btn btn-warning waves-effect waves-light text-uppercase m-r-30">-->
<!--Follows-->
<!--</button>-->
<button type="submit" class="btn btn-primary waves-effect waves-light text-uppercase">
Update 
</button>
</form>
</div>
</div>
</div>
</div>
<div class="col-lg-8">
<div class="card">
<div class="card-header">
<h5 class="card-header-text">Doctors</h5>
</div>
<div class="card-block">
<div class="data_table_main">

<div class="card-block">

<table id="demo-foo-filtering" class="table table-striped">
<thead>
<tr>
<th>First Name</th>
<th data-breakpoints="xs">Email</th>
<th data-breakpoints="xs">Phone</th>
<th data-breakpoints="xs">Review</th>
<!--<th>Status</th>-->
</tr>
</thead>
<tbody>
<?php
        
    
    $doctorsql="select * from doctors  order by rating desc limit 8";
    $doctorresult = mysqli_query($con,$doctorsql);
  
    while($doctorrow = mysqli_fetch_array($doctorresult)){?>
<tr>
<td><?php echo $doctorrow['name']?></td>
<td><?php echo $doctorrow['email']?></td>
<td><?php echo $doctorrow['phone']?></td>
<td>
    <?php $totalstar= $doctorrow['rating']?>
                            <style>
                              .fa.checked{
                                  color:#ff9800;
                              }
                          </style>
                          <?php  if($totalstar > 0 && $totalstar < 1){ ?>
                                    
                                    <?php  if($totalstar >= 0.5 ){ ?>
                                  
                                    <span class="fa fa-star checked" style="color:#ff9800;"></span>
                                    <span class="fa fa-star-half-o " style="color:#ff9800;"></span>
                                    <span class="fa fa-star-o " style="color:#ff9800;"></span>
                                    <span class="fa fa-star-o" style="color:#ff9800;"></span>
                                    <span class="fa fa-star-o" style="color:#ff9800;"></span>
                                  <?php }else { ?>
                                  <span class="fa fa-star checked" style="color:#ff9800;"></span>
                                    <span class="fa fa-star-o " style="color:#ff9800;"></span>
                                    <span class="fa fa-star-o " style="color:#ff9800;"></span>
                                    <span class="fa fa-star-o" style="color:#ff9800;"></span>
                                    <span class="fa fa-star-o" style="color:#ff9800;"></span>
                                  <?php }?>
                          <?php } else if($totalstar >= 1 && $totalstar < 2){ ?>
                          
                                    <?php if($totalstar >= 1.5 ){ ?>
                                  
                                    <span class="fa fa-star checked" style="color:#ff9800;"></span>
                                    <span class="fa fa-star-half-o " style="color:#ff9800;"></span>
                                    <span class="fa fa-star-o " style="color:#ff9800;"></span>
                                    <span class="fa fa-star-o" style="color:#ff9800;"></span>
                                    <span class="fa fa-star-o" style="color:#ff9800;"></span>
                                  <?php }else { ?>
                                  <span class="fa fa-star checked" style="color:#ff9800;"></span>
                                    <span class="fa fa-star-o " style="color:#ff9800;"></span>
                                    <span class="fa fa-star-o " style="color:#ff9800;"></span>
                                    <span class="fa fa-star-o" style="color:#ff9800;"></span>
                                    <span class="fa fa-star-o" style="color:#ff9800;"></span>
                                  <?php }?>
                          <?php }else if($totalstar >= 2 && $totalstar < 3){ ?>
                              <?php if($totalstar >= 2.5 ){ ?>
                                      
                                    <span class="fa fa-star checked" style="color:#ff9800;"></span>
                                    <span class="fa fa-star checked " style="color:#ff9800;"></span>
                                    <span class="fa fa-star-half-o " style="color:#ff9800;"></span>
                                    <span class="fa fa-star-o" style="color:#ff9800;"></span>
                                    <span class="fa fa-star-o" style="color:#ff9800;"></span>
                                  <?php }else { ?>
                                  <span class="fa fa-star checked" style="color:#ff9800;" ></span>
                                    <span class="fa fa-star checked " style="color:#ff9800;"></span>
                                    <span class="fa fa-star-o " style="color:#ff9800;"></span>
                                    <span class="fa fa-star-o" style="color:#ff9800;"></span>
                                    <span class="fa fa-star-o" style="color:#ff9800;"></span>
                                  <?php }?>
                          <?php }else if($totalstar >= 3 && $totalstar < 4){ ?>
                                   <?php if($totalstar >= 3.5 ){ ?>
                                      
                                    <span class="fa fa-star checked" style="color:#ff9800;"></span>
                                    <span class="fa fa-star checked "style="color:#ff9800;"></span>
                                    <span class="fa fa-star checked " style="color:#ff9800;"></span>
                                    <span class="fa fa-star-half-o" style="color:#ff9800;"></span>
                                    <span class="fa fa-star-o" style="color:#ff9800;"></span>
                                  <?php }else { ?>
                                  <span class="fa fa-star checked" style="color:#ff9800;"></span>
                                    <span class="fa fa-star checked " style="color:#ff9800;"></span>
                                    <span class="fa fa-star checked" style="color:#ff9800;"></span>
                                    <span class="fa fa-star-o" style="color:#ff9800;"></span>
                                    <span class="fa fa-star-o" style="color:#ff9800;"></span>
                                  <?php }?>
                          <?php }else if($totalstar >= 4 && $totalstar < 5){ ?>
                                   <?php if($totalstar >= 4.5 ){ ?>
                                      
                                    <span class="fa fa-star checked" style="color:#ff9800;"></span>
                                    <span class="fa fa-star checked " style="color:#ff9800;"></span>
                                    <span class="fa fa-star checked " style="color:#ff9800;"></span>
                                    <span class="fa fa-star checked" style="color:#ff9800;"></span>
                                    <span class="fa fa-star-half-o" style="color:#ff9800;"></span>
                                  <?php }else { ?>
                                  <span class="fa fa-star checked" style="color:#ff9800;"></span>
                                    <span class="fa fa-star checked " style="color:#ff9800;"></span>
                                    <span class="fa fa-star checked " style="color:#ff9800;"></span>
                                    <span class="fa fa-star checked" style="color:#ff9800;"></span>
                                    <span class="fa fa-star-o" style="color:#ff9800;"></span>
                                  <?php }?>
                          <?php }else if($totalstar >= 5 ){ ?>
                                   
                                  <span class="fa fa-star checked" style="color:#ff9800;"></span>
                                    <span class="fa fa-star checked " style="color:#ff9800;"></span>
                                    <span class="fa fa-star checked " style="color:#ff9800;"></span>
                                    <span class="fa fa-star checked" style="color:#ff9800;"></span>
                                    <span class="fa fa-star checked" style="color:#ff9800;"></span>
                                  
                          <?php }else{?>
                          <span class="fa fa-star-o" style="color:#ff9800;"></span>
                            <span class="fa fa-star-o " style="color:#ff9800;"></span>
                            <span class="fa fa-star-o " style="color:#ff9800;"></span>
                            <span class="fa fa-star-o" style="color:#ff9800;"></span>
                            <span class="fa fa-star-o" style="color:#ff9800;"></span>
                          <?php }?>
                          <?php echo $totalstar ; ?>

</td>
<!--<td><span class="tag tag-danger"> Suspended</span>-->
<!--</td>-->
</tr>
<?php }?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>




<!--<div class="row">-->
<!--<div class="col-xl-8 col-lg-12">-->
<!--<div class="card">-->
<!--<div class="card-block">-->
<!--<div class="table-responsive">-->
<!--<table class="table m-b-0 photo-table">-->
<!--<thead>-->
<!--<tr class="text-uppercase">-->
<!--<th>Photo</th>-->
<!--<th>Project</th>-->
<!--<th>Completed</th>-->
<!--<th>Status</th>-->
<!--<th>Date</th>-->
<!--</tr>-->
<!--</thead>-->
<!--<tbody>-->
<!--<tr>-->
<!--<th>-->
<!--<img class="img-fluid img-circle" src="../assets/images/avatar-2.png" alt="User">-->
<!--</th>-->
<!--<td>Appestia Project-->
<!--<p><i class="icofont icofont-clock-time"></i>Created 14.9.2016</p>-->
<!--</td>-->
<!--<td>-->
<!--<span class="pie" style="display: none;">226,134</span><svg class="peity" height="30" width="30"><path d="M 15.000000000000002 0 A 15 15 0 1 1 4.209902994920235 25.41987555688496 L 15 15" fill="#2196F3"></path><path d="M 4.209902994920235 25.41987555688496 A 15 15 0 0 1 14.999999999999996 0 L 15 15" fill="#ccc"></path></svg>-->
<!--</td>-->
<!--<td>50%</td>-->
<!--<td>October 21, 2015</td>-->
<!--</tr>-->
<!--<tr>-->
<!--<th>-->
<!--<img class="img-fluid img-circle" src="../assets/images/avatar-4.png" alt="User">-->
<!--</th>-->
<!--<td>Contract with belife Company-->
<!--<p><i class="icofont icofont-clock-time"></i>Created 20.10.2016</p>-->
<!--</td>-->
<!--<td>-->
<!--<span class="pie" style="display: none;">0.52/1.561</span><svg class="peity" height="30" width="30"><path d="M 15.000000000000002 0 A 15 15 0 0 1 28.00043211809656 22.482564048691025 L 15 15" fill="#2196F3"></path><path d="M 28.00043211809656 22.482564048691025 A 15 15 0 1 1 14.999999999999996 0 L 15 15" fill="#ccc"></path></svg>-->
<!--</td>-->
<!--<td>70%</td>-->
<!--<td>November 21, 2015</td>-->
<!--</tr>-->
<!--<tr>-->
<!--<th>-->
<!--<img class="img-fluid img-circle" src="../assets/images/avatar-1.png" alt="User">-->
<!--</th>-->
<!--<td>Web Consultancy project-->
<!--<p><i class="icofont icofont-clock-time"></i>Created 20.10.2016</p>-->
<!--</td>-->
<!--<td>-->
<!--<span class="pie" style="display: none;">1,4</span><svg class="peity" height="30" width="30"><path d="M 15.000000000000002 0 A 15 15 0 0 1 29.265847744427305 10.36474508437579 L 15 15" fill="#2196F3"></path><path d="M 29.265847744427305 10.36474508437579 A 15 15 0 1 1 14.999999999999996 0 L 15 15" fill="#ccc"></path></svg>-->
<!--</td>-->
<!--<td>40%</td>-->
<!--<td>September 21, 2015</td>-->
<!--</tr>-->
<!--<tr>-->
<!--<th>-->
<!--<img class="img-fluid img-circle" src="../assets/images/avatar-3.png" alt="User">-->
<!--</th>-->
<!--<td>Contract with belife Company-->
<!--<p><i class="icofont icofont-clock-time"></i>Created 20.10.2016</p>-->
<!--</td>-->
<!--<td>-->
<!--<span class="pie" style="display: none;">0.52/1.561</span><svg class="peity" height="30" width="30"><path d="M 15.000000000000002 0 A 15 15 0 0 1 28.00043211809656 22.482564048691025 L 15 15" fill="#2196F3"></path><path d="M 28.00043211809656 22.482564048691025 A 15 15 0 1 1 14.999999999999996 0 L 15 15" fill="#ccc"></path></svg>-->
<!--</td>-->
<!--<td>70%</td>-->
<!--<td>November 21, 2015</td>-->
<!--</tr>-->
<!--<tr>-->
<!--<th>-->
<!-- <img class="img-fluid img-circle" src="../assets/images/avatar-1.png" alt="User">-->
<!--</th>-->
<!--<td>Contract with belife Company-->
<!--<p><i class="icofont icofont-clock-time"></i>Created 20.10.2016</p>-->
<!--</td>-->
<!--<td>-->
<!--<span class="pie" style="display: none;">0.52/1.561</span><svg class="peity" height="30" width="30"><path d="M 15.000000000000002 0 A 15 15 0 0 1 28.00043211809656 22.482564048691025 L 15 15" fill="#2196F3"></path><path d="M 28.00043211809656 22.482564048691025 A 15 15 0 1 1 14.999999999999996 0 L 15 15" fill="#ccc"></path></svg>-->
<!--</td>-->
<!--<td>70%</td>-->
<!--<td>November 21, 2015</td>-->
<!--</tr>-->
<!--<tr>-->
<!--<th>-->
<!--<img class="img-fluid img-circle" src="../assets/images/avatar-2.png" alt="User">-->
<!--</th>-->
<!--<td>Contract with belife Company-->
<!--<p><i class="icofont icofont-clock-time"></i>Created 20.10.2016</p>-->
<!--</td>-->
<!--<td>-->
<!--<span class="pie" style="display: none;">0.52/1.561</span><svg class="peity" height="30" width="30"><path d="M 15.000000000000002 0 A 15 15 0 0 1 28.00043211809656 22.482564048691025 L 15 15" fill="#2196F3"></path><path d="M 28.00043211809656 22.482564048691025 A 15 15 0 1 1 14.999999999999996 0 L 15 15" fill="#ccc"></path></svg>-->
<!--</td>-->
<!--<td>70%</td>-->
<!--<td>November 21, 2015</td>-->
<!--</tr>-->
<!--</tbody>-->
<!--</table>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->

</div>

</div>


</div>
</div>

<?php include 'footer.php' ?>
