<?php
$alldept = ONLINEPAY:: showdept();
$dprepare ="";
$allsession = ONLINEPAY:: showsession();
$tag = $_GET['type'];
$_SESSION['tablename'] =$tag;
?>
    <div class="container" style="position:relative;">
        <form method="POST" action="#">
            <div class="form-group input-group" align="Right">
                <table class="table table-bordered table-hover" align="center">
                    <tr>
                    <div style="margin-top:5px; border-bottom:2px inset #000">
                        <td>
                            <label style="margin-left:20px" >Department</label>
                            <select id="depart" style="width:100px">
                                <option value="">Choose...</option>
                                <option value="all">All departments</option>
                                <?php foreach($alldept as $dept){?>
                                <option value="<?php echo $dept->department;?>"><?php 
                                $dprepare= strtolower($dept->department);
                                echo ucwords($dprepare);?></option> <?php }?>
                            </select>
                        </td>
                        <td>
                            <label style="margin-left:20px" >Session</label>
                            <select id="sess"  style="width:80px" class="form-control action">
                                <option value="">Choose...</option>
                                <?php foreach($allsession as $session){?>
                                <option value="<?php echo $session->session;?>"><?php echo $session->session?></option>
                                <?php }?>
                            </select>
                        </td>
                        <td>
                            <label  style="margin-left:20px" >Level</label>
                            <select id="lev" class="form-control action">
                                <option value="">Choose...</option>
                                <option value="ND">ND I</option>
                                <option value="ndii">ND II</option>
                                <option value="HND">HND I</option>
                                <option value="hndii">HND II</option>
                            </select>
                        </td>
                        <td>
                            <div class="input-daterange">
                                <div class="col-md-4">
                                    <input type="text" name="start_date" id="start_date" class="form-control" placeholder="From:StartDate"/>
                                </div>
                                <div class="col-md-4">
                                    <input type="text" name="end_date" id="end_date" class="form-control" placeholder="To:EndDate"/>
                                </div>
                            </div>
                            <div>
                                <div class="col-md-4">
                                    <input type="submit" name="search" id ="search" value="Search" class="btn btn-info" />
                                </div>
                            </div>
                        </td>
                    </tr>
                </table>
            
        </form>
        <div id="mytable" style="width:878px; height:470px; overflow:scroll; background-color:; margin-left:8px "> </div>
    </div>
</body>
 
 
  
<script type="text/javascript">
var ptype = <?php echo json_encode($tag);?>;

$(document).ready(function() {
// 	$('#fac').on('change', function(){
// 	if($('#fac').val() != '')
// 		{
// 			var fac = $(this).val();
// 			$('#depart').attr('disabled', 'disabled');
// 		}else {
// 		$('#depart').attr('disabled', 'false');
// 	}
		 
// 	})
	
// 	$('#depart').on('change', function(){
// 	if($('#depart').val() != '')
// 		{
// 			var dpt = $(this).val();
// 			$('#fac').attr('disabled', 'disabled');
// 		}else {
// 		$('#depart').attr('disabled', 'false');
// 	}
		 
// 	})
	
    $('.input-daterange').datepicker({
    todayBtn:'linked',
    format: "yyyy-mm-dd",
    autoclose: true
    });

	 
    $('#search').on("click", function(e){
    e.preventDefault(e);
    
    var dpt =$('#depart').val();
    var lev = $('#lev').val();
    var ses = $('#sess').val();
        {
            $.ajax({
            	url:"admin_paymentpage.php",
            	method:"POST",
            	data:{dpt:dpt,lev:lev,ses:ses},
            	success:function(data)
            	{
            	    alert(data);
            		$('#mytable').html(data);
            	}
            });
        }
 });
    
    
    
});
</script>