<?php include("cn.php");?>
<?php $title = "Dashboard";?>
<!DOCTYPE html>
<html lang="en">
<?php include("head-tag.php");?>
<?php 
       $sql_1 = mysqli_query($connect,"select * from users where
        Id = '".$_SESSION["userid"]."' ");
        $data_1 = mysqli_fetch_assoc($sql_1);
?>


<body>

<div class="inner-wrapper">

<?php include("pre-loader.php");?>

<?php include("header.php");?>

<div class="page-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-xl-3 col-lg-3 col-md-3 theiaStickySidebar">
    <aside class="sidebar sidebar-user">
        <div class="card ctm-border-radius shadow-sm">
            <div class="card-body py-4">
                <div class="row">
                    <div class="col-md-12 mr-auto text-left">
                        <div class="custom-search input-group">
                            <div class="custom-breadcrumb">
                                <ol class="breadcrumb no-bg-color d-inline-block p-0 m-0 mb-2">
                                    <li class="breadcrumb-item d-inline-block"><a href="index.php" class="text-dark">Home</a></li>
                                    <li class="breadcrumb-item d-inline-block active"><?php echo $title?></li>
                                </ol>
                                <h4 class="text-dark">Admin Dashboard</h4>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    <div class="user-card card shadow-sm bg-white text-center ctm-border-radius">
        <div class="user-info card-body">
            <div class="user-avatar mb-4">
                <img src="<?php echo $data_1["Image"];?>" " alt="User Avatar" class="img-fluid rounded-circle" width="100">
            </div>
            <div class="user-details">
                <h4><b>Welcome <?php echo $_SESSION["name"];?></b></h4>
            </div>
        </div>
    </div>
</aside>
</div>
<div class="col-xl-9 col-lg-9 col-md-9">

<div class="row">
<div class="col-xl-3 col-lg-3 col-sm-6 col-12">
<div class="card dash-widget ctm-border-radius shadow-sm">
<div class="card-body">
<div class="card-icon bg-info" style="width: 40px;
    height: 40px;">
<i class="fa fa-car" aria-hidden="true"></i>
</div>
<?php 
$sql = mysqli_query($connect, "select count(car_Id) as total from cars");
$data = mysqli_fetch_assoc($sql);
?>
<div class="card-right">
<h4 class="card-title"><a href="../admin/cars.php">Cars</a></h4>
<p class="card-text"><?php echo $data['total']?></p>
</div>
</div>
</div>
</div>
<?php 
$sql = mysqli_query($connect, "select count(Id) as total from brands");
$data = mysqli_fetch_assoc($sql);
?>
<div class="col-xl-3 col-lg-3 col-sm-6 col-12">
    <div class="card dash-widget ctm-border-radius shadow-sm">
        <div class="card-body">
            <div class="card-icon bg-danger" style="width: 40px;
    height: 40px;">
                <i class="fa fa-tasks"></i>
            </div>
            <div class="card-right">
                <h4 class="card-title"><a href="../admin/brands.php">Brands</a></h4>
                <p class="card-text"><?php echo $data['total']?></p>
            </div>
        </div>
    </div>
</div>
<?php 
$sql = mysqli_query($connect, "select count(driver_id) as total from driver");
$data = mysqli_fetch_assoc($sql);
?>
<div class="col-xl-3 col-lg-3 col-sm-6 col-12">
    <div class="card dash-widget ctm-border-radius shadow-sm">
        <div class="card-body">
            <div class="card-icon bg-success" style="width: 40px;
    height: 40px;">
                <i class="fa fa-user-secret" aria-hidden="true"></i>
            </div>
            <div class="card-right">
                <h4 class="card-title"><a href="../admin/drivers.php">Driver</a></h4>
                <p class="card-text"><?php echo $data['total']?></p>
            </div>
        </div>
    </div>
</div>
<?php 
$sql = mysqli_query($connect, "SELECT count(Id) as total from users WHERE Type = 'user'");
$data = mysqli_fetch_assoc($sql);
?>
<div class="col-xl-3 col-lg-3 col-sm-6 col-12">
    <div class="card dash-widget ctm-border-radius shadow-sm">
        <div class="card-body">
            <div class="card-icon bg-warning" style="width: 40px;
    height: 40px;">
                <i class="fa fa-user-o" aria-hidden="true"></i>
            </div>
            <div class="card-right">
                <h4 class="card-title"><a href="../admin/users.php">User</a></h4>
                <p class="card-text"><?php echo $data['total']?></p>
            </div>
        </div>
    </div>
</div>

</div>

<div class="col-xl-12 col-lg-12  col-md-12">
<div class="card ctm-border-radius shadow-sm">
<div class="card-body">
<div id="calendar1"> </div>
</div>
</div>
</div>

</div>
</div>
</div>
</div>

</div>

<div class="sidebar-overlay" id="sidebar_overlay"></div>

<?php include("scripts.php");?>

<script>

$(document).ready(function() {

   var calendar = $('#calendar1').fullCalendar({

    header:{
     left:'prev,next today',
     center:'title',
     right:'month,agendaWeek,agendaDay'
    },
    events: 'events.php',
    
    eventClick:function(event)
    {
       window.location = "booking-detail.php?id="+event.Id;
    },
    
    eventRender: function(event, element) {
        // element.qtip({
        //     content: {
        //         text: event.description,
        //         title: event.title,
        //         button: 'Close'
        //     }
        // });
    }

   });
  });

</script>

</body>

</html>