<?php
    include('loginsession.php');
    error_reporting(E_ALL);
    $filename = __FILE__;  //---Nama file saat ini
    if (strlen(__FILE__) > 48) {$filename = substr(__FILE__, 48);}
    $save = mysqli_query($conn, "INSERT INTO novia_abc_user_logs (userid,filename) VALUES ('$userini_id','$filename')");
//-------------
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//ID" "http://www.w3.org/TR/html4/frameset.dtd">
<html lang="id">
<head>
	<title>Pasien Daftar Online</title>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" href="css/style.css">
	<link href="images/balance.ico" rel="icon" type="image/icon" />

	<style>
		a { text-decoration: none; color:inherit;}
		a:hover {color:#FF00FF;}   /* Mouse over link */
		input[type=text],input[type=password]
		{
		width:60%;
		padding:8px;
		margin-top:8px;
		margin-bottom:8px;
		border:1px solid #ccc;
		padding-left:5px;
		font-size:18px;
		}

		input[type=submit]
		{
		width:35%;
		background-color:#8baca4;
		color:#FFFFFF;
		border:2px solid #8baca4;
		padding:6px;
		font-size:18px;
		cursor:pointer;
		border-radius:5px;
		}	
    </style>	
</head>

<body>

<?php 
$cari ='';
if(isset($_GET['cari'])){
	$cari = $_GET['cari'];
}
?>

	<table width="100%" cellpadding="5">
		<tr class="dua">
			<td><a href="visit-yearly.php?tanggal=<?php echo date("Y-m-d");?>" title="Lihat Pasien Tahun ini"><button style="padding : 10px; width:100%; background-color:#8baca4;">PASIEN TAHUN INI</button></a></td>
			<td><a href="visit-monthly.php?tanggal=<?php echo date("Y-m-d");?>" title="Lihat Pasien Bulan ini"><button style="padding : 10px; width:100%; background-color:#8baca4;">PASIEN BULAN INI</button></a></td>
			<td><a href="visit-daily.php?tanggal=<?php echo date("Y-m-d");?>" title="Lihat Pasien Hari ini"><button style="padding : 10px; width:100%; background-color:#8baca4;">PASIEN HARI INI</button></a></td>
		</tr>
		<tr class="dua">
			<td><a href="index.php" title="Masukkan data pasien baru ke database"><button style="padding : 10px; width:100%; background-color:#8baca4;"> HOME </button></a></td>
			<td><a href="administrasi.php" title="Administrasi"><button style="padding : 10px; width:100%; background-color:#8baca4;">NAVIGASI</button></a></td>
			<td><a href="cash/cash-main.php" title="Lihat Keuangan Hari ini"><button style="padding : 10px; width:100%; background-color:#8baca4;">KEUANGAN</button></a></td>
		</tr>

	</table>
	<table width="100%" cellpadding="5">
		<tr class="dua">
			<td colspan="4" style="padding-top : 10px;">
				<form action="index.php" method="get" align="center">
					<input type="text" name="cari" size="15" maxlength="15" placeholder=<?php echo $cari ?>>
					<input type="submit" value="Lacak">
				</form>
			</td>
		</tr>
	</table>



<table width="100%" cellpadding="5">
	<tr class="head">
		<th width="44">ID</th>
		<th width="150">Nama</th>
		<th width="100">Telepon</th>
		<th>Alamat</th>
		<th width="110">Kecamatan</th>
		<th width="110">Kota</th>
		<th width="30">Email</th>
	</tr>

<?php 
$no = 1;
$sty = 1;
$sql = "SELECT * FROM novia_abc_onlineform ORDER BY id DESC";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
    while($row = $result->fetch_assoc()) {
		$no++;
		$y = 2;
		$result1 = fmod($no,$y);
		if ( $result1 == 0 ) $sty = "dua";
		if ( $result1 == 1 ) $sty = "satu";
		//Script Umur
			//$sa = date("Y");
			//$si = $row["birthday"];
			//$dti = new DateTime($si);
			//$currdate_ = $dti->format('Y');
			//$umur = $sa-$currdate_;
			//if ($umur > 150) $umur1 = "";
			//if ($umur < 150) $umur1 =  " (".$umur.")";
		//--------
		
		?>
		<tr class=<?php echo $sty; ?>>
			<td width="44" align="center"><a href="online_to_biodata.php?id=<?php echo $row["id"];?>" title="Lihat detail pasien"><?php echo $row["id"]; ?></a></td>
			<td width="150"><a href="online_to_biodata.php?id=<?php echo $row["id"];?>" title="Lihat detail pasien"><?php echo $row["name"]." ".$row['mark'] ?></a></td>
			<td width="100"><a href="online_to_biodata.php?id=<?php echo $row["id"];?>" title="Lihat detail pasien"><?php echo $row["phone_wa"]; ?></a></td>
			<td><a href="online_to_biodata.php?id=<?php echo $row["id"];?>" title="Lihat detail pasien"><?php echo $row["street_address"]; ?></a></td>
			<td width="110"><a href="online_to_biodata.php?id=<?php echo $row["id"];?>" title="Lihat detail pasien"><?php echo $row["kecamatan"]; ?></a></td>
			<td width="110"><a href="online_to_biodata.php?id=<?php echo $row["id"];?>" title="Lihat detail pasien"><?php echo $row["city"]; ?></a></td>
			<td width="30" align="center"><a  href="online_to_biodata.php?id=<?php echo $row["id"];?>" title="Lihat detail pasien"><?php echo $row["email"]; ?></a></td>
		</tr>
		<?php
    }
} else {
    echo "0 results";
}
?>
</body>
</html>
