<?php
	include "header.php";
	include "../koneksi.php";
?>
<div class="row">
<div class="col-md-6">
<div class="form-group">
    <label>Date :</label>
    <input type="text" class="input-tanggal" id="tgl" name="tgl" data-date-format="yy-mm-dd" placeholder="Masukkan Tanggal..">
	<select id="week" name="week">
		<option selected>Plan Week</option>
		<?php 
		
		$data = mysqli_query ($koneksi, " SELECT DISTINCT Week FROM plan order by Week DESC");
		while ($row = mysqli_fetch_array ($data))
		{
		?>
		<option value="<?php echo  $row['Week']; ?>">Week: <?php echo $row['Week']; ?></option>
		<?php } ?>
	</select>
	<select id="week1" name="week1">
		<option selected>Delivery Week</option>
		<?php 
		$data1 = mysqli_query ($koneksi, " SELECT DISTINCT Week FROM deliverytbl order by Week DESC");
		while ($row1 = mysqli_fetch_array ($data1))
		{
		?>
		<option value="<?php echo  $row1['Week']; ?>">Week: <?php echo $row1['Week']; ?></option>
		<?php } ?>
	</select>
	
</div>

</div>
<div class="col-md-6">
	 <nav>
    <ol class="breadcrumb">
		<li class="breadcrumb-item">Dashbard</li>
        <li class="breadcrumb-item">Table Planning & Delivery</li>
    </ol>
</nav>
</div>
</div>
<div style="width:100%;height100px;overflow:scroll;" >
<div id="container1" style="position: relative; z-index: 1;"></div>
</div>
<div class="row">
<div class="col-md-6">
</div>
<div class="col-md-6">
</div>
</div>
<div style="width:100%;height100px;overflow:scroll; margin-top: 20px;" >
<div id="container2" style="position: relative; z-index: 1;"></div>
</div>

<link rel="stylesheet" type="text/css" href="../style/jquery-ui.css">
<script type="text/javascript" src="../style/jquery-ui.js"></script>
	<script>
    $(document).ready(function(){
		$('.input-tanggal').datepicker({
			dateFormat: 'yy-mm-dd'
		});		
	});	

	$('#tgl').on('change', function(){
		$.get('data_plan.php?tgl=' + $('#tgl').val(), function(data) {
				//fungsi eksekusi func. Ajax
				$('#container1').html(data);
		});
	  });
	  
	$('#week').on('change', function(){
		$.get('data_plan.php?week=' + $('#week').val(), function(data) {
				//fungsi eksekusi func. Ajax
				$('#container1').html(data);
				$('#container2').html('');
		});
	  });
	
	  $('#week1').on('change', function(){
		$.get('data_del.php?week=' + $('#week1').val(), function(data) {
				//fungsi eksekusi func. Ajax
				$('#container1').html('');
				$('#container2').html(data);
		});
	  });

	$('#tgl').on('change', function(){
		$.get('data_del.php?tgl=' + $('#tgl').val(), function(data) {
				//fungsi eksekusi func. Ajax
				$('#container2').html(data);
		});
	  });

    </script>

