<?php
	require_once("koneksi.php");
    include 'header.php';
?>

	<!-- breadcrumbs -->
		<div class="breadcrumbs">
			<div class="container">
				<ol class="breadcrumb breadcrumb1">
					<li><span><i class="fa fa-sign-in" aria-hidden="true"></i><a href="login.php"> Masuk</a></span></li>
					<li class="active">Kelola Data Pelanggan</li>
				</ol>
			</div>
		</div>
	<!-- //breadcrumbs -->
	<!-- Page -->
		<?php 
			$per_hal		= 10;
			$jumlah_record	= mysqli_query($koneksi, "SELECT * FROM t_user WHERE role=2");
			$no 			= 1;
			$jum 			= mysqli_num_rows($jumlah_record);
			$halaman 		= ceil($jum / $per_hal);
			$page 			= (isset($_GET['page'])) ? (int)$_GET['page'] : 1;
			$start 			= ($page - 1) * $per_hal;
		?>
	<!-- //Page -->
		<div class="col-md-12">
			<table class="col-md-3">
				<tr>
					<br>
					<td>Jumlah Pelanggan</td>		
					<td>: <b><?php echo $jum; ?></b></td>
				</tr>
			</table>
		</div>
	<!-- checkout -->
			<div class="container"><br><br><br>
				<h2>Daftar Pelanggan : </h2><br>
				<div class="checkout-right">
					<table class="timetable_sub">
						<thead>
							<tr>
								<th>ID Pelanggan</th>
								<th>Nama Lengkap</th>
								<th>Alamat</th>
								<th>Nomor Ponsel</th>
								<th>Email</th>
								<th>Opsi</th>
							</tr>
						</thead>
						<?php
						 	$tampil = mysqli_query($koneksi, "SELECT * FROM t_user WHERE role = 2 LIMIT $start, $per_hal"); 
							while($data = mysqli_fetch_array($tampil)) {	
						?>
						<tr class="rem1">
							<td class="invert"><?php echo $data['id_user']; ?></td>
							<td class="invert"><?php echo $data['nama_lengkap']; ?></td>
							<td class="invert"><?php echo $data['alamat']; ?></td>
							<td class="invert"><?php echo $data['nomor_ponsel']; ?></td>
							<td class="invert"><?php echo $data['email']; ?></td>
							<td class="invert">
								<div class="rem">
									<div>
						                <a href='deleteprofile_process.php?id=<?php echo $data['id_artikel']; ?>' }">
						                	<img src="images/close_1.png" />
						                </a>
									</div>
								</div>
							</td>
						</tr>
						<?php
							}
						?>
						<?php
							if(	isset($_SESSION['administrator'])){
								echo '	';
							}
							else {
								echo '
									<tr><td colspan="7" align="center" style="background-color:#ffffff"> Data pelanggan kosong ! </td></tr></table>
								';
							}
						?>
					</table>
				</div>
			<nav class="numbering">
				<ul class="pagination paging">
					<li>
						<?php 
							for($page=1;$page<=$halaman;$page++){
								?>
								<li><a href="?page=<?php echo $page ?>"><?php echo $page ?></a></li>
								<?php
							}
						?>
					</li>
					<!--<li>
						<a href="?page=<?php echo $x++ ?>" aria-label="Next">
						<span aria-hidden="true">&raquo;</span>
						</a>
					</li>-->
					<br><br><br>
				</ul>
			</nav>		
		</div>
	<!-- //checkout -->

<?php
	include 'footer.php';
?>