<?php
session_start();
error_reporting(0);
include('config.php');
if(strlen($_SESSION['alogin'])==0)
{
  header('location:login.php');
}
else
{

}
?>
<?php include('header.php');?>
<body>
  <!-- Preloader End Here -->
  <div id="wrapper" class="wrapper bg-ash">
   <?php include('main_header.php');?>
   <!-- Page Area Start Here -->
   <div class="dashboard-page-one">
    <?php include('side_header.php');?>

    <!-- Sidebar Area End Here -->
    <div class="dashboard-content-one">
      <!-- Breadcubs Area End Here --><br>
      <div class="row gutters-20">
        <div class="col-xl-12 col-sm-12 col-12">
          <div class="dashboard-summery-one mg-b-20">
            <div class="row align-items-center">
              <div class="col-6">
                <button type="button" class="btn-fill-lmd radius-30 text-light shadow-dark-pastel-green bg-dark-pastel-green">Helpdesk - Open Tickets</button>
              </div>
              <div class="col-6">
                <div class="item-content">
                  <a href="dashboard.php" class="btn-fill-lmd radius-30 text-light shadow-dodger-blue bg-orange-peel">Get Back</a>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="row" style="padding-top: 10px;">
       <div class="col-lg-12 grid-margin stretch-card">
        <div class="card">
          <div class="card-body">
            <div class="table-responsive pt-3">
              <table id="report-table" class="table table-striped mb-0">
                <thead>
                  <tr>
                    <th>ID</th>
                    <th>Type</th>
                    <th>Priority</th>
                    <th>Open Date</th>
                    <th>Status</th>
                    <th>Action</th>
                  </tr>
                </thead>
                <tbody>
                  <?php
                  $sql = "SELECT * from help_desk where Status=0";
                  $query = $dbh -> prepare($sql);
                  $query -> bindParam(':eid',$eid, PDO::PARAM_STR);
                  $query->execute();
                  $results=$query->fetchAll(PDO::FETCH_OBJ);
                  $cnt=1;
                  if($query->rowCount() > 0)
                  {
                    foreach($results as $result)
                    {
                      ?>
                      <tr>
                        <td>
                          <div><?php echo htmlentities($result->id);?></div>
                        </td>
                        <td>
                          <div class="amount">
                            <?php echo htmlentities($result->type);?>
                          </div>
                        </td>
                        <td>
                          <div> <?php echo htmlentities($result->priority);?></div>
                        </td>

                        <td>
                          <div> <?php echo htmlentities($result->created_date_js);?></div>
                        </td>
                        <td>
                          <span class="badge badge-success"> In Progress</span>
                        </td>
                        <td>
                          <div> <a href="view_ticket.php?id=<?php echo htmlentities($result->id);?>" class="btn btn-dark btn-sm" style="padding: 4px 10px;font-size: 15px;">View</a></div>
                        </td>
                      </tr>
                    <?php }}?>
                  </tbody>
                </table>
              </div>
            </div>
          </div>
        </div>
      </body>
      <?php include('footer.php');?>
