<?php $pageno = 5; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<?php include('template/head.php'); ?>
	<script type="text/javascript">
	function ValidateForm(){
		var notification_for=document.forms["frmUsers"]["notification_for"].value;
		if (notification_for==null || notification_for=="")
			{
				alert("Please Enter Notification For");
				return false;
			}
		var day=document.forms["frmUsers"]["day"].value;
		if (day==null || day=="")
			{
				alert("Please Enter Days");
				return false;
			}
		if(!validateNumeric(day)){
				alert("Enter a numeric value");
				return false;
			}
		var notification_email=document.forms["frmUsers"]["notification_email"].value;
		if (notification_email==null || notification_email=="")
			{
				alert("Please Enter Notification Email");
				return false;
			}
		
		function validateNumeric(numValue){
		if (!numValue.toString().match(/^[-]?\d*\.?\d*$/)) 
				return false;
		return true;		
		}	
	}
	</script>
</head>
<body>
<?php include('template/header.php'); ?> 
<div class="grid_16" id="navheader">
	<?php include('template/topnav.php'); ?>
</div>
<div class="grid_16" id="tabs">
	<div class="container">
		<ul>
			<li><a href="<?php echo base_url(); ?>index.php/Administrator/NotifyList/" ><span>Notification</span></a></li>
			<li><a href="<?php echo base_url(); ?>index.php/Administrator/Notification/" class="current" ><span>Notification Rules</span></a></li>
		</ul>
	</div>   
</div>
<div class="container_16" id="wrapper">	
    <div class="grid_16" id="content"> 
		<div class="grid_9">
			<h1 class="news_edit">Notification Info</h1>
		</div>
		<div class="grid_15" id="textcontent">
			<div id="table">
				<div id="user_profile_main_div">
					<div id="message">
					<?php 
					if($this->session->flashdata('flsh_msg')) {
						?><p id="success" class="info"><span class="info_inner"><?php echo $this->session->flashdata('flsh_msg'); ?></span></p> <?php
					} 
					if($this->session->flashdata('flsh_msg1')) {
						?><p id="error" class="info"><span class="info_inner"><?php echo $this->session->flashdata('flsh_msg1'); ?></span></p> <?php
					} 
					?>
					</div>
					<div class="clear"></div>
					<div style="margin: 0 auto;width: 47%;">
						<form action="<?php echo base_url(); ?>index.php/Administrator/NotificationProcess" method="post" enctype="multipart/form-data" name="frmUsers" id="frmTransaction" onSubmit="return ValidateForm()">
							<fieldset class="topleft">
								<legend class="legend">Notification Details</legend>
								</br></br></br></br>
								<div  class="change_pwd_container_user_list">
									<label style="float: left;">Notify when<span style="color:red;">*</span></label>
									<?php 
									$notification_for = $query['notification_for'];
									$array = array("Insurance","Pollution"); 
									$notificationfor = array_diff($array, array($notification_for));
									?>
									<select name="notification_for" class="smallInput medium" style="width:264px;">
										<?php
										echo'<option value="'.$notification_for.'">'.$notification_for.'</option>'; 
										foreach($notificationfor as $notificationf){
											echo'<option value="'.$notificationf.'">'.$notificationf.'</option>'; 
										} ?>
									</select>
									<input type="hidden" class="old_pwd" name="NotificationId"  value="<?php echo $query['id']; ?>" id="owner_id" />
								</div>
								<div  class="change_pwd_container_user_list">
									<label style="float: left;">Is expiring in days<span style="color:red;">*</span></label>
									<input type="text"  class="smallInput medium"  value="<?php echo $query['day']; ?>" name="day">
								</div>
								<div  class="change_pwd_container_user_list">
									<label style="float: left;">At  email <span style="color:red;">*</span></label>
									<input type="text"  class="smallInput medium"  value="<?php echo $query['notification_email']; ?>" name="notification_email" >
								</div>
							</fieldset>
							<div class="clear"></div>
							<div style="width:100%;float:left;">
								<span class="button" style="float: left;"><input type="submit" class="buttoncc" value="Update" name="btnNotificationUpdate"></span>
								<a href="<?php echo base_url(); ?>index.php/Administrator/Notification" class="button" style=";margin-left: 5px;float: left;"><span>Back</span></a>
								<p style="float:right;"><font color="Red">Fields marked with * are mandatory&nbsp;</font></p>
							</div>
						</form>	
					</div>
				</div>
			</div>
		</div>
		<div class="clear"> </div>		
	</div>
</div>
<?php include('template/footer.php'); ?>
</body>
</html>