 <?php 
 if($_POST)
 {
	$port_of_dis_name 				=		set_value('port_of_dis_name',$_POST['port_of_dis_name']);
	$port_of_dis_shrt_code 			=		set_value('port_of_dis_shrt_code',$_POST['port_of_dis_shrt_code']);
	
}
else
{
	$port_of_dis_name 				=		$edit_port_of_dis->port_of_dis_name;
	$port_of_dis_shrt_code 			=		$edit_port_of_dis->port_of_dis_shrt_code;

	
}
 ?>
 <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_port_of_dis" name="edit_port_of_dis" action="<?php echo base_url();?>General_masters/edit_port_of_dis/<?php echo $port_of_dis_id;?>" method="post" enctype="multipart/form-data">
    	<input type="hidden" id="port_of_dis_id" name="port_of_dis_id" value="<?php echo $port_of_dis_id;?>">
    	<div class="col-md-4">
	        <div class="form-group">
	            <label>Port Name</label><?php echo form_error('port_of_dis_name');?>
	            <input type="text" class="form-control" placeholder="Enter Port Name..." id="port_of_dis_name" name="port_of_dis_name" value="<?php echo $port_of_dis_name;?>">
	        </div>
	       	

	        
	    </div>
    	<div class="col-md-4">

            	<div class="form-group">
		            <label>Short Code</label><?php echo form_error('port_of_dis_shrt_code');?>
		            <input type="text" class="form-control" placeholder="Enter Short Code..." id="port_of_dis_shrt_code" name="port_of_dis_shrt_code" value="<?php echo $port_of_dis_shrt_code;?>">
		        </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/port_of_dis"><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 Company</label></h4>
    		<div class="box box-warning">
			    <table class="table table-bordered table-hover">
			        <thead>
			            <tr>
			                <th>Name</th>
			                <th>Phone No</th>
			                <th>Email</th>
			            </tr>
			        </thead>
			        <tbody>
	        			<?php if(count($recent_list)!=0)
	        			{
	        				foreach($recent_list as $row)
	        				{?>
		    					<tr>
		    						<td><a href="<?php echo base_url();?>General_masters/edit_company/<?php echo $row['port_of_dis_id'];?>"><strong><?php echo $row['port_of_dis_name'];?></strong></a></td>
		    						<td><?php echo $row['cmp_phone'];?></td>
		    						<td><?php echo $row['cmp_email'];?></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/company"><strong>View All Company Lists</strong></a>
		    </div>
	    </div>-->
	</form>
    <!-- /.box-body -->
</div>
<script type="text/javascript">	
	$(function()
	{
		setTimeout(country_select);
		setTimeout(state_select);
		setTimeout(currency_select);
	});
	function country_select()
	{
		$("#cmp_country").select2({
			ajax: { 
				dataType: 'json', 
				url: '<?php echo base_url();?>General_masters/get_countries',
				cache: true,
				data: function (params) 
					{
						return {
							q: params.term
						}
					}
			}
		});
	}
	function state_select()
	{
		$("#cmp_state").select2({
			ajax: { 
				dataType: 'json', 
				url: '<?php echo base_url();?>General_masters/get_state_by_country',
				cache: true,
				data: function (params) 
					{
						return {
							q: params.term,
							country_id:$('#cmp_country').val()
						}
					}
			}
		});
	}
    function currency_select()
    {
        $("#cmp_currency").select2({
            ajax: { 
                dataType: 'json', 
                url: '<?php echo base_url();?>General_masters/get_currency/',
                cache: true,
                data: function (params) 
                    {
                        return {
                            q: params.term
                        }
                    }
            }
        });
    }
</script>