<?php
include_once("../include/main.inc.php");
check_session('MyCpanel','index.php');
admin_header();

$cat_count = get_category_count();
$enquiry_count = get_enquiry_count();
$location_count = get_location_count();
$blog_count = get_blog_count();
?>

      <div class="row dash-stats">
        <div class="col-lg-3">
          <a  style="text-decoration: none;"href="<?= SITE_URL_PATH ?>/cmadmin/manage_categories.php">
            <div class="tb-iconbox tb-style4 tb-color1">
              <div class="tb-icon tb-flex">
                <i class="fa fa-users"></i>
              </div>
              <div class="tb-iconbox-text">
                <h3 class="tb-iconbox-heading"><?= $cat_count ?></h3>
                <div class="tb-iconbox-sub-heading">Total Categories</div>
              </div>
            </div>
          </a>
        </div>
        <div class="col-lg-3">
          <a  style="text-decoration: none;"href="<?= SITE_URL_PATH ?>/cmadmin/manage_enquiry.php">
          <div class="tb-iconbox tb-style4 tb-color1">
            <div class="tb-icon tb-flex">
              <i class="fa fa-question-circle"></i>
            </div>
            <div class="tb-iconbox-text">
              <h3 class="tb-iconbox-heading"><?= $enquiry_count ?></h3>
              <div class="tb-iconbox-sub-heading">Total Enquiries</div>
            </div>
          </div></a>
        </div>
        <div class="col-lg-3">
          <a  style="text-decoration: none;"href="<?= SITE_URL_PATH ?>/cmadmin/manage_blog.php">
          <div class="tb-iconbox tb-style4 tb-color1">
            <div class="tb-icon tb-flex">
              <i class="fa fa-newspaper-o"></i>
            </div>
            <div class="tb-iconbox-text">
              <h3 class="tb-iconbox-heading"><?= $blog_count ?></h3>
              <div class="tb-iconbox-sub-heading">Total Blogs</div>
            </div>
          </div></a>
        </div>
        <div class="col-lg-3">
          <a  style="text-decoration: none;"href="<?= SITE_URL_PATH ?>/cmadmin/manage_locations.php">
          <div class="tb-iconbox tb-style4 tb-color1">
            <div class="tb-icon tb-flex">
              <i class="fa fa-map-marker"></i>
            </div>
            <div class="tb-iconbox-text">
              <h3 class="tb-iconbox-heading"><?= $location_count ?></h3>
              <div class="tb-iconbox-sub-heading">Total Locations</div>
            </div>
          </div></a>
        </div>
      </div>
      <?php 
      $today = date('Y-m-d');
      $query = mysqli_query($GLOBALS['dbcon'],"SELECT * FROM tbl_enquiry WHERE DATE(en_date) = '$today' limit 0,5");
      if(mysqli_num_rows($query) > 0){$i=1;?>
        <div class="col-lg-12">
          <div class="text-center">
            <span class="heading">Todays Enquiry</span> <span class="pull-right"><a href="<?= SITE_URL_PATH ?>/cmadmin/manage_enquiry.php">View All</a></span>
          </div>
          <div class="table-responsive">

            <table class="table table-striped">

              <thead>
                <tr>
                  <th>S.No.</th>
                  <th>Enquiry Details</th>
                  <th>Sender Details</th>
                  <th>Actions</th>
                </tr>  
              </thead>
              <tbody>
                <?php while($enquiry = mysqli_fetch_array($query)){?>
                  <tr>
                    <td><?= $i++ ?></td>
                    <td>
                      Name: <b><?=$enquiry['en_name'];?></b> <br /> 
                      Email: <b><?=$enquiry['en_email'];?></b>  <br />
                      Mobile: <b><?=$enquiry['en_mobile'];?></b>  <br />
                      Country: <b><?=$enquiry['en_country'];?></b> 
                    </td>
                    <td>
                      Sender Ip Address: <b><?=$enquiry['locationID'];?></b>  <br />   
                      Message: <b><?=$enquiry['en_comment'];?></b>  <br /> 
                      URl: <b><?=$enquiry['en_url'];?></b>  
                    </td>
                    <td>
                      <?php if ($enquiry['en_mobile'] != ''){?>
                          <a href="tel:<?= $enquiry['en_mobile'] ?>" title="Call Now"><i class="fa fa-phone call-to-action"></i></a>&nbsp;
<!--                          <a href="https://wa.me/91<?= $enquiry['en_mobile'] ?>" title="Whatsapp"><i class="fa fa-whatsapp call-to-action"></i></a>-->
                      <?php } ?>
                       <?php if ($enquiry['en_email'] != ''){?>
                          <a href="mailto:<?= $enquiry['en_email'] ?>" title="Mail Now"><i class="fa fa-envelope-o call-to-action"></i></a>&nbsp;
                      <?php } ?>
                    </td>
                </tr> 
                <?php }?>
              </tbody>
            </table>
          </div>
        </div>
      <?php }
      ?>
      



<?php
admin_footer();

?>

