<!DOCTYPE html>
<html lang="en">
<head>
	<?php $this->load->view("includes/header");?>
</head>

<body>
	<?php $this->load->view("includes/menu");?>
	
	<section class="content">
		<?php $this->load->view("includes/nav");?>
		
		<div class="wraper container-fluid xs_container-fluid">
<!--			<div class="page-title"> -->
<!--				<h3 class="title">Panels</h3> -->
<!--			</div>-->
			
			<div class="row">
				<div class="col-md-offset-2 col-md-8">
					<?php $this->load->view("includes/success_msg");?>
					
					<div class="panel panel-default xs_panel" style="padding-left: 10px; padding-right: 10px;">
						<div class="panel-heading">
							<center>
								<h3 class="panel-title">
									<i class="fa fa-hourglass-half fa-fw"></i>
									Email Log
								</h3> 
							</center>
							<div class="pull-left" style="margin-top: -20px;">
								<!--  -->
								<a href="<?php echo base_url($this->router->fetch_class()."/"."?".$this->session->flashdata($this->router->fetch_class().'_page_filter'));?>" class="visible-xs" style="margin-left: 10px; color: #797979;">
									<i class="fa fa-chevron-left "></i>
								</a>
								<a href="<?php echo base_url($this->router->fetch_class()."/"."?".$this->session->flashdata($this->router->fetch_class().'_page_filter'));?>" class="hidden-xs btn btn-primary btn-xs">
									<i class="fa fa-arrow-left"></i>
									Back
								</a>
								<!--  -->
							</div>
						</div>
						<div class="panel-body">
							<div id="edit_ajax_container"><!-- AJAX --></div>
						</div>
					</div>
				</div>
			</div>
		</div>
	
		<?php $this->load->view("includes/footer");?>
	</section>
	
	<script type="text/javascript">
		$(document).ready(function(){
//			$(".select2").select2();

			edit_load_data("<?php echo $id;?>");
		});

		//Global Variables---
		var timer_check_unique;
		var checking_unique;
		//-------------------

		function edit_load_data(id){
			disable_btn("#edit_btn_submit");
			
			//Loader---
			$("#edit_ajax_container").html("<?php echo $this->text_ajax_loader;?>");
			//---------
			
			var title = id == 0? "New":"Edit";
			$("#edit_h4_title").html(title);
		
			$.ajax({
				type: "POST",
				url: "<?php echo base_url($this->router->fetch_class());?>/load_edit",
				data: "ID="+id,
				success: function(result, status, xhr){
					$("#edit_ajax_container").html(result);
					enable_btn("#edit_btn_submit");
				},
				error: function(xhr,status,error){
					$("#edit_ajax_container").html("<?php echo $this->text_ajax_fail;?>");
				},
				complete: function(xhr,status){
				},
			});
		}
	</script>
</body>
</html>
