<?php include "../koneksi.php"; ?>
<table class="table table-bordered">
		<tr>
			<th width="5%">
				#
			</th>
			<th width="30%">
				LOT
			</th>
			<th width="20%">
				BAG
			</th>
			<th width="10%">
				Quantity
			</th>
			<th width="15%" >
				Opsi
			</th>
		</tr>
			<?php 
				$no = 1;
				$data = mysqli_query ($koneksi, " SELECT pbb.PBB_ID,
														pbb.IncomingID,
														incoming.Date_Inc,
														incoming.MaterialID,
														material.NoMat,
														material.Qty,
														pbb.Lot,
														pbb.Bag
													FROM pbb
													INNER JOIN incoming
													ON pbb.IncomingID=incoming.IncomingID
													INNER JOIN material
													ON incoming.MaterialID=material.MaterialID
													WHERE pbb.IncomingID='$_GET[id]'");
				
	

				while($row = mysqli_fetch_array ($data)): ?>
		<tr>
			<td width="5%">
				<?php echo $no++; ?>
			</td>
			<td width="30%">
				<?php echo $row['Lot']; ?>
			</td>
			<td width="20%">
				<?php echo $row['Bag']; ?>
			</td>
			<td width="15%">
				<?php echo date ("d-m-Y", strtotime( $row['Date_Inc'])); ?>
			</td>
			<td width="10%">
				<?php echo $row['Qty']; ?>
			</td>
			<td width="15%">
				<a href="#" style="color: #DC143C" data-href="hapus_stpj.php?id=<?php echo $row['PBB_ID']; ?>&plan_id=<?php echo $row['IncomingID']; ?>" data-toggle="modal" data-target="#confirm-delete"><i class="bi bi-trash-fill"></i> Hapus</a> 
			</td>
		</tr>
			<?php endwhile; ?>
	</table>


		<!-- Modal -->
		<div class="modal fade" id="confirm-delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-sm">
            <div class="modal-content">
            
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">Kofirmasi Hapus</h4>
                </div>
            
                <div class="modal-body">
                    <p>Apakah anda mau melanjutkan menghapus data?</p>
                    <p class="debug-url"></p>
                </div>
                
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                    <a class="btn btn-danger btn-ok">Delete</a>
                </div>
            </div>
        </div>
    </div>

	<script>
        $('#confirm-delete').on('show.bs.modal', function(e) {
            $(this).find('.btn-ok').attr('href', $(e.relatedTarget).data('href'));
            
        });
    </script>
