<?php include("auth.php");

function getTotalWithdrawls()
{
    include "conn.php";
    $total=0;
	$query="select count(*) as tot from tbl_wallet_withdraw ";
	$smt1=mysqli_query($conn,$query);
	if($result=mysqli_fetch_assoc($smt1))
	{
	 if($result['tot'])
	 $total=$result['tot'];
	}
    return($total);
		  
}

function getTotalPayments()
{
    include "conn.php";
    $total=0;
	$query="select count(*) as tot from payment";
	$smt1=mysqli_query($conn,$query);
	if($result=mysqli_fetch_assoc($smt1))
	{
	 if($result['tot'])
	 $total=$result['tot'];
	}
    return($total);
		  
}


function getTotalVendors()
{
    include "conn.php";
    $total=0;
	$query="select count(*) as tot from tbl_vendor where deleted_at is NULL";
	$smt1=mysqli_query($conn,$query);
	if($result=mysqli_fetch_assoc($smt1)) 
	{
	 if($result['tot'])
	 $total=$result['tot'];
	}
    return($total);
		  
}





?>


<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0" name="viewport">

  <title>Dashboard</title>
  <meta content="" name="description">
  <meta content="" name="keywords">
   <?php  include("templates/inc.php"); ?>
</head>

<body>

  <!-- ======= Header ======= -->
<?php
include ("templates/header.php");
?>

 <!-- End Header -->

  <!-- ======= Sidebar ======= -->

  <?php
include("templates/sidebar.php");

  ?>


<!-- End Sidebar-->

<main id="main" class="main">

<div class="pagetitle">
  <h1>Dashboard</h1>
  <nav>
    <ol class="breadcrumb">
      <li class="breadcrumb-item"><a href="index.html">Home</a></li>
      <li class="breadcrumb-item">Dashboard</li>
      
    </ol>
  </nav>
</div><!-- End Page Title -->


<section class="section dashboard">
      <div class="row">

        <!-- Left side columns -->
        <div class="col-lg-12">
          <div class="row">

          
              <!-- Revenue Card -->
              <div class="col-xxl-4 col-md-4">
                <div class="card info-card revenue-card"> 
                  <div class="card-body">
               <a href="vendor-post.php">   <h5 class="card-title"> Total<span>| Accounts</span></h5></a>
  
                    <div class="d-flex align-items-center">
                      <div class="card-icon rounded-circle d-flex align-items-center justify-content-center">
                      <i class="bi bi-people"></i>
                      </div>
                      <div class="ps-3">
                      <h6><?php echo getTotalVendors(); ?></h6>
  
                      </div>
                    </div>
                  </div>
  
                </div>
              </div><!-- End Revenue Card -->


              <!-- Revenue Card -->
              <div class="col-xxl-4 col-md-4">
                <div class="card info-card revenue-card">
  
                 
  
                  <div class="card-body">
               <a href="vendor-category-list.php"><h5 class="card-title">Total <span>| Payments </span></h5></a>
  
                    <div class="d-flex align-items-center">
                      <div class="card-icon rounded-circle d-flex align-items-center justify-content-center">
                      <i class="bi bi-wallet2"></i>
                      </div>
                      <div class="ps-3">
                      <h6><?php echo getTotalPayments(); ?></h6>
  
                      </div>
                    </div>
                  </div>
  
                </div>
              </div><!-- End Revenue Card -->

              <!-- Revenue Card -->
              <div class="col-xxl-4 col-md-4">
                <div class="card info-card revenue-card">
  
  
                  <div class="card-body">
                  <a href="users-list.php">  <h5 class="card-title">Total <span>| Withdrawls</span></h5></a>
  
                    <div class="d-flex align-items-center">
                      <div class="card-icon rounded-circle d-flex align-items-center justify-content-center">
                      <i class="bi bi-cash"></i>
                      </div>
                      <div class="ps-3">
                      <h6><?php echo getTotalWithdrawls(); ?></h6>
  
                      </div>
                    </div>
                  </div>
  
                </div>
              </div><!-- End Revenue Card -->

           
          
          </div>
        </div><!-- End Left side columns -->

       
      </div>
    </section>



</main><!-- End #main -->
  <!-- ======= Footer ======= -->
  <?php
  include("templates/footer.php");
?>

<!-- End Footer -->

  
  <?php include("templates/vendors.php"); ?>


</html>