<?php
include('../include/header.php');
$emp_id = $_REQUEST['emp_id'];
?>

 <!-- Page wrapper  -->
        <div class="page-wrapper">
            <!-- Bread crumb -->
            <div class="row page-titles">
                <div class="col-md-5 align-self-center">
                    <h3 class="text-primary">Dashboard</h3> </div>
                <div class="col-md-7 align-self-center">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="javascript:void(0)">Home</a></li>
                        <li class="breadcrumb-item active">Dashboard</li>
                    </ol>
                </div>
            </div>
            <!-- End Bread crumb -->
            <!-- Container fluid  -->
            <div class="container-fluid">
                <!-- Start Page Content -->
                <div class="row">
                   <?php
			$sql_emp_det= "select *from tbl_emp_master where md5(id) = '$emp_id' ";
						$result_emp_det = $objhr->viewdata($sql_emp_det);
				
				
						$rows_emp_det = $result_emp_det->fetch_assoc();
						?>
						   <form  method="post" enctype="multipart/form-data">
						  <div class="row">
                        <div class="col-md-12">
                            <div class="card">
                               <div class="card-body">
                                    
                                    
                                    <div class="tab-content br-n pn">
                                        <div id="navpills-1" class="tab-pane active">
                                            <div class="row">
                                                <div class="row">
                    <div class="col-lg-12">
                        <div class="card card-outline-primary">
						 <div class="card-header">
                                <h4 class="m-b-0 text-white"> Employee Details</h4>
                            </div>
                            <div class="card-body">
                               
                                    <div class="form-body">
                                        <h3 class="card-title m-t-15">Person Info</h3>
                                        <hr>
                                        <div class="row p-t-20">
                                            <div class="col-md-3">
                                                <div class="form-group">
                                                    <label class="control-label">Name</label>
                                                    <input type="text" id="emp_name" name="emp_name" value="<?php echo $rows_emp_det['emp_name'];?>" required class="form-control" >
                                                   
                                            </div>
                                           </div>
											 <div class="col-md-3">
                                                <div class="form-group">
                                                    <label class="control-label">Date of Birth</label>
                                                    <input type="date" id="dob" name="dob" class="form-control" value="<?php echo $rows_emp_det['dob'];?>" placeholder="dd/mm/yyyy">
                                                </div>
                                            </div>
											 <div class="col-md-3">
                                                <div class="form-group has-success">
                                                    <label class="control-label">Gender</label>
                                                    <select name="gender" id="gender" class="form-control custom-select">
													<option value="<?php echo $rows_emp_det['gender'];?>" selected="selected" ><?php echo $rows_emp_det['gender'];?></option>
                                                        <option value="male">Male</option>
                                                        <option value="female">Female</option>
                                                    </select>
                                                    <small class="form-control-feedback"> Select your gender </small> </div>
                                            </div>
											
											<div class="col-md-3">
                                                <div class="form-group">
                                                    <label class="control-label">Phone</label>
                                                    <input type="number" name="phone" id="phone" value="<?php echo $rows_emp_det['phone_no'];?>" class="form-control" >
                                                </div>
                                            </div>
											
											
											
											
											<div class="col-md-3">
                                                <div class="form-group">
                                                    <label class="control-label">Aadhar No</label>
                                                    <input type="text" id="aadhar" name="aadhar" value="<?php echo $rows_emp_det['aadhar_no'];?>" required class="form-control" >
                                                   
                                            </div>
                                           </div>
											 <div class="col-md-3">
                                                <div class="form-group">
                                                    <label class="control-label">Father Name</label>
                                                    <input type="text" id="f_name" name="f_name" value="<?php echo $rows_emp_det['father_name'];?>" class="form-control" >
                                                </div>
                                            </div>
											 <div class="col-md-3">
                                               <div class="form-group">
                                                    <label class="control-label">Mother Name</label>
                                                    <input type="text" id="m_name" name="m_name" value="<?php echo $rows_emp_det['mother_name'];?>" class="form-control" >
                                                </div>
											
											
											
											
                                            <!--/span-->
                                        </div>
										
										
										<div class="col-md-3">
                                               <div class="form-group">
                                                    <label class="control-label">Marital Status</label>
                                                    <select  id="m_status" name="m_status" class="form-control" >
													<option value="<?php echo $rows_emp_det['marital_status'];?>" selected="selected"><?php echo $rows_emp_det['marital_status'];?></option>
													<option value="married">Married</option>
													<option value="single">Single</option>
													<option value="divorced">Divorced</option>
													<option value="widowed ">Widowed </option>
													</select>
                                                </div>
											
									
                                        </div>
										
										
											<div class="col-md-3">
                                                <div class="form-group">
                                                    <label class="control-label">Permanent Address</label>
                                                    <textarea id="p_address" name="p_address" required class="form-control"  style="height:70px;" ><?php echo $rows_emp_det['p_address'];?></textarea>
                                                   
                                            </div>
                                           </div>
										   
										   
											<div class="col-md-3">
                                                <div class="form-group">
                                                    <label class="control-label">Correspondence Address</label>
                                                     <textarea id="c_address" name="c_address" required class="form-control" style="height:70px;"><?php echo $rows_emp_det['c_address'];?></textarea>
                                                   
                                            </div>
                                           </div>
										   
										   
											<div class="col-md-3">
                                                <div class="form-group">
                                                    <label class="control-label">date of joining</label>
                                                    <input type="date" id="doj" name="doj" value="<?php echo $rows_emp_det['date_of_join'];?>" required class="form-control" >
                                                   
                                            </div>
                                           </div>
                                        <!--/row-->
                                       
                                      
                                       
                                            <!--/span-->
                                        </div>
                                    </div>
                                  
                               
                            </div>
                        </div>
                    </div>

                    
                </div>
                                            </div>
                                        </div>
                                        <div id="navpills-2" class="tab-pane">
                                            <div class="row">
                                                <div class="row">
                    <div class="col-lg-12" >
                        <div class="card card-outline-primary">
                            <div class="card-header">
                                <h4 class="m-b-0 text-white">Employee Detail</h4>
                            </div>
                            <div class="card-body">
                               <div class="form-body">
                                        <h3 class="card-title m-t-15">Qualification</h3>
                                        
                                        <div class="row p-t-20">
                                           <table id="dynamic" class="table " style="width:100%;" >								<thead>
								
								<th>Course</th>
								<th>University / Board</th>
								<th>Percent</th>
								<th>Year Of Passing</th>
								
								</thead>
							 <tbody>
							 <?php
			$sql_emp_q = "select *from tbl_emp_qualification where md5(emp_id) = '$emp_id' ";
						$result_emp_q = $objhr->viewdata($sql_emp_q);
				
				 if($result_emp_q->num_rows > 0){
						while($rows_emp_q = $result_emp_q->fetch_assoc()){
						?>
							<tr><td><div class="form-group">
                                                    
                                                    <input type="text" id="course" name="course[]" value="<?php echo $rows_emp_q['course'];?>" class="form-control" >
                                                </div>
</td>
<td><div class="form-group">
                                                    
                                                    <input type="text" id="univ" name="univ[]" value="<?php echo $rows_emp_q['univ_board'];?>" class="form-control" >
                                                </div>
</td>
<td><div class="form-group">
                                                   
                                                    <input type="number" id="pcnt" name="pcnt[]" value="<?php echo $rows_emp_q['percentage'];?>" class="form-control" >
                                                </div>
</td>
<td><div class="form-group">
                                                    
                                                    <input type="number" id="year" name="year[]" value="<?php echo $rows_emp_q['year_of_pass'];?>" class="form-control" >
                                                </div>
</td>

								</tr>
								
								<?php }}?>
								
								</tbody>
								
                               </table>
                                      <h3 class="card-title m-t-15">Work Experience</h3>
									  
									    <table id="dynamic2" class="table " style="width:100%;" >								<thead>
								
								<th>Company Name</th>
								<th>Department</th>
								<th>Designation</th>
								<th>Date of joining</th>
								<th>Date of Leaving</th>
								
								
							
								</thead>
							 <tbody>
							 <?php
			$sql_emp_wk = "select *from tbl_emp_work_exp where md5(emp_id) = '$emp_id' ";
						$result_emp_wk = $objhr->viewdata($sql_emp_wk);
				
				 if($result_emp_wk->num_rows > 0){
						while($rows_emp_wk = $result_emp_wk->fetch_assoc()){
						?>
							 <tr>
							<td><div class="form-group">
                                                    
                                                    <input type="text" id="company" name="company[]" value="<?php echo $rows_emp_wk['company'];?>" class="form-control" >
                                                </div>
</td>
<td><div class="form-group">
                                                    
                                                    <input type="text" id="dept" name="dept[]" value="<?php echo $rows_emp_wk['department'];?>" class="form-control" >
                                                </div>
</td>
<td><div class="form-group">
                                                   
                                                    <input type="text" id="designation" name="designation[]" value="<?php echo $rows_emp_wk['designation'];?>" class="form-control" >
                                                </div>
</td>
<td><div class="form-group">
                                                    
                                                    <input type="date" id="date_join" name="date_join[]" value="<?php echo $rows_emp_wk['date_join'];?>" style="width:160px;" class="form-control" >
                                                </div>
</td>
<td><div class="form-group">
                                                    
                                                    <input type="date" id="date_leave" name="date_leave[]" value="<?php echo $rows_emp_wk['date_leave'];?>"  style="width:160px;" class="form-control" >
                                                </div>
</td>







								
								
								</tr>
								<?php }}?>
								</tbody>
								
                               </table>
                                     </div> 
                                       
                                    </div>
                                    
                              
                            </div>
                        </div>
                    </div>

                    
                </div>
                                            </div>
                                        </div>
                                        <div id="navpills-3" class="tab-pane">
                                            <div class="row">
                                               <div class="col-lg-12">
                        <div class="card card-outline-primary">
                            <div class="card-header">
                                <h4 class="m-b-0 text-white">Employee Detail</h4>
                            </div>
                            <div class="card-body">
                               
                                    <div class="form-body">
                                       <h3 class="card-title m-t-15">Skills</h3>
									  
									    <table id="dynamic3" class="table " style="width:100%;" >								<thead>
								
								<th>Name</th>
								<th>Level</th>
								
							
								</thead>
							 <tbody>
							 <?php
			$sql_emp_sk = "select *from tbl_emp_skill where md5(emp_id) = '$emp_id' ";
						$result_emp_sk = $objhr->viewdata($sql_emp_sk);
				
				 if($result_emp_sk->num_rows > 0){
						while($rows_emp_sk = $result_emp_sk->fetch_assoc()){
						?>
							 <tr>
							<td><div class="form-group">
                                                    
                                                    <input type="text" id="skill" name="skill[]" value="<?php echo $rows_emp_sk['skill'];?>" class="form-control" >
                                                </div>
</td>
<td><div class="form-group">
                                                    
                                                    <select  id="s_level" name="s_level[]" class="form-control" >
													<option value="<?php echo $rows_emp_sk['skill_level'];?>" selected="selected"><?php echo $rows_emp_sk['skill_level'];?></option>
													<option value="basic">Basic</option>
													<option value="intermediate">Intermediate</option>
													<option value="expert">Expert</option>
													</select>
                                                </div>
</td>


								
								
								</tr>
								<?php }}?>
								
								</tbody>
								
                               </table>
							   
							   
							     <h3 class="card-title m-t-15">Document</h3>
									<table  class="table " style="width:100%;" >  
							 <tbody>
							 <?php
				 				 
				$sqlud = "select *from tbl_identity_master where del_status ='0' ";
				$resultud = $objhr->viewdata($sqlud);
				if($resultud->num_rows > 0){
				$i=0;
				while(	$rowsud = $resultud->fetch_assoc()){
				
				$sql_doc = "select *from tbl_emp_identity where md5(emp_id) = '$emp_id' and identity_id= '".$rowsud['id']."' ";
				$result_doc = $objhr->viewdata($sql_doc);
				$rows_doc = $result_doc->fetch_assoc();
				$i++;
				?>				
							 <tr>
							 <td><?php echo strtoupper($rowsud['identity_type']); ?><input type="hidden" id="idty_id" name="idty_id[]" value="<?php echo $rowsud['id']; ?>" class="form-control" > <input type="hidden" id="doc_name" name="doc_name[]" class="form-control" value="<?php echo strtoupper($rowsud['identity_type']); ?>" ></td>
							<td>
							<div class="form-group">
                                                    
                                                    <input type="file" id="files" name="files[]" class="form-control" value="<?php echo $rows_doc['image']; ?>" >
                                                </div>
									</td>
									<td align="left"> <img src="../photo/<?php echo $rows_doc['image'];?>" style="width:50px; height:50px;" /></td>

								</tr>
								<?php }}?>
								</tbody>
								
                               </table>
                                        </div>
                                        <!--/row-->
                                       
                                      
                                       <button type="submit" class="btn btn-primary"  onclick="fun()">update</button>
                                    </div>
                                    
                               
                            </div>
                        </div>
                    </div>
                                            </div>
                                        </div>
                                    </div>
									<ul class="nav nav-pills m-t-30 m-b-30">
                                        <li class=" nav-item"> <a href="#navpills-1" class="nav-link active" data-toggle="tab" aria-expanded="false">Persona Info</a> </li>
                                        <li class="nav-item"> <a href="#navpills-2" class="nav-link" data-toggle="tab" aria-expanded="false">Qualification / Work History</a> </li>
                                        <li class="nav-item"> <a href="#navpills-3" class="nav-link" data-toggle="tab" aria-expanded="true">Skill / Identity</a> </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        
                    </div>
						  
						</form>  
						  
						  
						  
						  
                    
                </div>
                <!-- End PAge Content -->
            </div>
            <!-- End Container fluid  -->
			
			
			

<?php
include('../include/footer.php');
?>
<script>
$(document).ready(function(){
 var i=1;
 $('#add_input').click(function(){
 i++;
 $('#dynamic').append('<tr id="row'+i+'"><td><div class="form-group"><input type="text" id="course" name="course[]" class="form-control" ></div></td><td><div class="form-group"><input type="text" id="univ" name="univ[]" class="form-control" ></div></td><td><div class="form-group"><input type="number" id="pcnt" name="pcnt[]" class="form-control" ></div></td><td><div class="form-group"><input type="number" id="year" name="year[]" class="form-control" ></div></td><td><button type="button" name="remove" id="'+i+'" class="btn btn-danger btn-sm btn_remove">Remove</button></td></tr>');
 });
 $(document).on('click', '.btn_remove', function(){
 var button_id = $(this).attr("id");
 $('#row'+button_id+'').remove();
 });

 
});
</script>




<script>
$(document).ready(function(){
 var i=1;
 $('#add_input2').click(function(){
 i++;
 $('#dynamic2').append('<tr id="row'+i+'"><td><div class="form-group"><input type="text" id="company" name="company[]" class="form-control" ></div></td><td><div class="form-group"><input type="text" id="dept" name="dept[]" class="form-control" ></div></td><td><div class="form-group"><input type="text" id="designation" name="designation[]" class="form-control" ></div></td><td><div class="form-group"><input type="date" id="date_join" name="date_join[]" class="form-control" ></div></td><td><div class="form-group"><input type="date" id="date_leave" name="date_leave[]" class="form-control" ></div></td><td><button type="button" name="remove" id="'+i+'" class="btn btn-danger btn-sm btn_remove">Remove</button></td></tr>');
 });
 $(document).on('click', '.btn_remove', function(){
 var button_id = $(this).attr("id");
 $('#row'+button_id+'').remove();
 });

 
});
</script>



<script>
$(document).ready(function(){
 var i=1;
 $('#add_input3').click(function(){
 i++;
 $('#dynamic3').append('<tr id="row'+i+'"><td><div class="form-group"><input type="text" id="skill" name="skill[]" class="form-control" ></div></td><td><div class="form-group"><select  id="s_level" name="s_level[]" class="form-control" ><option value="basic">Basic</option><option value="intermediate">Intermediate</option><option value="expert">Expert</option></select></div></td><td><button type="button" name="remove" id="'+i+'" class="btn btn-danger btn-sm btn_remove">Remove</button></td></tr>');
 });
 $(document).on('click', '.btn_remove', function(){
 var button_id = $(this).attr("id");
 $('#row'+button_id+'').remove();
 });

 
});
</script>