<? include("si_confi.php"); ?>
<? include("ad_head.php");
$get_emp_id=base64_decode($_REQUEST['isd']);
  $select_employee_details=mysql_query("select * from `employee_mng` where `id`='$get_emp_id'");
  $fetch_employee_details=mysql_fetch_array($select_employee_details);
   ?>
  <div class="container">
  <? include("mn_option.php");?>
<?
if(isset($_REQUEST['submit_emp']))
{
	$emp_id=$_REQUEST['emp_id'];
	$name=$_REQUEST['name'];
	$department=$_REQUEST['department'];
	$work_emailid=$_REQUEST['work_emailid'];
	$email_password=$_REQUEST['email_password'];
	$personal_emailid=$_REQUEST['personal_emailid'];
	$mobileno=$_REQUEST['mobileno'];
	$second_mobileno=$_REQUEST['second_mobileno'];
	$dob=$_REQUEST['dob'];
	$doj=$_REQUEST['doj'];
	$esi_no=$_REQUEST['esi_no'];
	$pf_no=$_REQUEST['pf_no'];
	$pan_no=$_REQUEST['pan_no'];
	$passport_no=$_REQUEST['passport_no'];
	$address=$_REQUEST['address'];
	$emp_row_id=$_REQUEST['emp_row_id'];
	
	//$username=$_REQUEST['username'];
	//$password=$_REQUEST['password'];
	
	//$cur_date=date("Y-m-d");
	//$cur_time=date("g:i a");
	
	
	
	$filen=$_FILES['filen']['name'];
	$select_macid=mysql_query("select max(id) AS ID from `employee_mng`");
	$get_maxid=mysql_fetch_array($select_macid);
	$maxidd=$get_maxid['ID']+1;
	$upload_directory="emp_certificate/";
	$filenamee="$upload_directory$maxidd$filen";
	move_uploaded_file($_FILES['filen']['tmp_name'],$filenamee);
	
	
		$phto=$_REQUEST['phto'];
		
		if($filen=='')
		{
		$filenamee=$phto;
		}
	
	
	
	$insert_employeee_details=mysql_query("update `employee_mng` set `emp_id`='$emp_id',`name`='$name',`department`='$department',`work_emailid`='$work_emailid',`email_password`='$email_password',`personal_emailid`='$personal_emailid',`mobileno`='$mobileno',`second_mobileno`='$second_mobileno',`dob`='$dob',`doj`='$doj',`esi_no`='$esi_no',`pf_no`='$pf_no',`pan_no`='$pan_no',`passport_no`='$passport_no',`address`='$address',`photo`='$filenamee' where `id`='$emp_row_id'");
	?><script>window.location="viwe_empploe.php?ed=suc";</script><?
}

 ?>


<link type="text/css" href="calender/jquery.datepick.css" rel="stylesheet">
<script type="text/javascript" src="calender/jquery.min.js"></script>
<script type="text/javascript" src="calender/jquery.datepick.js"></script>
<script type="text/javascript">
$nocal=$.noConflict();
$nocal(function() {
	$nocal('#popupDatepicker').datepick();
	$nocal('#inlineDatepicker').datepick({onSelect: showDate});
});
function showDate(date) {
	alert('The date chosen is ' + date);
}
</script>
<script type="text/javascript">
$nocal(function() {
	$nocal('#popupDatepicker2').datepick();
	$nocal('#inlineDatepicker2').datepick({onSelect: showDate});
});
function showDate(date) {
	alert('The date chosen is ' + date);
}
</script>



  

   <div style="border:groove;margin-top:10px;border-width:thin;padding:20px;border-radius:4px;border-color:#cccccc;box-shadow: 10px 9px 90px #000;">
   <h2>Edit Employee Details&nbsp;&nbsp;&nbsp;&nbsp;
   <input type="button" value="Back" style="background:#F00;color:#FFF;cursor:pointer;" onClick="window.location='viwe_empploe.php'"></h2>
  <form method="post" enctype="multipart/form-data" id="add_employee" onSubmit="return confirm('Are you sure you want to confirm Update Details ?');" autocomplete="off" action="<?php echo $_SERVER['PHP_SELF']; ?>">
  <input type="hidden" value="<? echo $get_emp_id ?>" name="emp_row_id">
        <script type="text/javascript" src="prototype.js"></script>
        <script type="text/javascript" src="validation.js"></script>
        <table cellpadding="9" id="add_employee">
        <!--<tr>
        <td valign="top">Employee ID</td>
        <td><input type="text" name="emp_id" class="required" value="<? echo $fetch_employee_details['emp_id'] ?>" placeholder="Employee ID"></td>
        </tr>-->
         <tr>
        <td valign="top">Employee Name</td>
        <td><input type="text" name="name" class="required" value="<? echo $fetch_employee_details['name'] ?>" placeholder="Employee Name"></td>
        </tr>
         <tr>
        <td valign="top">Department<span style="font-size:11px;font-weight:bold;color:#03C;">&nbsp;(Optional)</span></td>
        <td><input type="text" name="department" placeholder="Name of Department (Optional) " value="<? echo $fetch_employee_details['department'] ?>"></td>
        </tr>
         <tr>
        <td valign="top">Email ID<span style="font-size:11px;font-weight:bold;color:#930;">&nbsp;(Office)</span></td>
        <td><input type="text" name="work_emailid" class="required validate-email" placeholder="Office Email ID" value="<? echo $fetch_employee_details['work_emailid'] ?>"></td>
        </tr>
         <tr>
        <td valign="top">Password</td>
        <td><input type="text" name="email_password" value="<? echo $fetch_employee_details['email_password'] ?>" class="required" placeholder="Office Email Password"></td>
        </tr>
         <tr>
        <td valign="top">Personal Email ID</td>
        <td><input type="text" name="personal_emailid" class="required validate-email" value="<? echo $fetch_employee_details['personal_emailid'] ?>" placeholder="Employee Personal Email ID"></td>
        </tr>
         <tr>
        <td valign="top">Primary Mobile No</td>
        <td><input type="text" name="mobileno" class="required" maxlength="12" value="<? echo $fetch_employee_details['mobileno'] ?>" placeholder="Primary Mobile No"></td>
        </tr>
         <tr>
        <td valign="top">Secondary Mobile No <span style="font-size:11px;font-weight:bold;color:#03C;">(Optional)</span></td>
        <td><input type="text" name="second_mobileno" maxlength="12" placeholder="Secondary Mobile No (Optional)" value="<? echo $fetch_employee_details['second_mobileno'] ?>"></td>
        </tr>
         <tr>
        <td valign="top">Date of Birth</td>
        <td><input type="text" name="dob" value="<? echo $fetch_employee_details['dob'] ?>" class="required" id="popupDatepicker" value="<? echo date("Y-m-d"); ?>"></td>
        </tr>
         <tr>
        <td valign="top">Date of Joining</td>
        <td><input type="text" name="doj" class="required" value="<? echo $fetch_employee_details['doj'] ?>" id="popupDatepicker2" value="<? echo date("Y-m-d"); ?>"></td>
        </tr>
         <tr>
        <td valign="top">ESI No</td>
        <td><input type="text" name="esi_no" class="required" value="<? echo $fetch_employee_details['esi_no'] ?>" placeholder="ESI No"></td>
        </tr>
         <tr>
        <td valign="top">PF No</td>
        <td><input type="text" name="pf_no" class="required" placeholder="PF No" value="<? echo $fetch_employee_details['pf_no'] ?>"></td>
        </tr>
         <tr>
        <td valign="top">PAN No<span style="font-size:11px;font-weight:bold;color:#03C;">&nbsp;(Optional)</span></td>
        <td><input type="text" name="pan_no" placeholder="PAN No" value="<? echo $fetch_employee_details['pan_no'] ?>"></td>
        </tr>
        <tr>
        <td valign="top">Passport No<span style="font-size:11px;font-weight:bold;color:#03C;">&nbsp;(Optional)</span></td>
        <td><input type="text" name="passport_no" placeholder="Passport No" value="<? echo $fetch_employee_details['passport_no'] ?>"></td>
        </tr>
        <tr>
        <td valign="top">Address</td>
        <td><textarea class="required" name="address" placeholder="Home Address"><? echo $fetch_employee_details['address'] ?></textarea></td>
        </tr>
        <input type="hidden" name="phto" value="<? echo $fetch_employee_details['photo'] ?>">
         <tr>
        <td valign="top">Photo</td>
        <td><input type="file" name="filen" >
        <img src="<? echo $fetch_employee_details['photo']; ?>" width="120">
        </td>
        </tr>

        
        
       <!-- <tr>
        <td valign="top">Username</td>
        <td><input type="text" name="username" class="required" placeholder="Username"></td>
        </tr>
        <tr>
        <td valign="top">Password</td>
        <td><input type="password" name="password" class="required" placeholder="Password"></td>
        </tr>--><tr>
        <td valign="top">&nbsp;</td>
        <td><input type="submit" name="submit_emp" value="Update"></td>
        </tr>
        </table>
			
		</form>
         <script type="text/javascript">
						function formCallback(result, form) 
						{window.status = "valiation callback for form '" + form.id + "': result = " + result;}
						var valid = new Validation('add_employee', {immediate : true, onFormValidate : formCallback});
					</script>
  
  
  </div>
  
 
</div><!-- container -->
  </body>
</html>
