 <?php 
 if($_POST)
 {
	$customer_name 			        =		set_value('customer_name',$_POST['customer_name']);
	$customer_addr1 			        =		set_value('customer_addr1',$_POST['customer_addr1']);
	$customer_addr2 			        =		set_value('customer_addr2',$_POST['customer_addr2']);
	$customer_addr3 			        =		set_value('customer_addr3',$_POST['customer_addr3']);
	$customer_addr4 			        =		set_value('customer_addr4',$_POST['customer_addr4']);
	// $customer_country_id 			    =		set_value('customer_country_id',$_POST['customer_country_id']);
	// $customer_state_id 			    =		set_value('customer_state_id',$_POST['customer_state_id']);
	// $customer_pin 			            =		set_value('customer_pin',$_POST['customer_pin']);
	$customer_con_person 			    =		set_value('customer_con_person',$_POST['customer_con_person']);
	$customer_con_no 			        =		set_value('customer_con_no',$_POST['customer_con_no']);
	$customer_alt_no 			        =		set_value('customer_alt_no',$_POST['customer_alt_no']);
	$customer_fax 			            =		set_value('customer_fax',$_POST['customer_fax']);
	 
}
else
{
	$prefix 			        =		$edit_customer->prefix_name;
	$current_no			        =		$edit_customer->current_no;
	
	 
}
 ?>
 <div class="box-body">
 	<div style="color:red;" class="error"><strong><?php if($this->session->flashdata('error')){ echo $this->session->flashdata('error');} ?></strong></div>
     <form role="form" id="edit_customer" name="edit_customer" action="<?php echo base_url();?>General_masters/edit_prefix/<?php echo $customer_id;?>" method="post">
    	<input type="hidden" id="customer_id" name="customer_id" value="<?php echo $customer_id;?>">
    	<div class="col-md-4">
            
	       <!-- <div class="form-group">
                 <label>Company</label>
                 <select class="form-control select2" id="bill_company_id" name="bill_company_id" tabindex="4">
            <!--     <option value="">Select Company</option> -->
                    <?php foreach($company_drpdwn as $row)
                    {?>
                        <!--<option value="<?php echo $row['cmp_id'];?>" <?php if($row['cmp_id']==$bill_company_id)echo "selected";?>><?php echo $row['cmp_name'];?></option>
                <?php }?>
               <!-- <input type="hidden" value="<?php echo $row['cmp_id'];?>" id="bill_company_id" name="bill_company_id">                
                
            </div>-->
			
			
			
	        <div class="form-group">
	            <label>Prefix </label><?php echo form_error('prefix');?>
	            <input type="text" class="form-control" placeholder="Enter Place Of Loading..." id="prefix" name="prefix" value="<?php echo $prefix;?>">
	        </div>


	    </div>
    	<div class="col-md-4">
	        <div class="form-group">
	            <label>Current No</label><?php echo form_error('current_no');?>
	            <input type="text" class="form-control" placeholder="Enter Short Code..." id="current_no" name="current_no" value="<?php echo $current_no;?>">
	        </div>
	        
            <div class="form-group">
            <div class="col-md-6"></div>
            	<div class="col-md-6"><input type="submit" id="submit" name="submit" class="btn btn-info" value="Save">
            	<a href="<?php echo base_url()?>General_masters/prefix"><button type="button" class="btn btn-warning">Cancel</button></a></div>
            </div>
	    </div>
    	<div class="col-md-4 form-group has-warning">
    		<h4><label>Recently Listed Prefix</label></h4>
    		<div class="box box-warning">
			    <table class="table table-bordered table-hover">
			        <thead>
			            <tr>
						<th>Company</th>
						<th>Branch</th>
			                <th>Prefix Name</th>
			               
			                <th>Current No.</th>
							
			            </tr>
			        </thead>
			        <tbody>
	        			<?php if(count($recent_list)!=0)
	        			{
	        				foreach($recent_list as $row)
	        				{?>
		    					<tr>
								<td><?php echo $row['cmp_name'];?></td>
									<td><?php echo $row['branch_name'];?></td>
		    						<td><a href="<?php echo base_url();?>General_masters/edit_prefix/<?php echo $row['prefix_id'];?>"><strong><?php echo $row['prefix_name'];?></strong></a></td>
									
		    						<td><?php echo $row['current_no'];?></td>
		    						
		    					</tr>
	        				<?php }
	        			}
	        			else
	        			{?>
	        				<tr><td colspan="3">Data Not Found</td></tr>
	        			<?php }?>
			        </tbody>
			    </table>
			    <a class="text-red" href="<?php echo base_url();?>General_masters/prefix"><strong>View All prefix Lists</strong></a>
		    </div>
	    </div>
	</form>
    <!-- /.box-body -->
</div>

<script type="text/javascript">
	$(function()
	{
		setTimeout(company_select);
	});
	function company_select()
	{
		$("#branch_cmp_id").select2({
			ajax: { 
				dataType: 'json', 
				url: '<?php echo base_url();?>General_masters/get_company',
				cache: true,
				data: function (params) 
					{
						return {
							q: params.term
						}
					}
			}
		});
	}
</script>