<?php
include "koneksi.php";
if (!isset($_SESSION["UserID"])) {
	header("location:login.php?p=3");
}
$q="SELECT * FROM user WHERE id='". $_SESSION["UserID"] ."'";
						$res=mysqli_query($conn,$q);
						$dataUser=mysqli_fetch_assoc($res);
					
						$nik = $dataUser["nik_data_karyawan"];
						$level_spv = $dataUser["level_spv"];
						$status = $dataUser["status"];

?>
<!DOCTYPE html>
<link rel="stylesheet" type="text/css" href="style.css">
<html>

	<head>
		<title> PT. MULTI HIDRACHROME BALIKPAPAN </title>
		<link rel="icon" type="image/png" href="images/mhb.jpeg">
								<?php
						include "part/menu2.php";
					?>
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<?php
		include "part/jss.php";
		?>

	</head>

	<body>

		<div style="width:1280px; height:220px" class="container" >

			
				<div class="alert alert-info" style='background-color:#F8F8FF' href="#">
				<div style="display: block; margin-left: auto; margin-right: auto; width: 1000px;  height:100px;"><img style="width: 1000px;  height:180px;" src="images/hd.jpg"></div>
				<div>
					<center>
						<h1>PT. MULTI HIDRACHROM BALIKPAPAN</h1>
					</center>
				</div>
				<div>
					<center>
						<h4 >PROFESIONAL INFORMATION SYSTEM</h4>
					</center>
				</div>
			</div>
				<div class="alert alert-info" align='center' >
					<h3>ALL DATA INSPECT AND TESTING</h3>
					<h5>menampilkan map komponen</h5>
					<?php
					if (isset($_GET["p"])) 
					{
						$p = $_GET["p"];
						if ($p == "1") 
						{
						?>
						<div class="alert alert-primary">
							PR DISETUJUI!
						</div>
						<?php
						} 
						else if ($p == "2") 
						{
						?>
							<div class="alert alert-danger">
								PR DITOLAK!
							</div>
						<?php
						}
						else if ($p == "3") 
						{
						?>
							<div class="alert alert-danger">
							    KESALAHAN TEKNIS!
							</div>
						<?php
						}
					}
					?>
					<?php
					$z = 1;
					?>
					<table class="table table-bordered">
						<thead>
							<tr>
							    <th>
									NO 
								</th>
							    <th>
									NO WO 
								</th>
								<th>
									NO MHB ID
								</th>
								<th>
									PART NUMBER
								</th>
								<th>
									NAMA CUSTOMER
								</th>
								<th>
									NAMA KOMPONEN
								</th>
								<th>
									JENIS BARANG
								</th>
								
								<th>
									POSISI BARANG
								</th>
								<th>
									FOTO
								</th>
								<th>
									
								</th>
							</tr>
						</thead>
						<tbody>

							<?php
							$status = '0';
							$q = "SELECT * FROM barang_job";
							$res = mysqli_query($conn, $q);
							while ($row = mysqli_fetch_assoc($res)) {
							?>
								<tr>
									<td>
									     <?php
									         echo $z;
									         $z = $z + 1;
											 //echo $row["id"];
									     ?>
								    </td>
									<td>
										<?php
										echo $row["no_wo"];
										?>
									</td>
									<td>
										<?php
										echo $row["no_mhb_id"];
										?>
									</td>
									
									<td>
										<?php
										echo $row["part_number"];
										?>
									</td>
									<td>
										<?php
										echo $row["nama_customer"];
										?>
									</td>
									<td>
										<?php
										echo $row["nama_komponen"];
										?>
									</td>
									<td>
										<?php
										$row["jenis_barang"];
										if ($row["jenis_barang"] == 1)
										{
											echo "Single";
										}
										else if ($row["jenis_barang"] == 2)
										{
											echo "Assy";
										}
										else if ($row["jenis_barang"] == 2)
										{
											echo "Parsial";
										}
										?>
									</td>
									<td>
										<?php
										$row["status"];
										if ($row["status"] == 0)
										{
											echo "Belum disetujui";
										}
										else if ($row["status"] == 2)
										{
											echo "Taging";
										}
										else if ($row["status"] == 1)
										{
											echo "Reciving";
										}
										else if ($row["status"] == 3)
										{
											echo "Cleaning And DAT Proses";
										}
										else if ($row["status"] == 4)
										{
											echo "QC Inspect";
										}
										else if ($row["status"] == 5)
										{
											echo "Selesai Taging QC Inspect";
										}
										?>
							
									</td>
									<td>
										<?php
										echo "<img src='Receiving/".$row['nama_gambar']."' width='100' height='100'>";
										?>
									</td>
									  <td>	
									  	 <a href="detailBarangJob.php?id=<?php echo $row["id"]; ?>"    type="button" class="btn btn-danger"   >DETAIL</a>
									  </td>
								</tr>
							<?php
							}
							?>
						</tbody>
					</table>
					

				</div>

		<center><h5 class="form-signin">Copyright &copy; <a href="#" data-toggle="modal" data-target="#contact">SatrioPringgondani</a></h5></center>  
	</body>
</html>

<script>
$(document).ready(function()
{
	 $('.table-bordered').DataTable();
});
</script>