<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <title>Program Sistem Pakar Diagnosa</title>
    <link href="assets/css/yeti-bootstrap.min.css" rel="stylesheet"/>
    <link href="assets/css/general.css" rel="stylesheet"/>
    <link href="assets/css/select2.min.css" rel="stylesheet"/>
    <script src="assets/js/jquery.min.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>    
    <script src="assets/js/select2.min.js"></script>
    <script type="text/javascript">
var s5_taf_parent = window.location;
function popup_print(){
window.open('laporan_cetak.php','page','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=750,height=600,left=50,top=50,titlebar=yes')
}
</script>   
    <style type="text/css">
    .hi{
background-image: linear-gradient(rgba(0, 0, 0, 0.5),rgba(0, 0, 0, 0.5)), url('vitaminbg.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
  }
.dark{
  background-color: #000;
  color: #000;
}
.page-header{
    color: #fff;
}
.latar{
        background-color: #636e72;
    }
    .tambah{
        background-color:   #353b48;
    }
    .tambah:hover{
        background-color:   #718093;
        color: #fff;
    }
     .edit{
        background-color: #2f3640;
    }
    .edit:hover{
        background-color:   #718093;
        color: #fff;
    }
    </style>      
  

</head>
<body class="dark hi">
<div class="page-header">
    <h1 style="color: #fff;" align="center"><b>Laporan</b></h1>
</div>

<div class="panel panel-default">
    <div class="panel-heading">       
        <form class="form-inline">
            <div class="form-group pull-left">
            <a class="btn btn-info" onClick="popup_print()" ><span class="glyphicon glyphicon-print"></span> Cetak</a>
        </div> 
            <input type="hidden" name="m" value="laporan" />
            <div class="form-group">
                <input class="form-control" type="text" placeholder="Pencarian. . ." name="q" value="<?=@$_GET['q']?>" />
            </div>
            <div class="form-group">
                <button class="btn tambah"><span class="glyphicon glyphicon-search"></span></button>
            </div>
            
        </form>
    </div>
<div class="table-responsive">
        <table class="table table-bordered table-hover table-striped">
  <tr>
    <td width="50" align="center" valign="middle"><b>No</b></td>
    <td width="150" align="center" valign="middle"><b>Nama</b></td>
    <td width="150" align="center" valign="middle"><b>Email</b></td>
    <td width="100" align="center" valign="middle"><b>No. Hp</b></td>
    <td width="100" align="center" valign="middle"><b>Jenis Kelamin</b></td>
    <td width="150" align="center" valign="middle"><b>Usia</b></td>
    <td width="100" align="center" valign="middle"><b>Alamat</b></td>
    <td width="150" align="center" valign="middle"><b>Tanggal Konsultasi</b></td>
    <td width="70" align="center" valign="middle"><b>Hasil Konsultasi</b></td>
    <td width="150" align="center" valign="middle"><b>Nilai Kepercayaan</b></td>
    <td width="76" align="center" valign="middle"><b>Aksi</b></td>
  </tr>

  <?php
 require_once'functions.php';
    $q = esc_field(@$_GET['q']);
    $rows = $db->get_results("SELECT DISTINCT nama,email,no_hp,jk,usia,alamat,tanggal_konsultasi,hasil_konsultasi,kepercayaan FROM tb_hasil");
    $no=0;
    $rows = $db->get_results("SELECT * FROM tb_hasil 
    WHERE nama LIKE '%$q%' OR kepercayaan > 10
    ORDER BY id");
    foreach($rows as $row):?>
    <tr>
    <td align="center" valign="middle"><?=++$no?></td>
    <td valign="middle"> <?=$row->nama ?></td>
    <td valign="middle"> <?=$row->email ?></td>
    <td valign="middle"> <?=$row->no_hp ?></td>
    <td valign="middle"> <?=$row->jk ?></td>
    <td valign="middle"> <?=$row->usia ?></td>
    <td valign="middle"> <?=$row->alamat ?></td>
    <td valign="middle"> <?=$row->tanggal_konsultasi ?></td>
    <td valign="middle"> <?=$row->hasil_konsultasi ?></td>
    <td align="center" valign="middle"><?=$row->kepercayaan ?>%</td> 
    <td align="center" valign="middle" class="nw">
            <a class="btn btn-xs btn-danger" href="aksi.php?act=laporan_hapus&ID=<?=$row->id?>" onClick="return confirm('Hapus data?')"><span class="glyphicon glyphicon-trash"></span></a>
        </td>
  </tr>
  <?php endforeach;
    ?>
</table>
</div></div>
</body>