<?php  
	session_start();
	// ini untuk menyambungkan ke file lain
	include 'konek.php';

	// $admin = mysqli_query($conn, "SELECT * FROM admin WHERE vehicle_id = '".$_GET['id']."' ");
	// $a = mysqli_fetch_object($admin);
?>



<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Fixit - Explore new horizons</title>
	<link rel="stylesheet" type="text/css" href="profil.css">
	<link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
	
    <style>
        /* CSS */
        .btn {
        display: inline-block;       /* biar bisa di-set padding/width */
        padding: 0.6rem 1.2rem;      /* atur tinggi & lebar */
        background-color: #333;      /* warna dasar */
        color: #fff;                 /* warna teks */
        text-decoration: none;       /* hilangin underline */
        border-radius: 4px;          /* sudut melengkung */
        font-weight: 600;            /* teks agak tebal */
        transition: background 0.2s; /* efek hover halus */
        }

        .btn:hover {
        background-color: #555;      /* sedikit lebih terang pas hover */
        }
    </style>
</head>

<body>
	<!-- header -->
	<header>
		<div class="container">
	<h1><a href="database.php">FIXIT</a></h1>
	<ul>
		<li><a href="admin-testdrive.php">Test Drive</a></li>
		<li><a href="admin.php">Customers</a></li>
		<li><a href="supplier.php">Supplier</a></li>
		<!-- <li><a href="admin-logout.php">Logout</a></li> -->
	</ul>
	</div>
	</header>

	<!-- container -->

<div class="section">
	<div class="container">
		<h3>Data Supplier</h3>
		<div class="box">
			<!-- <p><a href="admin-add-supplier.php">Add Supplier Data</a></p><br> -->
			<p style="padding-bottom: 12px;"><a href="admin-add-supplier.php" class="btn">Add Supplier data</a></p>

			<table border="1" cellspacing="0" class="table">
				<thead>
					<tr class="tr">
						<th>No</th>
						<th>Supplier ID</th>
						<th>Vehicle ID</th>
						<th>Supplier Name</th>
						<th>Supplier Address</th>
						<th>Supplier Phone Number</th>
						<th>Supplier Email</th>
						
					</tr>
				</thead>
				<tbody>

					<?php
						// untuk memulai data dari angka 1
						$no = 1;
						// memilih data sesuai dari database
					 	$tayangan = mysqli_query($conn, "SELECT * FROM supplier LEFT JOIN admin USING (vehicle_id) ORDER BY supplier_id DESC");
					 	// while($row = mysqli_fetch_assoc($tayangan))
					 	while ($row = mysqli_fetch_array($tayangan)) {
					 	 ?>
					 	
					<tr>
						<td><?php echo $no++ ?></td>
						<td><?php echo $row['supplier_id'] ?></td>
						<td><?php echo $row['vehicle_id'] ?></td>
						<td><?php echo $row['name'] ?></td>
						<td><?php echo $row['address'] ?></td>
						<td><?php echo $row['phone_number'] ?></td>
						<td><?php echo $row['email'] ?></td>
					</tr>
					<?php } ?>
				</tbody>
			</table>
		
		</div>
	</div>
</div>



	<!-- footer -->
<footer>
	<div class="container" >
		<small>Copyright & copy; 2023 - FIXIT.</small>
	</div>
</footer>

	
</body>
</html>