<?php include('db_connect.php') ?>
<?php
$twhere ="";
if($_SESSION['login_type'] != 1)
  $twhere = "  ";
?>
<!-- Info boxes -->
<?php if($_SESSION['login_type'] == 1): ?>
        <div class="row">
          <div class="col-12 col-sm-6 col-md-4">
            <div class="small-box bg-light shadow-sm border">
              <div class="inner">
                <h3><?php echo $conn->query("SELECT * FROM rides")->num_rows; ?></h3>

                <p>Total Rides</p>
              </div>
              <div class="icon">
                <i class="fa fa-building"></i>
              </div>
            </div>
          </div>
           <div class="col-12 col-sm-6 col-md-4">
            <div class="small-box bg-light shadow-sm border">
              <div class="inner">
                <h3><?php $sales = $conn->query("SELECT sum(amount) as sales FROM ticket_list where date(date_created) ='".date('Y-m-d')."' "); echo $sales->num_rows > 0 ? number_format($sales->fetch_array()['sales']) : '0.00' ?></h3>

                <p>Total Sales Today</p>
              </div>
              <div class="icon">
                <i class="fa fa-chart-line"></i>
              </div>
            </div>
          </div>
      </div>

<?php else: ?>
	 <div class="col-12">
          <div class="card">
          	<div class="card-body">
          		Welcome <?php echo $_SESSION['login_name'] ?>!
          	</div>
          </div>
      </div>
          
<?php endif; ?>
