<?php if($lihat){?>
<?php
$q=mysqli_query($connect, "SELECT a.*,b.user_nama FROM `admin_kritik` a,`users` b WHERE b.ID=a.ID_user and a.ID ='$lihat'") or die(mysqli_error($connect));
$b=mysqli_fetch_array($q);
?>
<div class="row clearfix">
  <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
    <div class="card">
      <div class="header">
        <h2>VIEW CRITICISM AND SUGGESTIONS</h2>
      </div>
      <div class="body">
        <form>
          <div class="form-group">
            <label>User</label>
            <div class="form-line">
              <?php echo $b['user_nama'];?>
            </div>
          </div>
          <div class="form-group">
            <label>Date</label>
            <div class="form-line">
              <?php echo $b['date_create'];?>
            </div>
          </div>
		   <div class="form-group">
            <label>Criticism</label>
            <div class="form-line">
              <?php echo $b['kritik'];?>
            </div>
          </div>
        <div class="form-group">
          <button type="button" class="btn btn-sm bg-blue-grey waves-effect back">Back</button>
        </div>
      </form>
      </div>
    </div>
  </div>
</div>
<?php }else{?>
<div class="row clearfix">
  <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
    <div class="card">
      <div class="header">
        <h2>DATA CRITICISM AND SUGGESTIONS</h2>
      </div>
      <div class="body">
      	<table class="table table-bordered table-striped table-hover dataTable js-exportable">
            <thead>
              <tr>
                <th>#</th>
                <th>User</th>
                <th>Date</th>
				        <th>Criticism</th>
                <th>Action</th>
              </tr>
            </thead>
            <tbody>
            </tbody>
          </table>
      </div>
    </div>
  </div>
</div>
<?php } ?>
<script type="text/javascript">
$( document ).ready(function() {
$('table').DataTable({
		 "bSort":false,
		 "bProcessing": true,
         "serverSide": true,
         "ajax":{
            url :"<?php echo getConfig($connect, 'base_url');?>processData.php",
            type: "post",
			data:{p:'<?php echo $page;?>'},
            error: function(a,e,t){
				swal({
					title: "Something Wrong!",
					text: formatErrorMessage(a,e),
					type: "error",
					showCancelButton: !1,
					closeOnConfirm: !0
				}, function() {
					if(a.responseText){
						$("#hasil").html(a.responseText);
					}else{
						$("#hasil").html("Error : "+formatErrorMessage(a,e));
					}
				});
              	$("table").css("display","none");
            },
			complete: function(a,e,t){
				noClick2();
				initAjax(true);
			}
          },
		 responsive: !1,
		 width:'100%',
		 "autoWidth": false,
		 columnDefs: [
		 	{"targets": 0,"className": "text-center"},
			{"targets": 1,"className": "text-center"},
			{"targets": 2,"className": "text-center"}
			 ]
        }); 
});
</script>