<?php
session_start();
if(!isset ($_SESSION['user_id'])){
    header("Location:../login.php?msg=Log in first");
    exit();
}else{
	include('../Server/connection.php');
	include('includes/session.php');
	$st = 'add';
	if($st == 'add'){
	echo "<div class='div-request div-hide'>add</div>";
	}
?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <?php
	include 'title.php';
	?>
	
	
	<link type = "image/png" rel="icon" href="images/brvision.png" />

    <!-- Bootstrap must-->
    <link href="../vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
	
    <!-- Font Awesome must-->
    <link href="../vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
	
	<!-- custom css -->
    <link rel="stylesheet" href="custom/css/custom.css">
	
    <!-- NProgress must-->
    <link href="../vendors/nprogress/nprogress.css" rel="stylesheet">
	
    <!-- Custom Theme Style must-->
    <link href="../build/css/custom.min.css" rel="stylesheet">
	
	
	
	<!-- must-->
	<script src="assests/jquery/jquery.min.js"></script>
	
	<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/jquery.validate.min.js"></script>
    <script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/additional-methods.min.js"></script>
	
  <!-- jquery ui -->  
  <link rel="stylesheet" href="assests/jquery-ui/jquery-ui.min.css">
  <script src="assests/jquery-ui/jquery-ui.min.js"></script>
	
  <!-- Must Bootstrap -->
    <script src="../vendors/bootstrap/dist/js/bootstrap.min.js"></script>
	
	<style>
  .error {
    color: #F00;
}  

</style>
	
<script type="text/javascript">
$(document).ready(function(){
    $('#relId').on('change',function(){
        var regID = $(this).val();
        if(regID){
            $.ajax({
                type:'POST',
                url:'rajaxData.php',
                data:'relId='+regID,
                success:function(html){
                    $('#denId').html(html);
                }
            }); 
        }else{
            $('#denId').html('<option value="">Select Religion First</option>');
        }
    });

});
</script>


<script type="text/javascript">
$(document).ready(function(){
    $('#deptId').on('change',function(){
        var regID = $(this).val();
        if(regID){
            $.ajax({
                type:'POST',
                url:'ajaxData.php',
                data:'deptId='+regID,
                success:function(html){
                    $('#desId').html(html);
                }
            }); 
        }else{
            $('#desId').html('<option value="">Select Department First</option>');
        }
    });

});
</script>
	
	
  </head>

  <body class="nav-md">
  
    <div class="container body">
	
      <div class="main_container">
        <div class="col-md-3 left_col">
          <div class="left_col scroll-view">
		  
            <?php  
		include 'includes/role.php';
               ?>

            <div class="clearfix"></div>
            
			<?php
            include 'includes/profile.php';
			print '</br></br>';
			include 'includes/menu.php';
			?>

           

        <!-- page content -->
        <div class="right_col" role="main">
          <div class="">
		  
			
			
            <div class="clearfix"></div>

            <div class="row">
              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
				  
                    <a href="manage_staff.php">  <h2><span class="glyphicon glyphicon-step-backward"></span> Back</h2></a>
					
					</br></br>
					<font color="green">Add Staff</font>
					
				
                    <ul class="nav navbar-right panel_toolbox">
                      <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                      </li>
                     
                    </ul>
                    <div class="clearfix"></div>
                  </div>
				  
				 
				  
                 <div class="x_content" style="overflow: auto;">
				 
				 <?php if (isset($_SESSION['success_message']) && !empty($_SESSION['success_message'])) { ?>
                        <div class="success-message" style="margin-bottom: 20px;font-size: 20px;color: green;"><?php echo $_SESSION['success_message']; ?></div>
                        <?php
                        unset($_SESSION['success_message']);
                    }
                    ?>	
				 
				  <div class="success-messages"></div> <!--/success-messages-->
				  
				
               
			   <form class="form-horizontal" id="id_frm" method="POST" enctype="multipart/form-data" action="php_action/create_Staff.php">
			   
			   <div class="controls">
			  <div class="row">
			  

			  <div class="col-sm-4">
			  <div class="form-group">
                 <label for="form_name"> Staff First Name </label>
                 <input  type="text" class="form-control" id="fname" name="fname"  placeholder="Staff First Name" autocomplete="off" />
                    <br/>
                         <label for="fname" class="error" generated="true"></label>  
                    </div>
			  </div>
			  
			  <div class="col-sm-4">
			  <div class="form-group">
			  
			  <label for="form_name"> Staff Middle Name </label>
                 <input  type="text" class="form-control" id="mname" name="mname"  placeholder="Staff Middle Name" autocomplete="off" />
                 <br/>
                         <label for="mname" class="error" generated="true"></label>  
                      
                    </div>
			  </div>
			  
			  <div class="col-sm-4">
			  <div class="form-group">
			  
			  <label for="form_name"> Staff Last Name </label>
                 <input  type="text" class="form-control" id="lname" name="lname"  placeholder="Staff Last Name" autocomplete="off"/>
                 <br/>
                         <label for="lname" class="error" generated="true"></label>
                      
                    </div>
			  </div>
			 
			  
			  	</div>	  
                </div>
			  
			  <div class="controls">
			  <div class="row">
			  
			  <div class="col-sm-4">
			  <div class="form-group">
                 <label for="form_name"> Staff TIN </label>
                 <input  type="text" class="form-control" id="tin" name="tin"  placeholder="Staff TIN" autocomplete="off" />
                    <br/>
                         <label for="tin" class="error" generated="true"></label>  
                    </div>
			  </div>
			  
			  <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name"> Staff Nssf No </label>
                 <input  type="text" class="form-control" id="nssf_no" name="nssf_no"  placeholder="Staff Nssf No" autocomplete="off" />
                    <br/>
                         <label for="nssf_no" class="error" generated="true"></label>  
                    </div>
			  </div>
			  

			  <div class="col-sm-2">
			  <div class="form-group">
                 <label for="form_name"> Staff Gender</label>
				  <select class="form-control" name="gender_id" id="gender_id" autocomplete="off" />
				            <option value="">~~SELECT~~</option>
			  						<?php
			  							$productSql = "SELECT * from gender";
			  							$productData = $conn->query($productSql);

			  							while($row = $productData->fetch_array()){									 		
			  								echo "<option value='".$row['gender_id']."'>".$row['gender_name']."</option>";
										 	} // /while 

			  						?>
		  						</select>
                      <br/>
                         <label for="gender_id" class="error" generated="true"></label>  
                    </div>
			  </div>
			  
			  
			   <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name"> Staff Email Address </label>
                 <input  type="email" class="form-control" id="email" name="email"  placeholder="Staff Email Address" autocomplete="off" />
                    <br/>
                         <label for="email" class="error" generated="true"></label>  
                    </div>
			  </div>
			  
			  
			
			  	</div>	  
                </div>
				
				
			
			<div class="controls">
			  <div class="row">
			  
			  <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name"> Staff Phone Number </label>
                 <input  type="tel" class="form-control" id="phone" name="phone"  placeholder="Staff Phone Number" autocomplete="off" />
                    <br/>
                         <label for="phone" class="error" generated="true"></label>  
                    </div>
			  </div>
			  
			  <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name"> Staff Nhif Number </label>
                 <input  type="tel" class="form-control" id="nhif_no" name="nhif_no"  placeholder="Staff Nhif Number" autocomplete="off" />
                    <br/>
                         <label for="nhif_no" class="error" generated="true"></label>  
                    </div>
			  </div>
			  
			  <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name"> Staff Birth Date </label>
                 <input  type="text" class="form-control" id="bdate" name="bdate"  placeholder="Staff Birth Date" autocomplete="off" />
                    <br/>
                         <label for="bdate" class="error" generated="true"></label>  
                    </div>
			  </div>
			  
			  <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name"> Staff Employment Date </label>
                 <input  type="text" class="form-control" id="empdate" name="empdate"  placeholder="Staff Employment Date" autocomplete="off" />
                    <br/>
                         <label for="empdate" class="error" generated="true"></label>  
                    </div>
			  </div>
			  

			
			  	</div>	  
                </div>
				
				
			<div class="controls">
			  <div class="row">
			  
			   <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name"> Staff Marital Status</label>
				  <select class="form-control" name="marital_id" id="marital_id" autocomplete="off" />
				            <option value="">~~SELECT~~</option>
			  						<?php
			  							$productSql1 = "SELECT * from marital_status";
			  							$productData1 = $conn->query($productSql1);

			  							while($row1 = $productData1->fetch_array()){									 		
			  								echo "<option value='".$row1['marital_id']."'>".$row1['marital_name']."</option>";
										 	} // /while 

			  						?>
		  						</select>
                      <br/>
                         <label for="marital_id" class="error" generated="true"></label>  
                    </div>
			  </div>
			  
			  <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name"> Does Staff Has Religion?</label>
				  </br>
				 <label class="radio-inline">
          <input type="radio" name="rel_status" value="Have Religion" id="rel_status" checked> Yes
         </label>&nbsp&nbsp&nbsp&nbsp
         <label class="radio-inline">
          <input type="radio" name="rel_status" value="Atheists" id="rel_status"> No
         </label>&nbsp&nbsp&nbsp&nbsp
				 
				
				    
              </div>
			  </div>
			  
			  
			  <div id="textboxes1">	
			  <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name"> Staff Religion </label>
                 
				 <select class="form-control" name="relId" id="relId">
			  						<option value="">~~SELECT~~</option>
			  						<?php
			  							$productSql2 = "SELECT religions.religion_id,religions.religion_name FROM religions ORDER BY religion_name";
			  							$productData2 = $conn->query($productSql2);
			  							while($row2 = $productData2->fetch_array()){									 		
			  								echo "<option value='".$row2['religion_id']."'>".$row2['religion_name']."</option>";
										 	} // /while 

			  						?>
		  						</select>
				 
                    <br/>
                         <label for="relId" class="error" generated="true"></label>  
                    </div>
			  </div>
			  
			  <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name"> Staff Denomination </label>
                 <select class="form-control" name="denId" id="denId">
			  						<option value="">~~SELECT~~</option>
		  						</select>  
                    <br/>
                         <label for="denId" class="error" generated="true"></label>  
                    </div>
			  </div>
			  
             </div>
			
			  	</div>	  
                </div>
				
				
			<div class="controls">
			  <div class="row">
			  
			   <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name"> Staff Category </label>
				  </br>
				 <?php
							$sql421 = "SELECT * FROM staff_category";	
        $result421 = $conn->query($sql421); 
		while ($row421 = mysqli_fetch_array($result421))
		{
			$staffcate_id421 = $row421['staffcate_id'];
			$mode_name41 = $row421['staffcate_name'];
	
		?>
						<label class="radio-inline">
						<input  type="radio"  id="staffcate_id" name="staffcate_id" value="<?php echo $row421['staffcate_id'] ?>" <?php if($staffcate_id421==1){ echo "checked";}?> />&nbsp<?php echo $mode_name41; ?>
						</label>
						</br>
						
						
						<?php
		                }
						?>
				  
              </div>
			  </div>
			  
			  <div id="textboxes2">	
			  
			  <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name"> Department </label>
				 
				 <select class="form-control" name="dept_id" id="dept_id">
			  						<option value="">~~SELECT~~</option>
			  						<?php
			  							$productSql3 = "SELECT departments.dept_id,departments.depart_name FROM departments ORDER BY depart_name";
			  							$productData3 = $conn->query($productSql3);
			  							while($row3 = $productData3->fetch_array()){									 		
			  								echo "<option value='".$row3['dept_id']."'>".$row3['depart_name']."</option>";
										 	} // /while 

			  						?>
		  						</select>
				 <br/>
                         <label for="dept_id" class="error" generated="true"></label>  
				
				    
              </div>
			  </div>
			  
			  
			  
			  <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name"> Section </label>
                 
				  <select class="form-control" name="sect_id" id="sect_id">
			  						<option value="">~~SELECT~~</option>
		  						</select>  
				 
                    <br/>
                         <label for="sect_id" class="error" generated="true"></label>  
                    </div>
			  </div>
			  
			  <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name"> Designation </label>
                 <select class="form-control" name="des_id" id="des_id">
			  						<option value="">~~SELECT~~</option>
		  						</select>  
                    <br/>
                         <label for="des_id" class="error" generated="true"></label>  
                    </div>
			  </div>
			  
             </div>
			 
			 <div id="textboxes3" style="display: none">
			 
			 <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name"> Department </label>
				 
				 <select class="form-control" name="deptId" id="deptId">
			  						<option value="">~~SELECT~~</option>
			  						<?php
			  							$productSql3 = "SELECT departments.dept_id,departments.depart_name FROM departments ORDER BY depart_name";
			  							$productData3 = $conn->query($productSql3);
			  							while($row3 = $productData3->fetch_array()){									 		
			  								echo "<option value='".$row3['dept_id']."'>".$row3['depart_name']."</option>";
										 	} // /while 

			  						?>
		  						</select>
				 <br/>
                         <label for="deptId" class="error" generated="true"></label>  
				
				    
              </div>
			  </div>
			  
			   <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name"> Designation </label>
                 
				  <select class="form-control" name="desId" id="desId">
			  						<option value="">~~SELECT~~</option>
		  						</select>  
				 
                    <br/>
                         <label for="desId" class="error" generated="true"></label>  
                    </div>
			  </div>
			 
			 </div>
			 
			  <div id="textboxes4" style="display: none">
			  
			   <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name"> Designation </label>
				 
				 <select class="form-control" name="designId" id="designId">
			  						<option value="">~~SELECT~~</option>
			  						<?php
			  							$productSql4 = "SELECT designation.des_id,designation.des_name FROM designation where staffcate_id=4 ORDER BY des_name";
			  							$productData4 = $conn->query($productSql4);
			  							while($row4 = $productData4->fetch_array()){									 		
			  								echo "<option value='".$row4['des_id']."'>".$row4['des_name']."</option>";
										 	} // /while 

			  						?>
		  						</select>
				 <br/>
                         <label for="designId" class="error" generated="true"></label>  
				
				    
              </div>
			  </div>
			  
			  </div>
			  
			  
			   <div id="textboxes5" style="display: none">
			   
			    <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name"> Department </label>
				 
				 <select class="form-control" name="depart_id" id="depart_id">
			  						<option value="">~~SELECT~~</option>
			  						<?php
			  							$productSql8 = "SELECT departments.dept_id,departments.depart_name FROM departments ORDER BY depart_name";
			  							$productData8 = $conn->query($productSql8);
			  							while($row8 = $productData8->fetch_array()){									 		
			  								echo "<option value='".$row8['dept_id']."'>".$row8['depart_name']."</option>";
										 	} // /while 

			  						?>
		  						</select>
				 <br/>
                         <label for="depart_id" class="error" generated="true"></label>  
				
				    
              </div>
			  </div>
			  
			  
			  
			  <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name"> Section </label>
                 
				  <select class="form-control" name="section_id" id="section_id">
			  						<option value="">~~SELECT~~</option>
		  						</select>  
				 
                    <br/>
                         <label for="section_id" class="error" generated="true"></label>  
                    </div>
			  </div>
			  
			  <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name"> Designation </label>
                 <select class="form-control" name="desi_id" id="desi_id">
			  						<option value="">~~SELECT~~</option>
		  						</select>  
                    <br/>
                         <label for="desi_id" class="error" generated="true"></label>  
                    </div>
			  </div>
			   
			   </div>
			
			  	</div>	  
                </div>
				
				
				 <div class="controls">
			  <div class="row">
			  

			  <div class="col-sm-3">
			  <div class="form-group">
			  
               <label for="form_name"> Employment Type </label>
				 </br>
				 <?php
							$sql4217 = "SELECT * FROM emp_type";	
        $result4217 = $conn->query($sql4217); 
		while ($row4217 = mysqli_fetch_array($result4217))
		{
			$emptype_id4217 = $row4217['emptype_id'];
			$mode_name417 = $row4217['emp_name'];
	
		?>
						<label class="radio-inline">
						<input  type="radio"  id="emptype_id" name="emptype_id" value="<?php echo $row4217['emptype_id'] ?>" <?php if($emptype_id4217==2){ echo "checked";}?> />&nbsp<?php echo $mode_name417; ?>
						</label>
						
						
						
						<?php
		                }
						?>
						 
              </div>
			  </div>
			  
			  <div class="col-sm-3">
			  <div class="form-group">
			  
			  <label for="form_name"> Highest Education Level </label>
                   
                      <select class="form-control" name="edu_level_id" id="edu_level_id">
			  						<option value="">~~SELECT~~</option>
			  						<?php
			  							$productSql63 = "SELECT * FROM edu_level ORDER BY eduName";
			  							$productData63 = $conn->query($productSql63);
			  							while($row63 = $productData63->fetch_array()){									 		
			  								echo "<option value='".$row63['eduLevel_id']."'>".$row63['eduName']."</option>";
										 	} // /while 

			  						?>
		  						</select>
				 <br/>
                         <label for="edu_level_id" class="error" generated="true"></label>
                    </div>
			  </div>
			  
			  
			 <div id="textboxes6">
			 
			 <div class="col-sm-3">
			  <div class="form-group">
			  
			  <label for="form_name"> Contract Start Date </label>
			  
			  <input type="text" class="form-control" id="contStart" placeholder="Contract Start Date" name="contStart" autocomplete="off">    
                   
                
				 <br/>
                         <label for="contStart" class="error" generated="true"></label>
                    </div>
			  </div>
			 
			 
			  <div class="col-sm-3">
			  <div class="form-group">
			  
			  <label for="form_name"> Contract Duration (Months) </label>
                   
                      <select class="form-control" name="cont_dur_id" id="cont_dur_id">
			  						<option value="">~~SELECT~~</option>
			  						<?php
			  							$productSql6 = "SELECT cont_duration.cont_dur_id,cont_duration.cont_dur_name FROM cont_duration ORDER BY cont_dur_name";
			  							$productData6 = $conn->query($productSql6);
			  							while($row6 = $productData6->fetch_array()){									 		
			  								echo "<option value='".$row6['cont_dur_id']."'>".$row6['cont_dur_name']."</option>";
										 	} // /while 

			  						?>
		  						</select>
				 <br/>
                         <label for="cont_dur_id" class="error" generated="true"></label>
                    </div>
			  </div>
			  </div>
			
			  	</div>	  
                </div>
				
				<div class="controls">
			  <div class="row">
			  
			  <div class="col-sm-4">
			  <div class="form-group">
                 <label for="form_name"> Region Of Birth: </label>
				 
				 <select class="form-control" name="region_id" id="region_id">
			  						<option value="">~~SELECT~~</option>
			  						<?php
			  							$productSql44 = "SELECT regions.region_id,regions.region_name FROM regions ORDER BY region_name";
			  							$productData44 = $conn->query($productSql44);
			  							while($row44 = $productData44->fetch_array()){									 		
			  								echo "<option value='".$row44['region_id']."'>".$row44['region_name']."</option>";
										 	} // /while 

			  						?>
		  						</select>
				 <br/>
                         <label for="region_id" class="error" generated="true"></label>  
                 
			
                </div>
			   </div>
			   
			    <div class="col-sm-4">
			  <div class="form-group">
                 <label for="form_name"> District Of Birth: </label>
				 
				 <select class="form-control" name="district_id" id="district_id">
			  						<option value="">~~SELECT~~</option>
		  						</select>  
				 
                    <br/>
                         <label for="district_id" class="error" generated="true"></label>  
                 
			
                </div>
			   </div>
			   
			    <div class="col-sm-4">
			  <div class="form-group">
                 <label for="form_name"> Ward Of Birth: </label>
				 
				 <select class="form-control" name="ward_id" id="ward_id">
			  						<option value="">~~SELECT~~</option>
		  						</select>  
				 
                    <br/>
                         <label for="ward_id" class="error" generated="true"></label>  
                 
			
                </div>
			   </div>
			
				
			  </div>	  
              </div>
				
		      <div class="controls">
			  <div class="row">
			  
			  <div class="col-sm-12">
			  <div class="form-group">
                 <label for="form_name"> Career Acomplishment: </label>
                 
			
                </div>
			   </div>
			
				
			  </div>	  
              </div>
				
					

              <table class="table" id="productTable">
			  	<thead>
			  		<tr>			  			
						<th style="width:5%;">S/N</th>
						<th style="width:30%;">Institution Name</th>
						<th style="width:30%;">Period</th>
			  			<th style="width:30%;">Award</th>		  			
			  			<th style="width:5%;"></th>
						
			  		</tr>
			  	</thead>
			  	<tbody>
			  		<?php
			  		$arrayNumber = 0;
					$no 	= 1;
			  		for($x = 1; $x < 4; $x++) { ?>
			  			<tr id="row<?php echo $x; ?>" class="<?php echo $arrayNumber; ?>">	
						
						
						   <td style="padding-left:20px;">
			  					<div class="form-group">
								<?php
								print $x;
								?>
			  					</div>
			  				</td>
							
							<td style="padding-left:20px;">
			  					<div class="form-group">
								<input type="text" name="inst_name[]" class="form-control" id="inst_name<?php echo $x; ?>"  placeholder="Institution Name" autocomplete="off"/>
			  					</div>
			  				</td>	
							
							
							<td style="padding-left:20px;">
			  					<div class="form-group">
								<input type="text" name="edu_period[]" class="form-control" id="edu_period<?php echo $x; ?>" placeholder="Education Period" autocomplete="off"/>
			  					</div>
			  				</td>
							
							
							 <td style="padding-left:20px;">
			  					<div class="form-group">
								<textarea rows="3" cols="50" name="edu_desc[]" id="edu_desc<?php echo $x; ?>"  class="form-control" style="margin-left:0%;" autocomplete="off" /> </textarea>
								
			  					</div>
			  				</td>
							
						
							
			  				<td>

			  					<button class="btn btn-default removeProductRowBtn" type="button" id="removeProductRowBtn" onclick="removeProductRow(<?php echo $x; ?>)"><i class="glyphicon glyphicon-trash"></i></button>
			  				</td>
			  			</tr>
		  			<?php
		  			$arrayNumber++;
					$no++;
			  		} // /for
			  		?>
			  	</tbody>			  	
			  </table>
			  
			  <div class="col-md-6">
			  
			       <div class="form-group">
				    <div class="col-sm-6">
				      <button type="button" class="btn btn-default" onclick="addRow()" id="addRowBtn" data-loading-text="Loading..."> <i class="glyphicon glyphicon-plus-sign"></i> Add Row </button>
				    </div>
				  </div> <!--/form-group-->	
				  
				 </br>
			
			  </div> <!--/col-md-6-->
			  
			  </br></br></br>
			  
			  <div class="controls">
			  <div class="row">
			  
			  <div class="col-sm-4">
			  <div class="form-group">
              <label for="form_name"> Upload Staff Document (s): </label>
			  </br>
			   <label class="radio-inline">
          <input type="radio" name="upl_status" value="Yes" id="upl_status"> Yes
         </label>&nbsp&nbsp&nbsp&nbsp
         <label class="radio-inline">
          <input type="radio" name="upl_status" value="No" id="upl_status" checked> No
         </label>&nbsp&nbsp&nbsp&nbsp
		 
		 <div id="textboxes7" style="display: none">		
		     
			  <input  type="file" name="file[]"  id="file" class="form-control" style="width:100%;margin-left:0%;" multiple>
			  
			   <br/>
        <label for="file" class="error" generated="true"></label>
			 
			</div>
                 
			
               </div>
			   </div>
			   
			   <div class="col-sm-4">
			  <div class="form-group">
              
                 
			
               </div>
			   </div>
			   
			   <div class="col-sm-4">
			  <div class="form-group">
              
                 
			
               </div>
			   </div>
			
				
			  </div>	  
              </div>
			  
			  </br></br></br></br>
			  
			  <div class="controls">
			  <div class="row">
			  
			  <div class="col-sm-12">
			  <div class="form-group">
                 <label for="form_name"> Does Staff Has Parents/Guardians: </label>
				 
				 </br>
			   <label class="radio-inline">
          <input type="radio" name="parent_status" value="Yes" id="parent_status"> Yes
         </label>&nbsp&nbsp&nbsp&nbsp
         <label class="radio-inline">
          <input type="radio" name="parent_status" value="No" id="parent_status" checked> No
         </label>&nbsp&nbsp&nbsp&nbsp
                 
			
                </div>
			   </div>
			
				
			  </div>	  
              </div>
			  
			  <div id="textboxes10" style="display: none">	
			  
			   <table class="table" id="productTable">
			  	<thead>
			  		<tr>			  			
						
                        <th style="width:20%;">Relationship</th>						
			  			<th style="width:15%;">First Name</th>
						<th style="width:15%;">Middle Name</th>
						<th style="width:15%;">Last Name</th>
						<th style="width:15%;">Phone No</th>
						<th style="width:20%;">Email</th>
						
						
			  		</tr>
			  	</thead>
			  	<tbody>
			  		<?php
			  		$arrayNumber1 = 0;
					$no1 	= 1;
			  		for($x1 = 1; $x1 < 3; $x1++) { ?>
			  			<tr id="row<?php echo $x1; ?>" class="<?php echo $arrayNumber1; ?>">	
						
						
						
							
							 <td style="margin-left:20px;">
			  					<div class="form-group">

			  					<select class="form-control" name="prel_id[]" id="prel_id<?php echo $x1; ?>">
			  						<option value="">~~SELECT~~</option>
			  						<?php
			  							$productSql3v1 = "SELECT * FROM parent_relationships";
			  							$productData3v1 = $conn->query($productSql3v1);

			  							while($row3v1 = $productData3v1->fetch_array()) {									 		
			  								echo "<option value='".$row3v1['prel_id']."'>".$row3v1['prel_name']."</option>";
										 	} // /while 

			  						?>
		  						</select>
			  					</div>
			  				</td>

                            <td style="padding-left:20px;">
			  					<div class="form-group">
								<input type="text" name="pf_name[]" class="form-control" id="pf_name<?php echo $x1; ?>"   placeholder="First Name" autocomplete="off"/>
			  					</div>
			  				</td>	
							
							
							<td style="padding-left:20px;">
			  					<div class="form-group">
								<input type="text" name="pm_name[]" class="form-control" id="pm_name<?php echo $x1; ?>"   placeholder="Middle Name" autocomplete="off"/>
			  					</div>
			  				</td>
							
							<td style="padding-left:20px;">
			  					<div class="form-group">
								<input type="text" name="pl_name[]" class="form-control" id="pl_name<?php echo $x1; ?>"   placeholder="Last Name" autocomplete="off"/>
			  					</div>
			  				</td>
							
							<td style="padding-left:20px;">
			  					<div class="form-group">
								<input type="text" name="p_phone[]" class="form-control" id="p_phone<?php echo $x1; ?>"   placeholder="Phone Number" autocomplete="off"/>
			  					</div>
			  				</td>
							
							
							<td style="padding-left:20px;">
			  					<div class="form-group">
								<input type="email" name="p_email[]" class="form-control" id="p_email<?php echo $x1; ?>"   placeholder="Email Address" autocomplete="off"/>
			  					</div>
			  				</td>
							
			  			
			  			</tr>
		  			<?php
		  			$arrayNumber1++;
					$no1++;
			  		} // /for
			  		?>
			  	</tbody>			  	
			  </table>
			  
			 </div>
			  
			  </br></br></br>
			  
			  <div class="controls">
			  <div class="row">
			  
			  <div class="col-sm-12">
			  <div class="form-group">
                 <label for="form_name"> Does Staff Has Next Of KIN: </label>
				 
				  </br>
			   <label class="radio-inline">
          <input type="radio" name="kin_status" value="Yes" id="kin_status"> Yes
         </label>&nbsp&nbsp&nbsp&nbsp
         <label class="radio-inline">
          <input type="radio" name="kin_status" value="No" id="kin_status" checked> No
         </label>&nbsp&nbsp&nbsp&nbsp
                 
			
                </div>
			   </div>
			
				
			  </div>	  
              </div>
			  
			   <div id="textboxes11" style="display: none">	
			  
			   <table class="table" id="productTable2">
			  	<thead>
			  		<tr>			  			
						
                        <th style="width:20%;">Relationship</th>						
			  			<th style="width:15%;">First Name</th>
						<th style="width:15%;">Middle Name</th>
						<th style="width:15%;">Last Name</th>
						<th style="width:15%;">Phone No</th>
						<th style="width:20%;">Email</th>
						
						
			  		</tr>
			  	</thead>
			  	<tbody>
			  		<?php
			  		$arrayNumber2 = 0;
					$no2 	= 1;
			  		for($x2 = 1; $x2 < 2; $x2++) { ?>
			  			<tr id="row<?php echo $x2; ?>" class="<?php echo $arrayNumber2; ?>">	
						
						
						  
							
							 <td style="margin-left:20px;">
			  					<div class="form-group">

			  					<select class="form-control" name="krel_id[]" id="krel_id<?php echo $x2; ?>">
			  						<option value="">~~SELECT~~</option>
			  						<?php
			  							$productSql3v11 = "SELECT * FROM parent_relationships";
			  							$productData3v11 = $conn->query($productSql3v11);

			  							while($row3v11 = $productData3v11->fetch_array()) {									 		
			  								echo "<option value='".$row3v11['prel_id']."'>".$row3v11['prel_name']."</option>";
										 	} // /while 

			  						?>
		  						</select>
			  					</div>
			  				</td>

                            <td style="padding-left:20px;">
			  					<div class="form-group">
								<input type="text" name="kf_name[]" class="form-control" id="kf_name<?php echo $x2; ?>"   placeholder="First Name" autocomplete="off"/>
			  					</div>
			  				</td>	
							
							
							<td style="padding-left:20px;">
			  					<div class="form-group">
								<input type="text" name="km_name[]" class="form-control" id="km_name<?php echo $x2; ?>"   placeholder="Middle Name" autocomplete="off"/>
			  					</div>
			  				</td>
							
							<td style="padding-left:20px;">
			  					<div class="form-group">
								<input type="text" name="kl_name[]" class="form-control" id="kl_name<?php echo $x2; ?>"   placeholder="Last Name" autocomplete="off"/>
			  					</div>
			  				</td>
							
							<td style="padding-left:20px;">
			  					<div class="form-group">
								<input type="text" name="k_phone[]" class="form-control" id="k_phone<?php echo $x2; ?>"   placeholder="Phone Number" autocomplete="off"/>
			  					</div>
			  				</td>
							
							
							<td style="padding-left:20px;">
			  					<div class="form-group">
								<input type="email" name="k_email[]" class="form-control" id="k_email<?php echo $x2; ?>"   placeholder="Email Address" autocomplete="off"/>
			  					</div>
			  				</td>
							
			  				
			  			</tr>
		  			<?php
		  			$arrayNumber2++;
					$no2++;
			  		} // /for
			  		?>
			  	</tbody>			  	
			  </table>
			  
			</div>
			  
			  </br></br></br>
			  
			   <div class="controls">
			  <div class="row">
			  
			  <div class="col-sm-12">
			  <div class="form-group">
                 <label for="form_name"> Does Staff Has Dependants?: </label>
                 
				 </br>
			   <label class="radio-inline">
          <input type="radio" name="dep_status" value="Yes" id="dep_status"> Yes
         </label>&nbsp&nbsp&nbsp&nbsp
         <label class="radio-inline">
          <input type="radio" name="dep_status" value="No" id="dep_status" checked> No
         </label>&nbsp&nbsp&nbsp&nbsp
			
                </div>
			   </div>
			
				
			  </div>	  
              </div>
			  
			  <div id="textboxes8" style="display: none">	
			  
			  <table class="table" id="productTable3">
			  	<thead>
			  		<tr>			  			
						
                        <th style="width:20%;">Relationship</th>						
			  			<th style="width:15%;">First Name</th>
						<th style="width:15%;">Middle Name</th>
						<th style="width:15%;">Last Name</th>
						<th style="width:15%;">Gender/Sex</th>
						<th style="width:20%;">Birth Date</th>
						
						
			  		</tr>
			  	</thead>
			  	<tbody>
			  		<?php
			  		$arrayNumber3 = 0;
					$no3 	= 1;
			  		for($x3 = 1; $x3 < 6; $x3++) { ?>
			  			<tr id="row<?php echo $x3; ?>" class="<?php echo $arrayNumber3; ?>">	
						
						
							
							 <td style="margin-left:20px;">
			  					<div class="form-group">

			  					<select class="form-control" name="drel_id[]" id="drel_id<?php echo $x3; ?>">
			  						<option value="">~~SELECT~~</option>
			  						<?php
			  							$productSql3v111 = "SELECT * FROM dependants_rel";
			  							$productData3v111 = $conn->query($productSql3v111);

			  							while($row3v111 = $productData3v111->fetch_array()) {									 		
			  								echo "<option value='".$row3v111['dependant_rel_id']."'>".$row3v111['dependant_rel_name']."</option>";
										 	} // /while 

			  						?>
		  						</select>
			  					</div>
			  				</td>

                            <td style="padding-left:20px;">
			  					<div class="form-group">
								<input type="text" name="df_name[]" class="form-control" id="df_name<?php echo $x3; ?>"   placeholder="First Name" autocomplete="off"/>
			  					</div>
			  				</td>	
							
							
							<td style="padding-left:20px;">
			  					<div class="form-group">
								<input type="text" name="dm_name[]" class="form-control" id="dm_name<?php echo $x3; ?>"   placeholder="Middle Name" autocomplete="off"/>
			  					</div>
			  				</td>
							
							<td style="padding-left:20px;">
			  					<div class="form-group">
								<input type="text" name="dl_name[]" class="form-control" id="dl_name<?php echo $x3; ?>"   placeholder="Last Name" autocomplete="off"/>
			  					</div>
			  				</td>
							
							<td style="margin-left:20px;">
			  					<div class="form-group">

			  					<select class="form-control" name="gender_id1[]" id="gender_id1<?php echo $x3; ?>">
			  						<option value="">~~SELECT~~</option>
			  						<?php
			  							$productSql3v111g = "SELECT * FROM gender";
			  							$productData3v111g = $conn->query($productSql3v111g);

			  							while($row3v111g = $productData3v111g->fetch_array()) {									 		
			  								echo "<option value='".$row3v111g['gender_id']."'>".$row3v111g['gender_name']."</option>";
										 	} // /while 

			  						?>
		  						</select>
			  					</div>
			  				</td>
							
							<td style="padding-left:20px;">
			  					<div class="form-group">
								<input type="date" name="db_date[]" class="form-control" id="db_date<?php echo $x3; ?>"   placeholder="Birth Date" autocomplete="off"/>
			  					</div>
			  				</td>
							
			  				
			  			</tr>
		  			<?php
		  			$arrayNumber3++;
					$no3++;
			  		} // /for
			  		?>
			  	</tbody>			  	
			  </table>
			  
			</div>
			  
			  </br></br></br>
			  
			  <div class="controls">
			  <div class="row">
			  
			  <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name"> HESLB Beneficiary: </label>
                  <select class="form-control" name="heslb_status" id="heslb_status" autocomplete="off">
			  						<option value="">~~SELECT~~</option>
									<?php
			  							$productSqlvb = "SELECT * from heslb_ben";
			  							$productDatavb = $conn->query($productSqlvb);

			  							while($rowvb = $productDatavb->fetch_array()){									 		
			  								echo "<option value='".$rowvb['HesBenId']."'>".$rowvb['HesbenName']."</option>";
										 	} // /while 
											
									   
			  						?>		
		  						</select>
								
						
								
								
                    <br/>
                         <label for="heslb_status" class="error" generated="true"></label>  
                    </div>
			  </div>
			  
			  <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name"> Staff Basic Salary in Tsh. </label>
                 <input  type="number" class="form-control" id="basicSalary" name="basicSalary" min="1" placeholder="Staff Basic Salary in Tsh" autocomplete="off" />
                    <br/>
                         <label for="basicSalary" class="error" generated="true"></label>  
                    </div>
			  </div>
			  
			  <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name"> Staff Bank Name </label>
                 <input  type="text" class="form-control" id="bankName" name="bankName"  placeholder="Staff Bank Name" autocomplete="off" />
                    <br/>
                         <label for="bankName" class="error" generated="true"></label>  
                    </div>
			  </div>
			  
			  <div class="col-sm-3">
			  <div class="form-group">
                 <label for="form_name"> Staff Bank Account No </label>
                 <input  type="text" class="form-control" id="bankAccountNo" name="bankAccountNo"  placeholder="Staff Bank Account No" autocomplete="off" />
                    <br/>
                         <label for="bankAccountNo" class="error" generated="true"></label>  
                    </div>
			  </div>
			  

			
			  	</div>	  
                </div>
			  
			
			  <div class="form-group submitButtonFooter">
			    <div class="col-sm-12">
			      <button type="submit" id="createOrderBtn" data-loading-text="Loading..." class="btn btn-success"><i class="glyphicon glyphicon-ok-sign"></i> Submit</button>
                  
			    </div>
			  </div>
			  
			  
			</form>                  
					
				</div>
				
				
                </div>
              </div>
            </div>
          </div>
        </div>
        <!-- /page content -->
		
		
		<?php
		include 'includes/footer.php';
		?>
		
        
      </div>
    </div>
	
		<script>
//$(function(){
	
$(document).ready(function(){
    $('input[name="rel_status"]').on('click', function(){
        if ($(this).val() == 'Have Religion'){
			 $('#textboxes1').show();
        }else {
			$('#textboxes1').hide();
		}
	
		
    });
});

$(document).ready(function(){
    $('input[name="upl_status"]').on('click', function(){
        if ($(this).val() == 'Yes'){
			 $('#textboxes7').show();
        }else {
			$('#textboxes7').hide();
		}
	
		
    });
});

$(document).ready(function(){
    $('input[name="dep_status"]').on('click', function(){
        if ($(this).val() == 'Yes'){
			 $('#textboxes8').show();
        }else {
			$('#textboxes8').hide();
		}
	
		
    });
});

$(document).ready(function(){
    $('input[name="parent_status"]').on('click', function(){
        if ($(this).val() == 'Yes'){
			 $('#textboxes10').show();
        }else {
			$('#textboxes10').hide();
		}
	
		
    });
});

$(document).ready(function(){
    $('input[name="kin_status"]').on('click', function(){
        if ($(this).val() == 'Yes'){
			 $('#textboxes11').show();
        }else {
			$('#textboxes11').hide();
		}
	
		
    });
});

$(document).ready(function(){
    $('input[name="emptype_id"]').on('click', function(){
        if ($(this).val() == 1){
			 $('#textboxes6').hide();
        }else if($(this).val() == 2){
			$('#textboxes6').show();
		}
	
		
    });
});

$(document).ready(function(){
    $('input[name="staffcate_id"]').on('click', function(){
        if ($(this).val() == 1){
			 $('#textboxes2').show();
			 $('#textboxes3').hide();
			 $('#textboxes4').hide();
			 $('#textboxes5').hide();
        }else if($(this).val() == 2){
			$('#textboxes5').show();
			$('#textboxes2').hide();
			$('#textboxes3').hide();
			$('#textboxes4').hide();
		}else if($(this).val() == 3){
			$('#textboxes3').show();
			$('#textboxes2').hide();
			$('#textboxes4').hide();
			$('#textboxes5').hide();
		}else{
			$('#textboxes4').show();
			$('#textboxes2').hide();
			$('#textboxes3').hide();
			$('#textboxes5').hide();
		}
	
		
    });
});

$(document).ready(function(){
    $('#dept_id').on('change', function(){
        var deptID = $(this).val();
        if(deptID){
            $.ajax({
                type:'POST',
                url:'ajax_Data.php',
                data:'dept_id='+deptID,
                success:function(html){
                    $('#sect_id').html(html);
                    $('#des_id').html('<option value="">Select Section first</option>'); 
                }
            }); 
        }else{
            $('#sect_id').html('<option value="">Select Department first</option>');
            $('#des_id').html('<option value="">Select Section first</option>'); 
        }
    });
    
    $('#sect_id').on('change', function(){
        var sectID = $(this).val();
        if(sectID){
            $.ajax({
                type:'POST',
                url:'ajax_Data.php',
                data:'sect_id='+sectID,
                success:function(html){
                    $('#des_id').html(html);
                }
            }); 
        }else{
            $('#des_id').html('<option value="">Select Section first</option>'); 
        }
    });
});


$(document).ready(function(){
    $('#region_id').on('change', function(){
        var regionID = $(this).val();
        if(regionID){
            $.ajax({
                type:'POST',
                url:'ajax_Data16.php',
                data:'region_id='+regionID,
                success:function(html){
                    $('#district_id').html(html);
                    $('#ward_id').html('<option value="">Select District first</option>'); 
                }
            }); 
        }else{
            $('#district_id').html('<option value="">Select Region first</option>');
            $('#ward_id').html('<option value="">Select District first</option>'); 
        }
    });
    
    $('#district_id').on('change', function(){
        var districtID = $(this).val();
        if(districtID){
            $.ajax({
                type:'POST',
                url:'ajax_Data16.php',
                data:'district_id='+districtID,
                success:function(html){
                    $('#ward_id').html(html);
                }
            }); 
        }else{
            $('#ward_id').html('<option value="">Select District first</option>'); 
        }
    });
});


$(document).ready(function(){
    $('#depart_id').on('change', function(){
        var departID = $(this).val();
        if(departID){
            $.ajax({
                type:'POST',
                url:'ajax_Data1.php',
                data:'depart_id='+departID,
                success:function(html){
                    $('#section_id').html(html);
                    $('#desi_id').html('<option value="">Select Section first</option>'); 
                }
            }); 
        }else{
            $('#section_id').html('<option value="">Select Department first</option>');
            $('#desi_id').html('<option value="">Select Section first</option>'); 
        }
    });
    
    $('#section_id').on('change', function(){
        var sectiID = $(this).val();
        if(sectiID){
            $.ajax({
                type:'POST',
                url:'ajax_Data1.php',
                data:'section_id='+sectiID,
                success:function(html){
                    $('#desi_id').html(html);
                }
            }); 
        }else{
            $('#desi_id').html('<option value="">Select Section first</option>'); 
        }
    });
});

 $("#id_frm").validate({
        rules: {
			
			"fname": {
                required: true
            },
			
			"mname": {
                required: true
            },
			
			"lname": {
                required: true
            },
			
			"gender_id": {
                required: true
            },
			
			"email": {
                required: true
            },
			
			"phone": {
                required: true
            },
			
			
			"bdate": {
                required: true
            },
			
			
			"empdate": {
                required: true
            },
			
			"marital_id": {
                required: true
            },
			
			"relId": {
                required: true
            },
			
			"denId": {
                required: true
            },
			
			"cont_dur_id": {
                required: true
            },
			
			
            "contStart": {
                required: true,
                //minlength: 10,
                // minlength: 10 // same rule twice
            },
			
			"edu_level_id": {
                required: true
            },
			
			"region_id": {
                required: true
            },
			
			"district_id": {
                required: true
            },
			
			"ward_id": {
                required: true
            },
			
			"heslb_status": {
                required: true
            },
			
			"basicSalary": {
                required: true
            },
			
			"bankName": {
                required: true
            },
			
			"bankAccountNo": {
                required: true
            },
			
			"company_address": {
                required: true
            }
			
            
        },
        messages: {
			
			"fname": {
                required: "Please Enter Staff First Name."
            },
			
			"mname": {
                required: "Please Enter Staff Middle Name"
            },
			
			"lname": {
                required: "Please Enter Staff Last Name"
            },
			
			"gender_id": {
                required: "Please Select Gender"
            },
			
            "email": {
                required: "Please Enter Staff Email Address"
            },
			
			"phone": {
                required: "Please Enter Staff Phone Number"
            },
			
			"bdate": {
                required: "Please Enter Staff Birth Date"
            },
			
			"empdate": {
                required: "Please Enter Staff Employment Date"
            },
			
			"marital_id": {
                required: "Please Select Marital Status."
            },
			
			
			"relId": {
                required: "Please Select Religion"
            },
			
			"denId": {
                required: "Please Select Denomination."
            },
			
			
			"cont_dur_id": {
                required: "Please Select Contract Duration"
            },
			
			"contStart": {
                required: "Please Enter Contract Start Date"
            },
			
			"edu_level_id": {
                required: "Please Select Education Level"
            },
			
			"region_id": {
                required: "Please Select Region"
            },
			
			"district_id": {
                required: "Please Select District"
            },
			
			"ward_id": {
                required: "Please Select Ward"
            },
			
			"heslb_status": {
                required: "Please Select Heslb Status"
            },
			
			"basicSalary": {
                required: "Please Select Staff Basic Salary"
            },
			
			"bankName": {
                required: "Please Select Staff Bank Name"
            },
			
			"bankAccountNo": {
                required: "Please Select Staff Bank Account No"
            },
			
			"company_address": {
                required: "Please Enter Company Address"
            }
			
			
        },
        // for demo
        //submitHandler: function(form) {
            //alert('valid form');
            //return false;
        //}
 });


</script>
	
	<script>
	// order date picker
		$("#bdate").datepicker();
		
		// delivery date picker
		$("#empdate").datepicker();
		
		$("#contStart").datepicker();
	
	</script>
	
	 <!-- Must -->
    <script src="custom/js/createStaff.js"></script>
    
	
    <!-- Must Custom Theme Scripts -->
    <script src="../build/js/custom.min.js"></script>
	
	<!-- file input -->
	<script src="assests/plugins/fileinput/js/plugins/canvas-to-blob.min.js'); ?>" type="text/javascript"></script>	
	<script src="assests/plugins/fileinput/js/plugins/sortable.min.js" type="text/javascript"></script>	
	<script src="assests/plugins/fileinput/js/plugins/purify.min.js" type="text/javascript"></script>
	<script src="assests/plugins/fileinput/js/fileinput.min.js"></script>	


	<!-- DataTables -->
	<script src="assests/plugins/datatables/jquery.dataTables.min.js"></script>

  </body>
</html>



<?php
}
?>