<?php

$page_title="Manage Suggestion";

include("includes/header.php");
require("includes/function.php");
require("language/language.php");

$sql="SELECT suggets.*, users.`name` FROM tbl_user_suggest suggets
LEFT JOIN  tbl_users users
ON suggets.`user_id`=users.`id`
ORDER BY suggets.`id` DESC";

$result=mysqli_query($mysqli,$sql);

?>

<link rel="stylesheet" type="text/css" href="assets/css/stylish-tooltip.css">

<div class="row">
  <div class="col-xs-12">
    <?php
        if(isset($_SERVER['HTTP_REFERER']))
          {
            echo '<a href="'.$_SERVER['HTTP_REFERER'].'"><h4 class="pull-left" style="font-size: 20px;color: #e91e63"><i class="fa fa-arrow-left"></i> Back</h4></a>';
         }
      ?>
    <div class="card mrg_bottom">
      <div class="page_title_block">
        <div class="col-md-5 col-xs-12">
          <div class="page_title"><?=$page_title?></div>
        </div>
      </div>
      <div class="clearfix"></div>
      <div class="col-md-12 mrg-top manage_report_btn">
        <button type="button" class="btn btn-danger btn_cust actions" data-table="tbl_user_suggest" data-action="delete"><i class="fa fa-trash"></i> Delete</button>
        <hr/>
        <table class="datatable table table-striped table-bordered table-hover">
          <thead>
            <tr>
              <th width="30">
                <div class="checkbox" style="margin: 0px">
                  <input type="checkbox" name="checkall" id="checkall_input" value="">
                  <label for="checkall_input"></label>
                </div>
              </th>                    
              <th>User</th>
              <th>Title</th>
              <th>Desciption</th> 
              <th>Image</th> 
              <th>Date</th>
              <th>Action</th>
            </tr>
          </thead>
          <tbody>
           <?php
           $i=0;
           while($row=mysqli_fetch_array($result))
           {
            ?>
            <tr>
              <td width="30">
                <div class="checkbox" style="margin: 0px">
                  <input type="checkbox" name="post_ids[]" id="checkbox<?php echo $i; ?>" value="<?php echo $row['id']; ?>" class="post_ids" style="margin: 0px;">
                  <label for="checkbox<?php echo $i;?>"></label>
                </div>
              </td>                 
              <td><?php echo $row['name'];?></td>
              <td><?php echo $row['title'];?></td>
              <td><p><?php echo $row['description'];?></p></td>
              <td>
                <span class="mytooltip tooltip-effect-3">
                  <span class="tooltip-item">
                    <img src="thumb.php?src=images/<?php echo $row['image'];?>&size=50x60" style="width: 50px;height: 60px">
                  </span> 
                  <span class="tooltip-content clearfix">
                    <a href="images/<?php echo $row['image'];?>" target="_blank"><img src="images/<?php echo $row['image'];?>" /></a>
                  </span>
                </span>
              </td>   
              <td>
                <?=date('d-m-Y',$row['created_at'])?>
              </td>             
              <td>
                <a href="javascript:void(0)" class="btn btn-danger btn_delete_a btn_cust" data-table="tbl_user_suggest" data-id="<?php echo $row['id']; ?>" data-toggle="tooltip" data-tooltip="Delete"><i class="fa fa-trash"></i></a></td>
              </tr>
              <?php

              $i++;
            }
            ?>
          </tbody>
        </table>
      </div>
      <div class="clearfix"></div>
    </div>
  </div>
</div>     


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

<script type="text/javascript">
  $('a[data-toggle="tooltip"]').tooltip({
    animated: 'fade',
    placement: 'bottom',
    html: true
  });
</script>