 <?php
    session_start();
    
    
if(!isset($_SESSION['main'])){
    header('Location:../../');
}
    include "../config/setup.php";
    include "head.php";
?>
	<div class="wrapper">
		<div class="main-header">
			<!-- Logo Header -->
			<?php include('logo.php');?>
			<!-- End Logo Header -->

			<!-- Navbar Header -->
		    <?php include('topbar.php');?>
			<!-- End Navbar -->
		</div>

		<!-- Sidebar -->
	    <?php include('sidebar.php');?>
		<!-- End Sidebar -->

		<div class="main-panel">
			<div class="content">
				<div class="panel-header bg-primary-gradient">
					<div class="page-inner py-5">
						<div class="d-flex align-items-left align-items-md-center flex-column flex-md-row">
							<div>
								<h2 class="text-white pb-2 fw-bold">Dashboard</h2>
								<!--<h5 class="text-white op-7 mb-2">Customer statistics</h5>-->
							</div>
							<div class="ml-md-auto py-2 py-md-0">
								<!--<a href="Customer_Master.php" class="btn btn-white btn-border btn-round mr-2">Manage Customer</a>-->
								<!--<a href="order_master_on_process.php" class="btn btn-secondary btn-round">Manage Orders</a>-->
							</div>
						</div>
					</div>
				</div>
				<div class="page-inner mt-3">
					<div class="card-title">Listing</div>
					<!--<div class="card-title">Package</div>-->
					<div class="row">
					    <div class="col-sm-6 col-md-3 ">
							<div class="card card-stats card-round card-danger">
    							<a href="order_approve.php">
    								<div class="card-body">
    									<div class="row">
    										<div class="col-3">
    											<div class="icon-big text-center">
    												<i class="fas fa-ticket-alt text-success" style="color:#f7f7f7!important;"></i>
    											</div>
    										</div>
    										<div class="col-9 col-stats ">
    											<div class="numbers">
    												<h3 style="  color: #ffffff;" >Requested</h3>
    												<h4 class="card-title" style="  color:#fff;">
												    <?php
    												    $appr_sql = $config->query("SELECT COUNT(event_id) as count FROM event_post WHERE e_status = 1 ") ;
    												    $appr = $appr_sql->fetch_assoc();
                                                        echo $appr[count];
                                                    ?>
    												</h4>
    											</div>
    										</div>
    									</div>
    								</div>
								</a>
							</div>
						</div>
					    <div class="col-sm-6 col-md-3 ">
							<div class="card card-stats card-round" style=" background-color:#007bff;">
    							<a href="order_approve.php">
    								<div class="card-body">
    									<div class="row">
    										<div class="col-3">
    											<div class="icon-big text-center">
    												<i class="fas fa-shield-alt" style="color:#f7f7f7!important;"></i>
    											</div>
    										</div>
    										<div class="col-9 col-stats ">
    											<div class="numbers">
    												<h3 style="  color: #ffffff;" >Active</h3>
    												<h4 class="card-title" style="  color:#fff;">
												    <?php
    												    $appr_sql = $config->query("SELECT COUNT(event_id) as count FROM event_post WHERE e_status = 2 ") ;
    												    $appr = $appr_sql->fetch_assoc();
                                                        echo $appr[count];
                                                    ?>
    												</h4>
    											</div>
    										</div>
    									</div>
    								</div>
								</a>
							</div>
						</div>
						<div class="col-sm-8 col-md-4 d-none">
							<div class="card card-stats card-round card-danger">
    							<a href="order_request.php">
    								<div class="card-body ">
    									<div class="row">
    										<div class="col-3">
    											<div class="icon-big text-center">
    												<i class="fas fa-ticket-alt text-success" style="color:#f7f7f7!important;"></i>
    											</div>
    										</div>
    										<div class="col-9 col-stats">
    											<div class="numbers">
    												<h3 style="color: #ffffff;">Requested / Pending</h3>
    												<h4 class="card-title" style="color:#fff;">
    												<?php
    												    $req_sql = $config->query("SELECT COUNT(order_id) as count FROM order_master WHERE order_status = 1 ") ;
    												    $req = $req_sql->fetch_assoc();
                                                        echo $req[count];
                                                    ?>
    												</h4>
    											</div>
    										</div>
    									</div>
    								</div>
								</a>
							</div>
						</div>
						<div class="col-sm-6 col-md-3 d-none">
							<div class="card card-stats card-round" style=" background-color:#007bff;">
    							<a href="order_approve.php">
    								<div class="card-body">
    									<div class="row">
    										<div class="col-3">
    											<div class="icon-big text-center">
    												<i class="fas fa-shield-alt" style="color:#f7f7f7!important;"></i>
    											</div>
    										</div>
    										<div class="col-9 col-stats ">
    											<div class="numbers">
    												<h3 style="  color: #ffffff;" >Active</h3>
    												<h4 class="card-title" style="  color:#fff;">
												    <?php
    												    $appr_sql = $config->query("SELECT COUNT(order_id) as count FROM order_master WHERE order_status = 2 ") ;
    												    $appr = $appr_sql->fetch_assoc();
                                                        echo $appr[count];
                                                    ?>
    												</h4>
    											</div>
    										</div>
    									</div>
    								</div>
								</a>
							</div>
						</div>
					</div>
					<div class="card-title">Users</div>
					<div class="row">
						<div class="col-sm-6 col-md-3">
							<div class="card card-stats card-round" style=" background-color: #0bbb33;">
								<!--<a href="product_master.php">-->
								<div class="card-body ">
									<div class="row">
										<div class="col-3">
											<div class="icon-big text-center">
												<i class="fas fa-users text-warning" style="color:#f7f7f7!important;"></i>
											</div>
										</div>
										<div class="col-9 col-stats">
											<div class="numbers">
												<h3 style="color: #ffffff;" >Total Users</h3>
												<h4 class="card-title" style="color:#f1f1f1;">
											    <?php
    											    $total_sql = $config->query("SELECT COUNT(Master_id) as count,(SELECT COUNT(Master_id) FROM master_login WHERE Master_type = 1) as tot FROM master_login") ;
    											    $total = $total_sql->fetch_assoc();
                                                    echo $total['count'] - $total['tot'];
                                                ?>
											</h4>
											</div>
										</div>
									</div>
								</div>
								<!--</a>	-->
							</div>
						</div>
						<div class="col-sm-6 col-md-3">
							<div class="card card-stats card-round" style=" background-color: #007bff;">
    							<a href="newenquiry.php">
    								<div class="card-body ">
    									<div class="row">
    										<div class="col-3">
    											<div class="icon-big text-center">
    												<i class="fas fa-users-cog text-success" style="color:#f7f7f7!important;"></i>
    											</div>
    										</div>
    										<div class="col-9 col-stats">
    											<div class="numbers">
    												<h3 style="  color: #ffffff;" >Vendor Count</h3>
    												<h4 class="card-title" style="color:#fff;">
    												<?php
        											    $v_sql = $config->query("SELECT COUNT(Master_id) as count FROM master_login WHERE Master_Type = 2 ") ;
        											    $vendor = $v_sql->fetch_assoc();
                                                        echo $vendor['count'];
                                                    ?>
    												</h4>
    											</div>
    										</div>
    									</div>
    								</div>
								</a>
							</div>
						</div>
						<div class="col-sm-6 col-md-3">
							<div class="card card-stats card-round" style=" background-color: #17a2b8;">
    							<a href="newenquiry.php">
    								<div class="card-body ">
    									<div class="row">
    										<div class="col-3">
    											<div class="icon-big text-center">
    												<i class="fas fa-user-friends text-success" style="color:#f7f7f7!important;"></i>
    											</div>
    										</div>
    										<div class="col-9 col-stats">
    											<div class="numbers">
    												<h3 style="  color: #ffffff;" >User Count</h3>
    												<h4 class="card-title" style="color:#fff;">
    												<?php
        											    $user_sql = $config->query("SELECT COUNT(Master_id) as count FROM master_login WHERE Master_Type = 3 ") ;
        											    $user = $user_sql->fetch_assoc();
                                                        echo $user['count'];
                                                    ?>
    												</h4>
    											</div>
    										</div>
    									</div>
    								</div>
								</a>
							</div>
						</div>
						<div class="col-sm-6 col-md-3">
							<div class="card card-stats card-round" style=" background-color: #f4a824;">
    							<a href="newenquiry.php">
    								<div class="card-body ">
    									<div class="row">
    										<div class="col-3">
    											<div class="icon-big text-center">
    												<i class="fas fa-users" style="color:#f7f7f7!important;"></i>
    											</div>
    										</div>
    										<div class="col-9 col-stats">
    											<div class="numbers">
    												<h3 style="  color: #ffffff;" >Players Count</h3>
    												<h4 class="card-title" style="color:#fff;">
    												<?php
        											    $user_sql = $config->query("SELECT COUNT(id) as count FROM players WHERE status = 1 ") ;
        											    $user = $user_sql->fetch_assoc();
                                                        echo $user['count'];
                                                    ?>
    												</h4>
    											</div>
    										</div>
    									</div>
    								</div>
								</a>
							</div>
						</div>
					</div>
					<div class="card-title">Enquiries</div>
					<div class="row">
						<div class="col-sm-6 col-md-3">
							<div class="card card-stats card-round" style=" background-color: #0bbb33;">
								<!--<a href="product_master.php">-->
								<div class="card-body ">
									<div class="row">
										<div class="col-3">
											<div class="icon-big text-center">
												<i class="fas fa-money-bill text-warning" style="color:#f7f7f7!important;"></i>
											</div>
										</div>
										<div class="col-9 col-stats">
											<div class="numbers">
												<h3 style="color: #ffffff;" >Total Enquiry</h3>
												<h4 class="card-title" style="color:#f1f1f1;">
											    <?php
    											    $sub_sql = $config->query("SELECT COUNT(Sub_Category_id) as count FROM sub_category ") ;
    											    $sub = $sub_sql->fetch_assoc();
                                                    echo $sub[count];
                                                ?>
											</h4>
											</div>
										</div>
									</div>
								</div>
								<!--</a>	-->
							</div>
						</div>
						<div class="col-sm-6 col-md-3">
							<div class="card card-stats card-round" style=" background-color: #6861ce;">
    							<a href="newenquiry.php">
    								<div class="card-body ">
    									<div class="row">
    										<div class="col-3">
    											<div class="icon-big text-center">
    												<i class="fas fa-money-bill-wave-alt" style="color:#f7f7f7!important;"></i>
    											</div>
    										</div>
    										<div class="col-9 col-stats">
    											<div class="numbers">
    												<h3 style="  color: #ffffff;" >Paid Enquiry</h3>
    												<h4 class="card-title" style="color:#fff;">0</h4>
    											</div>
    										</div>
    									</div>
    								</div>
								</a>
							</div>
						</div>
					</div>
                    <div class="card-title">Orders</div>
                    <div class="row">
                        <div class="col-sm-6 col-md-3">
                            <div class="card card-stats card-round" style=" background-color: #0bbb33;">
                                <a href="user_approve.php">
                                <div class="card-body ">
                                    <div class="row">
                                        <div class="col-3">
                                            <div class="icon-big text-center">
                                                <i class="fas fa-money-bill text-warning" style="color:#f7f7f7!important;"></i>
                                            </div>
                                        </div>
                                        <div class="col-9 col-stats">
                                            <div class="numbers">
                                                <h3 style="color: #ffffff;" >Total Orders</h3>
                                                <h4 class="card-title" style="color:#f1f1f1;">
                                                <?php
                                                    $sub_sql = $config->query("SELECT COUNT(buy_id) as count FROM buypack_master ") ;
                                                    $sub = $sub_sql->fetch_assoc();
                                                    echo $sub[count];
                                                ?>
                                            </h4>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                </a>    
                            </div>
                        </div>
                        <div class="col-sm-6 col-md-3">
                            <div class="card card-stats card-round" style=" background-color: #6861ce;">
                                <a href="user_approve.php">
                                    <div class="card-body ">
                                        <div class="row">
                                            <div class="col-3">
                                                <div class="icon-big text-center">
                                                    <i class="fas fa-money-bill-wave-alt" style="color:#f7f7f7!important;"></i>
                                                </div>
                                            </div>
                                            <div class="col-9 col-stats">
                                                <div class="numbers">
                                                    <h3 style="  color: #ffffff;" >Total Commission</h3>
                                                    
                                                    <h4 class="card-title" style="color:#fff;">
                                                          <?php
                                                    $sub_sql = $config->query("SELECT SUM(comm_amt) as count FROM apply_request WHERE pay_id !='0'") ;
                                                    $sub = $sub_sql->fetch_assoc();
                                                    echo $sub[count];
                                                   ?>
                                                    </h4>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </a>
                            </div>
                        </div>
                    </div>
				</div>
			</div>
			<?php include('footer.php')?>
		</div>
	</div>
	<style>
    	a:hover{
    	    text-decoration:none;
    	}
	    @media only screen and (max-width:500px){
	        .col-sm-6{
                width: 50% !important;
            }
	    }
	</style>
	<!--   Core JS Files   -->
	<script src="../assets/js/core/jquery.3.2.1.min.js"></script>
	<script src="../assets/js/core/popper.min.js"></script>
	<script src="../assets/js/core/bootstrap.min.js"></script>

	<!-- jQuery UI -->
	<script src="../assets/js/plugin/jquery-ui-1.12.1.custom/jquery-ui.min.js"></script>
	<script src="../assets/js/plugin/jquery-ui-touch-punch/jquery.ui.touch-punch.min.js"></script>

	<!-- jQuery Scrollbar -->
	<script src="../assets/js/plugin/jquery-scrollbar/jquery.scrollbar.min.js"></script>

	<script src="../assets/js/plugin/datatables/datatables.min.js"></script>
	<!-- Chart JS -->
	<script src="../assets/js/plugin/chart.js/chart.min.js"></script>

	<!-- jQuery Sparkline -->
	<script src="../assets/js/plugin/jquery.sparkline/jquery.sparkline.min.js"></script>

	<!-- Chart Circle -->
	<script src="../assets/js/plugin/chart-circle/circles.min.js"></script>

	<!-- Datatables -->
	<script src="../assets/js/plugin/datatables/datatables.min.js"></script>

	<!-- Bootstrap Notify -->
	<script src="../assets/js/plugin/bootstrap-notify/bootstrap-notify.min.js"></script>

	<!-- jQuery Vector Maps -->
	<script src="../assets/js/plugin/jqvmap/jquery.vmap.min.js"></script>
	<script src="../assets/js/plugin/jqvmap/maps/jquery.vmap.world.js"></script>

	<!-- Sweet Alert -->
	<script src="../assets/js/plugin/sweetalert/sweetalert.min.js"></script>

	<!-- Atlantis JS -->
	<script src="../assets/js/atlantis.min.js"></script>

	<script >
		$(document).ready(function() {
			$('#basic-datatables').DataTable({
			});
			 
		});
	</script>
	 
</body>
</html>