<?php
session_start();
if (isset($_SESSION['username']) == true) {
	$username = $_SESSION['username'];
}else{
	header("location:login");
}

?>
		
<?php
include 'master.php';
?>
		<!--end header-->
		<!--page-wrapper-->
		<div class="page-wrapper">
			<!--page-content-wrapper-->
			<div class="page-content-wrapper">
				<div class="page-content">
					<div class="row">
						<div class="col-12 col-lg-3">
							<div class="card radius-15 bg-voilet">
								<div class="card-body">
									<div class="d-flex align-items-center">
										<?php
											function countmember($conn){
												$selall_members = $conn->query("SELECT * FROM users ");
												$count_member = mysqli_num_rows($selall_members);
												return $count_member;
											}
											
										?>
										<div>
											<h2 class="mb-0 text-white"><?php echo countmember($conn);?></h2>
										</div>
										<div class="ml-auto font-35 text-white"><i class="bx bx-user"></i>
										</div>
									</div>
									<div class="d-flex align-items-center">
										<div>
											<a href="members"><p class="mb-0 text-white">Members</p></a>
										</div>
									</div>
								</div>
							</div>
						</div>
						<div class="col-12 col-lg-3">
							<div class="card radius-15 bg-primary-blue">
								<div class="card-body">
									<div class="d-flex align-items-center">
										<div>
											<?php
											function count_pending_transfer($conn){
												$selall_pending_transfer = $conn->query("SELECT * FROM transactions WHERE status = 'Pending' AND stat IN ('International Transfer', 'Local Transfer') ");
												$count_pending_transfer = mysqli_num_rows($selall_pending_transfer);
												return $count_pending_transfer;
											}
											
										?>
											<h2 class="mb-0 text-white"><?php echo count_pending_transfer($conn);?></h2>
										</div>
										<div class="ml-auto font-35 text-white"><i class="bx bx-money"></i>
										</div>
									</div>
									<div class="d-flex align-items-center">
										<div>
											<a href="pending_transfers"><p class="mb-0 text-white">Pending Transfers</p></a>
										</div>
									</div>
								</div>
							</div>
						</div>
						<div class="col-12 col-lg-3">
							<div class="card radius-15 bg-rose">
								<div class="card-body">
									<div class="d-flex align-items-center">
										<?php
											function count_transfer($conn){
												$selall_transfer = $conn->query("SELECT * FROM transactions WHERE stat IN ('International Transfer', 'Local Transfer') ");
												$count_transfer = mysqli_num_rows($selall_transfer);
												return $count_transfer;
											}
											
										?>
										<div>
											<h2 class="mb-0 text-white"><?php echo count_transfer($conn);?></h2>
										</div>
										<div class="ml-auto font-35 text-white"><i class="bx bx-news"></i>
										</div>
									</div>
									<div class="d-flex align-items-center">
										<div>
											<a href="transfers"><p class="mb-0 text-white">Transfers</p></a>
										</div>
									</div>
								</div>
							</div>
						</div>
						<div class="col-12 col-lg-3">
							<div class="card radius-15 bg-sunset">
								<div class="card-body">
									<div class="d-flex align-items-center">
										<?php
											$id = 1;
											$sel_visitor = $conn->query("SELECT * FROM visitors WHERE id = '$id' ");
											$count_visitor = mysqli_fetch_array($sel_visitor);
											$visitor = $count_visitor['visitor'];
										?>
										<div>
											<h2 class="mb-0 text-white"><?php echo $visitor;?></h2>
										</div>
										<div class="ml-auto font-35 text-white"><i class="bx bx-user"></i>
										</div>
									</div>
									<div class="d-flex align-items-center">
										<div>
											<a href=""><p class="mb-0 text-white">Visitors</p></a>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
					<!--end row-->
					<!-- <div class="card radius-15">
						<div class="card-header border-bottom-0">
							<div class="d-flex align-items-center">
								<div>
									<h5 class="mb-0">Recent Orders</h5>
								</div>
								<div class="ml-auto">
									<button type="button" class="btn btn-white radius-15">View More</button>
								</div>
							</div>
						</div>
						<div class="card-body p-0">
							<div class="table-responsive">
								<table class="table mb-0">
									<thead>
										<tr>
											<th>Photo</th>
											<th>Product Name</th>
											<th>Customer</th>
											<th>Product id</th>
											<th>Price</th>
											<th>Status</th>
										</tr>
									</thead>
									<tbody>
										<tr>
											<td>
												<div class="product-img bg-transparent border">
													<img src="assets/images/icons/smartphone.png" width="35" alt="">
												</div>
											</td>
											<td>Honor Mobile 7x</td>
											<td>Mitchell Daniel</td>
											<td>#835478</td>
											<td>$54.68</td>
											<td><a href="javascript:;" class="btn btn-sm btn-light-success btn-block radius-30">Delivered</a>
											</td>
										</tr>
										<tr>
											<td>
												<div class="product-img bg-transparent border">
													<img src="assets/images/icons/watch.png" width="35" alt="">
												</div>
											</td>
											<td>Hand Watch</td>
											<td>Milona Burke</td>
											<td>#987546</td>
											<td>$43.78</td>
											<td><a href="javascript:;" class="btn btn-sm btn-light-warning btn-block radius-30">Pending</a>
											</td>
										</tr>
										<tr>
											<td>
												<div class="product-img bg-transparent border">
													<img src="assets/images/icons/laptop.png" width="35" alt="">
												</div>
											</td>
											<td>Mini Laptop</td>
											<td>Craig Clayton</td>
											<td>#325687</td>
											<td>$62.21</td>
											<td><a href="javascript:;" class="btn btn-sm btn-light-success btn-block radius-30">Delivered</a>
											</td>
										</tr>
										<tr>
											<td>
												<div class="product-img bg-transparent border">
													<img src="assets/images/icons/shirt.png" width="35" alt="">
												</div>
											</td>
											<td>Slim-T-Shirt</td>
											<td>Clark Andola</td>
											<td>#658972</td>
											<td>$75.68</td>
											<td><a href="javascript:;" class="btn btn-sm btn-light-danger btn-block radius-30">Cancelled</a>
											</td>
										</tr>
									</tbody>
								</table>
							</div>
						</div>
					</div>
				</div>
			</div> -->
			<!--end page-content-wrapper-->
		</div>
		<!--end page-wrapper-->
		<!--start overlay-->
		<div class="overlay toggle-btn-mobile"></div>
		<!--end overlay-->
		<!--Start Back To Top Button--> <a href="javaScript:;" class="back-to-top"><i class='bx bxs-up-arrow-alt'></i></a>
		<!--End Back To Top Button-->

<?php
include 'footer.php';