<?php
include("core/init.php");
include("session.php");

if (Input::particularInputExists("post", "license")) {
  $licenseInfo = Db::getInstance()->get_row("select certification.firstname,certification.lastname,certification_status.status from certification 
JOIN certification_status ON (certification_status.id=certification.status) WHERE
certification.certification_id='" . Input::getInput("license") . "'");
}

$packageCount = Db::getInstance()->num_rows("select id from packages");

$inquiryCount = Db::getInstance()->num_rows("select id from quick_inquries");

$registrationsCount = Db::getInstance()->num_rows("select id from registrations");

$faqCount = Db::getInstance()->num_rows("select id from faqs");
$bannerCount = Db::getInstance()->num_rows("select id from banners");
$scheduleCount = Db::getInstance()->num_rows("select id from schedule");

$locationCount = Db::getInstance()->num_rows("select id from locations");

$certificationCount = Db::getInstance()->num_rows("Select certification.id from `certification`
                JOIN province ON (province.id=certification.province_id)
                JOIN certification_status ON (certification_status.id=certification.status)");
?>
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Dashboard - <?php echo Config::get("project/site_title"); ?></title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <link rel="shortcut icon" href="dist/img/admin-panel.png">
  <!-- Bootstrap 3.3.6 -->
  <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="dist/css/AdminLTE.min.css">
  <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
  <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">

  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->
</head>

<body class="hold-transition skin-blue sidebar-mini">
  <div class="wrapper">




    <?php include("includes/header.php"); ?>






    <?php include("includes/sidebar.php"); ?>


    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
      <!-- Content Header (Page header) -->
      <section class="content-header">
        <h1>
          Dashboard
          <small>Preview page</small>
        </h1>
        <ol class="breadcrumb">
          <li class="active"><a href="Dashboard"><i class="fa fa-dashboard"></i> Home</a></li>
        </ol>
      </section>

      <!-- Main content -->
      <section class="content">

        <div class="row">
          <div class="col-md-3 col-sm-6 col-xs-12">
            <div class="info-box">
              <a href="quick-inquiries"><span class="info-box-icon bg-aqua"><i class="fa fa-inbox" aria-hidden="true"></i></span></a>

              <div class="info-box-content">
                <span class="info-box-text">Quick Inquiries</span>
                <span class="info-box-number"><?php echo $inquiryCount; ?></span>
              </div>

              <!-- /.info-box-content -->
            </div>
            <!-- /.info-box -->
          </div>
          <!-- /.col -->
          <div class="col-md-3 col-sm-6 col-xs-12">
            <div class="info-box">
              <a href="manageLocations"><span class="info-box-icon bg-green"><i class="fa fa-map-marker" aria-hidden="true"></i></span></a>

              <div class="info-box-content">
                <span class="info-box-text">Locations</span>
                <span class="info-box-number"><?php echo $locationCount; ?></span>
              </div>
              <!-- /.info-box-content -->
            </div>
            <!-- /.info-box -->
          </div>
          <!-- /.col -->
          <div class="col-md-3 col-sm-6 col-xs-12">
            <div class="info-box">
              <a href="Packages"><span class="info-box-icon bg-yellow"><i class="fa fa-gift" aria-hidden="true"></i></span></a>

              <div class="info-box-content">
                <span class="info-box-text">Packages</span>
                <span class="info-box-number"><?php echo $packageCount; ?></span>
              </div>
              <!-- /.info-box-content -->
            </div>
            <!-- /.info-box -->
          </div>
          <!-- /.col -->
          <div class="col-md-3 col-sm-6 col-xs-12">
            <div class="info-box">
              <a href="Faq"><span class="info-box-icon bg-red"><i class="fa fa-question"></i></span></a>
              <div class="info-box-content">
                <span class="info-box-text">FAQ</span>
                <span class="info-box-number"><?php echo $faqCount ?></span>
              </div>
              <!-- /.info-box-content -->
            </div>
            <!-- /.info-box -->
          </div>
          <!-- /.col -->
        </div>
        <!-- /.row -->

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


        <!-- /.row -->

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

        <!-- Small boxes (Stat box) -->
        <div class="row">
          <div class="col-lg-3 col-xs-6">
            <!-- small box -->
            <div class="small-box bg-aqua">
              <div class="inner">
                <h3><?php echo $bannerCount; ?></h3>

                <p>Banners</p>
              </div>
              <div class="icon">
                <i class="fa fa-image"></i>
              </div>
              <a href="Banners" class="small-box-footer">
                More info <i class="fa fa-arrow-circle-right"></i>
              </a>
            </div>
          </div>
          <!-- ./col -->
          <div class="col-lg-3 col-xs-6">
            <!-- small box -->
            <div class="small-box bg-green">
              <div class="inner">
                <h3><?php echo $scheduleCount; ?></h3>

                <p>Schedule</p>
              </div>
              <div class="icon">
                <i class="fa fa-map-signs"></i>
              </div>
              <a href="Schedule" class="small-box-footer">
                More info <i class="fa fa-arrow-circle-right"></i>
              </a>
            </div>
          </div>
          <!-- ./col -->
          <div class="col-lg-3 col-xs-6">
            <!-- small box -->
            <div class="small-box bg-yellow">
              <div class="inner">
                <h3><?php echo $registrationsCount; ?></h3>

                <p>User Registrations</p>
              </div>
              <div class="icon">
                <i class="ion ion-person-add"></i>
              </div>
              <a href="Registrations" class="small-box-footer">
                More info <i class="fa fa-arrow-circle-right"></i>
              </a>
            </div>
          </div>
          <!-- ./col -->
          <div class="col-lg-3 col-xs-6">

            <div class="small-box bg-red">
              <div class="inner">
                <h3><?php echo $certificationCount; ?></h3>

                <p>Certification</p>
              </div>
              <div class="icon">
                <i class="fa fa-certificate" aria-hidden="true"></i>
              </div>
              <a href="Certification" class="small-box-footer">
                More info <i class="fa fa-arrow-circle-right"></i>
              </a>
            </div>
          </div>
          <!-- ./col -->
        </div>
        <!-- /.row -->

        <div class="row">
          <form action="Dashboard" method="post">
            <div class="col-lg-3 col-xs-6">
              <div class="form-group">
                <label for="exampleInputPassword1">Check Certification *</label>
                <?php if (Input::particularInputExists("post", "license") && !count($licenseInfo)) { ?>
                  <p class="text-danger">Invalid License Id</p>
                <?php } ?>
                <input type="text" class="form-control" name="license" id="category" value="" placeholder="License Id" autocomplete="off">
              </div>
              <button type="submit" class="btn btn-primary">Submit</button>
            </div>

          </form>



          <?php if (Input::particularInputExists("post", "license") && count($licenseInfo)) { ?>
            <div class="col-xs-6">


              <div class="table-responsive">
                <table class="table">
                  <thead>
                    <th>Firstname</th>
                    <th>Lastname</th>
                    <th>Status</th>
                  </thead>
                  <tbody>
                    <tr>
                      <td><?php echo $licenseInfo["firstname"]; ?></td>
                      <td><?php echo $licenseInfo["lastname"]; ?></td>
                      <td><?php echo $licenseInfo["status"]; ?></td>


                  </tbody>
                </table>
              </div>
            </div>
          <?php } ?>







        </div>




      </section>


      <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->

    <?php include("includes/footer.php"); ?>


    <!-- Add the sidebar's background. This div must be placed
       immediately after the control sidebar -->
    <div class="control-sidebar-bg"></div>
  </div>
  <!-- ./wrapper -->




  <!-- jQuery 2.2.3 -->
  <script src="plugins/jQuery/jquery-2.2.3.min.js"></script>
  <!-- Bootstrap 3.3.6 -->
  <script src="bootstrap/js/bootstrap.min.js"></script>
  <!-- Slimscroll -->
  <script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
  <!-- FastClick -->
  <script src="plugins/fastclick/fastclick.js"></script>
  <!-- AdminLTE App -->
  <script src="dist/js/app.min.js"></script>
  <!-- AdminLTE for demo purposes -->
  <script src="dist/js/demo.js"></script>
</body>

</html>