 <?php 
 if($_POST)
 {
	$notify_name 			        =		set_value('notify_name',$_POST['notify_name']);
	$notify_addr1 			        =		set_value('notify_addr1',$_POST['notify_addr1']);
	$notify_addr2 			        =		set_value('notify_addr2',$_POST['notify_addr2']);
	$notify_addr3 			        =		set_value('notify_addr3',$_POST['notify_addr3']);
	$notify_addr4 			        =		set_value('notify_addr4',$_POST['notify_addr4']);
	// $notify_country_id 			    =		set_value('notify_country_id',$_POST['notify_country_id']);
	// $notify_state_id 			    =		set_value('notify_state_id',$_POST['notify_state_id']);
	// $notify_pin 			            =		set_value('notify_pin',$_POST['notify_pin']);
	$notify_con_person 			    =		set_value('notify_con_person',$_POST['notify_con_person']);
	$notify_con_no 			        =		set_value('notify_con_no',$_POST['notify_con_no']);
	$notify_alt_no 			        =		set_value('notify_alt_no',$_POST['notify_alt_no']);
	$notify_fax 			            =		set_value('notify_fax',$_POST['notify_fax']);


}
else
{
	$notify_name 			        =		'';
	$notify_addr1			        =		'';
	$notify_addr2 			        =		'';
	$notify_addr3			        =		'';
	$notify_addr4 			        =		'';
	// $notify_country_id			    =		'';
	// $notify_state_id 			    =		'';
	// $notify_pin			            =		'';
	$notify_con_person 			    =		'';
	$notify_con_no			        =		'';
	$notify_alt_no 			        =		'';
	$notify_fax			            =		'';
	
	
}
 ?>
 <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="add_notify" name="add_notify" action="<?php echo base_url();?>General_masters/add_notify" method="post">
    	<div class="col-md-4">
            <!-- <div class="form-group">
                <label>Parent Ledger Group Name</label><?php echo form_error('parent_id');?>
                <select class="form-control select2" id="parent_id" name="parent_id">
                	<option value="">Select Parent Ledger Group Name</option>
                  	<?php foreach($ledger_drpdwn as $row)
                  	{?>
                  		<option value="<?php echo $row['ledger_group_id'];?>" <?php if($parent_id==$row['ledger_group_id'])echo "selected";?>><?php echo $row['ledger_group_name'];?></option>
                  	<?php }?>                	
                </select>             
            </div> -->
	        <div class="form-group">
	            <label>Notify Name</label><?php //echo form_error('notify_name');?>
	            <input type="text" class="form-control" placeholder="Enter Notify Name..." id="notify_name" name="notify_name" value="<?php echo $notify_name;?>">
	        </div>
	        <div class="form-group">
	            <label>Address Line 1</label><?php //echo form_error('notify_addr1');?>
	            <textarea class="form-control" rows="5" placeholder="Enter Address Line 1..." id="notify_addr1" name="notify_addr1"><?php echo $notify_addr1;?></textarea>
	        </div>
	        <div class="form-group">
	            <label>Address Line 2</label><?php //echo form_error('notify_addr2');?>
	            <textarea class="form-control" rows="5" placeholder="Enter Address Line 2..." id="notify_addr2" name="notify_addr2"><?php echo $notify_addr2;?></textarea>
	        </div>

	         <div class="form-group">
	            <label>Address Line 3</label><?php //echo form_error('notify_addr1');?>
	            <textarea class="form-control" rows="5" placeholder="Enter Address Line 3..." id="notify_addr3" name="notify_addr3"><?php echo $notify_addr3;?></textarea>
	        </div>
	        <div class="form-group">
	            <label>Address Line 4</label><?php //echo form_error('notify_addr2');?>
	            <textarea class="form-control" rows="5" placeholder="Enter Address Line 4..." id="notify_addr4" name="notify_addr4"><?php echo $notify_addr4;?></textarea>
	        </div>

	        <!-- <div class="form-group">
                <label>Country</label><?php //echo form_error('notify_country_id');?>
                <select class="form-control select2" id="notify_country_id" name="notify_country_id">
                    <option value="">Select Country</option>
                    <?php foreach($country_drpdwn as $row)
                    {?>
                        <option value="<?php echo $row['country_id'];?>" <?php if($notify_country_id==$row['country_id'])echo "selected";?>><?php echo $row['name'];?></option>
                    <?php }?>                   
                </select>                
            </div>
            <div class="form-group">
                <label>State</label><?php //echo form_error('notify_state_id');?>
                <select class="form-control select2" id="notify_state_id" name="notify_state_id">
                    <option value="">Select State</option>
                    <?php foreach($state_drpdwn as $row)
                    {?>
                        <option value="<?php echo $row['state_id'];?>" <?php if($notify_state_id==$row['state_id'])echo "selected";?>><?php echo $row['state'];?></option>
                    <?php }?>
                </select>
            </div> 
            <div class="form-group">
	            <label>Pincode</label><?php //echo form_error('notify_pin');?>
	            <input type="text" class="form-control" placeholder="Enter Notify PIN..." id="notify_pin" name="notify_pin" value="<?php echo $notify_pin;?>">
	        </div> -->
	        
	       
	        
	    </div>
    	<div class="col-md-4">
	        <div class="form-group">
	            <label>Contact Person</label><?php //echo form_error('notify_con_person');?>
	            <input type="text" class="form-control" placeholder="Enter Contact Person..." id="notify_con_person" name="notify_con_person" value="<?php echo $notify_con_person;?>">
	        </div>
	        <div class="form-group">
	            <label>Contact Number</label><?php //echo form_error('notify_con_no');?>
	            <input type="text" class="form-control" placeholder="Enter Contact Number..." id="notify_con_no" name="notify_con_no" value="<?php echo $notify_con_no;?>">
	        </div>
	        <div class="form-group">
	            <label>Alternate Number</label><?php //echo form_error('notify_alt_no');?>
	            <input type="text" class="form-control" placeholder="Enter Alternate Number..." id="notify_alt_no" name="notify_alt_no" value="<?php echo $notify_alt_no;?>">
	        </div>
	        <div class="form-group">
	            <label>Fax</label><?php //echo form_error('notify_fax');?>
	            <input type="text" class="form-control" placeholder="Enter Fax..." id="notify_fax" name="notify_fax" value="<?php echo $notify_fax;?>">
	        </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/notify"><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 Notify</label></h4>
    		<div class="box box-warning">
			    <table class="table table-bordered table-hover">
			        <thead>
			            <tr>
			                <th>Name</th>
			                <th>Contact Person</th>
			                <th>Contact Number</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_notify/<?php echo $row['notify_id'];?>"><strong><?php echo $row['notify_name'];?></strong></a></td>
		    						<td><?php echo $row['notify_con_person'];?></td>
		    						<td><?php echo $row['notify_con_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/notify"><strong>View All Notify Lists</strong></a>
		    </div>
	    </div>
	</form>
    <!-- /.box-body -->
</div>

<script type="text/javascript">
	$(function()
	{
		setTimeout(country_select);
        setTimeout(state_select);
	});

	function country_select()
	{
		$("#notify_country_id").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()
	{
		$("#notify_state_id").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:$('#notify_country_id').val()
						}
					}
			}
		});
	}

	
</script>