<?php
	include('common/header.php');	
?>
<style>
	.autocomplete {
	  position: relative;
	 
	}
	.autocomplete-items {
	 /* position: absolute;*/
	  border: 1px solid #d4d4d4;
	  border-bottom: none;
	  border-top: none;
	  z-index: 99;
	  top: 100%;
	  left: 0;
	  right: 0;
	}
	.autocomplete-items div {
	  padding: 10px;
	  cursor: pointer;
	  background-color: #fff; 
	  border-bottom: 1px solid #d4d4d4; 
	}
	.autocomplete-items div:hover {
	  background-color: #e9e9e9; 
	}
	.autocomplete-active {
	  background-color: DodgerBlue !important; 
	  color: #ffffff; 
	}
	</style>
	<div class="">
		<div class="col-xm-12">
			<div class="widget-box light-border">
				<!-- <div class="widget-header header-color-grey">
					<h4 class="smaller">
						Refill Sale Data
					</h4>
				</div> -->
				<div class="widget-body">
					<div class="widget-main">
						<div class="row">
							<div class="col-sm-12">
								<form class="form-horizontal" role="form" name="module_form" id="module_form" method="post" action="<?php echo base_url()?>index.php/<?php echo REFILL_SALES_DATA;?>search_refill_sale" onsubmit="return validate_form();">
								<div class="">
									<!-- PAGE CONTENT BEGINS -->

								<div class="form-group">  
										<label class="col-sm-5 control-label" for="form-field-2" ><?php echo 'Branch Name';?><font style="color:red"></font>*</label>
										<div class="col-sm-7">	
											<select name="branch_id" id="branch_id" onchange="get_sale_person(this.value);" required  style="width:262px">
												<option value="0">Select Branch Name</option>
												<?php foreach ($branch as  $value) {?>
													<option value="<?php echo $value['company_branch_id'];?>"><?php echo $value['company_branch_name']; ?></option>
												<?php } ?>
											</select>
											 <span id="branch_id_error" class="text-danger font-weight-bold"></span>
										</div>
									</div>															
                           		<div class="form-group">
                            	 <label for="client_code" class="col-sm-5 control-label required"><?php echo $lable_refill_sale_data_customer_name; ?>:<font style="color:red"></font></label>
                                	<div class="col-sm-7">
                                     	<!-- <?php
										 $customer_array_data='';
									     $js1 = 'class="select2 select2-multiple form-control" name="customer_id" id="customer_id" multiple="multiple" style="width: 261px;" data-placeholder="Choose"';
									         echo form_dropdown('customer_id', $customer_array_data,'', $js1);
									    ?> -->
									    <select class="select2 select2-multiple form-control" name="customer_id" multiple="multiple" value="" id="customer_id" style="width: 250px;" >
									
								    </select>
									    <span id="customer_id1" class="text-danger font-weight-bold"></span>
                                    </div>	
                                </div>
                      
								<div class="form-group">  
								  <label class="col-sm-5 control-label" for="form-field-2" ><?php echo $lable_refill_sale_data_refill_due_for; ?><font style="color:red">*</font></label>
										<div class="col-sm-7">	
											<select style="width:262px;" name="dues" id="dues" required>
												<!-- <option value="default">Select Refill Due for</option> -->
												<option value="10" selected>Todays refill due</option>
												<option value="1">All previous refill due</option>
												<option value="7">Next 7 days refill due</option>
												<option value="15">Next 15 days refill due</option>
												<option value="30">Next 30 days refill due</option>	
											</select>
										</div>
								</div>

								</div>
								
							</div>
						</div>
					</div>	
				</div>
			</div>
		</div>
		<!-- /.col -->
	</div>
	<div class="clearfix form-actions">
		<div class="col-md-offset-5 col-md-5">
			
			<button class="btn btn-info" type="submit">
				Submit
			</button>
		</div>
	</div>
	</form>	
	<div class="space-4"></div>
		<!-- /.page-row -->
        <!-- /.page-content --> 
    </div>
    <!-- /.main-content --> 
	</div>
    <!-- /#ace-settings-container --> 
	</div>
	<!-- /.main-container-inner --> 

<?php
	include('common/footer.php');
?>
<script>
function hide()
{
	document.getElementById("admin_type_code").style.display="none";
}
function show()
{
	document.getElementById("admin_type_code").style.display="";
}
</script>
<!-- <script type="text/javascript">
$(document).ready(function() {
    $('form:first *:input[type!=hidden]:first').focus();
   
    $('.select2').select2()
    
    $(".select2").prop("multiple", "multiple");

  
 //    $('#customer').change(function(){
 //    $.ajax({
 //    url:"<?php echo base_url();?>index.php/gc/refill_sale_data/fetch_customer",
 //    method:"POST",
 //    success:function(data)
 //    {

 //      $('#customer').html(data);

 //    }
 //   });

  
 // });
});
</script> -->
 <script type="text/javascript">
	
	function validate_form()
	{
		var branch_id = $('#branch_id').val();
		 if(branch_id=="0")
		 {
			$("#branch_id_error").html("Select Branch Name");
			return false;
		 }
		 else
		 {
			$("#branch_id_error").html("");
		 }
		 
		
	}
	
 
    $('.select2').select2();
     $(".select2").prop("multiple", "multiple");

    
      $("#customer_id").select2({
		 tags: true,
		multiple: false,
		//tokenSeparators: [',', ' '],
		minimumInputLength: 3,
		minimumResultsForSearch: 10, 
		ajax: {
			url: '<?php echo base_url();?>index.php/gc/refill_sale_data/customer',
			dataType: "json",
			type: "POST",
			data: function (params) {

				var queryParameters = {
					customer_id: params.term
				}
				return queryParameters;
			},
			processResults: function (data) {
				return {
				  results: data
				};
			}
		}
	});
   
</script>
