<?php require_once('header.php'); ?>
<section class="content-header">
    <div class='box-body' style="margin: 0px 0px;box-shadow: rgba(0, 0, 0, 0.19) 0px 10px 20px, rgba(0, 0, 0, 0.23) 0px 6px 6px;background-color: white;">
    <div class="row">
		<div class="col-md-4" style="text-align: left;">
			<h4><i class="fa fa-list"></i> Client Rate Chart Details</h4>
		</div>
		<div class="col-md-8" style="text-align: right;"> 
		    <a href="booking-list.php" class="btn btn-primary btn-sm"><i class="fa fa-arrow-left"></i> Back to Home</a>
		</div>
	</div>     
        
        
    <div class="row">
        <div class='col-md-3 col-sm-6'>
                <label for="to">Select Branch:</label>
                    <select class="form-control select2" name="branch_id" id="branch_id">
                    </select>
        </div>
        <div class='col-md-3 col-sm-6'>
                <label for="to">Select Client:</label>
                    <select class="form-control select2" onchange="client_changed()" name="client_id" id="client_id">
                    </select>
        </div>
    </div>
      
    </div>
</section>
<section class="content-header">
    
    <div class='box-body' id="rate_content" style="margin: 0px 0px;box-shadow: rgba(0, 0, 0, 0.19) 0px 10px 20px, rgba(0, 0, 0, 0.23) 0px 6px 6px;background-color: white;">
        
    </div>
    
</section>


<style>
    th{
        padding:2px 4px;
        background:#f39c12;text-align:center;
    }
    table{
        padding:2px 2px;
        font-size:12px;
    }
</style>




<?php require_once('footer.php'); ?>

<script>
$(document).ready(function() {
    get_branch();
    $('#branch_id').on('change', function(){
            get_client();
    });
});
function get_branch(){
    $('#branch_id').empty();
    $.ajax({
        url: 'apis/get-drop-down-list.php',
        type: 'post',
        data: {type:'get_branch_dropdown'},
         success:function(response){
            $('#branch_id').empty();
            $('#branch_id').append(response);
            get_client();
        }
    });
}
function get_client(){
    $('#client_id').empty();
    var branch_id=$('#branch_id').val();
    $.ajax({
        url: 'apis/get-drop-down-list.php',
        type: 'post',
        data: {type:'get_client_dropdown_rate_chart',branch_id:branch_id},
         success:function(response){
            $('#client_id').empty();
            $('#client_id').append(response);
            client_changed();
        }
    });
}
function client_changed(){
    var link="apis/rate-chart-ui.php?client_id="+$('#client_id').val();
    $("#rate_content").load(link);
}


</script>