<?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>
	
  <!-- jquery ui must-->  
  <link rel="stylesheet" href="assests/jquery-ui/jquery-ui.min.css">
  <script src="assests/jquery-ui/jquery-ui.min.js"></script>
	
  <!-- Must Bootstrap must-->
    <script src="../vendors/bootstrap/dist/js/bootstrap.min.js"></script>
	
	
    <!-- Must -->
    <script src="custom/js/add_designation.js"></script>
	
	<script type="text/javascript">
$(document).ready(function(){
    $('#dept_id').on('change',function(){
        var regID = $(this).val();
        if(regID){
            $.ajax({
                type:'POST',
                url:'ajaxData10.php',
                data:'dept_id='+regID,
                success:function(html){
                    $('#sect_id').html(html);
                }
            }); 
        }else{
            $('#sect_id').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="dashboard.php">  <h2><span class="glyphicon glyphicon-step-backward"></span> Back</h2></a>
					</br></br>
					<font color="green">ADD DESIGNATION FORM</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;">
				 
			  <div class="success-messages"></div> <!--/success-messages-->

               <form class="form-horizontal" method="POST" action="php_action/add_designation.php" id="createOrderForm">
			   
			   <div class="controls">
			  <div class="row">
			  
			  <div class="col-sm-6">
			  <div class="form-group">
                 <label for="form_name">Department Name </label>
                 <select class="form-control" name="dept_id" id="dept_id" autocomplete="off">
			  						<option value="">~~SELECT~~</option>
			  						<?php
			  							$productSql = "SELECT departments.dept_id,departments.depart_name FROM departments ORDER BY depart_name";
			  							$productData = $conn->query($productSql);
			  							while($row = $productData->fetch_array()){									 		
			  								echo "<option value='".$row['dept_id']."'>".$row['depart_name']."</option>";
										 	} // /while 

			  						?>
		  						</select>
                      
                </div>
			   </div>
			   
			   
			   
			   <div class="col-sm-6">
			  <div class="form-group">
                 <label for="form_name">Section Name </label>
                 <select class="form-control" name="sect_id" id="sect_id" autocomplete="off">
			  						<option value="">~~SELECT~~</option>
		  						</select>
                      
                    </div>
			   </div>
			  
			  
			  	</div>	  
                </div>
             
			  <table class="table" id="productTable">
			  	<thead>
			  		<tr>	
                        <th style="width:5%;">No</th>		  			
			  			<th style="width:30%;">Designation</th>
						<th style="width:30%;">Short Name</th>
						<th style="width:30%;">Staff Category</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="designation_name[]" class="form-control" id="designation_name<?php echo $x; ?>"   placeholder="Designation" autocomplete="off"/>
			  					</div>
			  				</td>	
							
							
							<td style="padding-left:20px;">
			  					<div class="form-group">
								<input type="text" name="short_name[]" class="form-control" id="short_name<?php echo $x; ?>"   placeholder="Short Name" autocomplete="off"/>
			  					</div>
			  				</td>

                            <td style="margin-left:20px;">
			  					<div class="form-group">

			  					<select class="form-control" name="staffcate_id[]" id="staffcate_id<?php echo $x; ?>">
			  						<option value="">~~SELECT~~</option>
			  						<?php
			  							$productSql3 = "SELECT * FROM staff_category";
			  							$productData3 = $conn->query($productSql3);

			  							while($row3 = $productData3->fetch_array()) {									 		
			  								echo "<option value='".$row3['staffcate_id']."'>".$row3['staffcate_name']."</option>";
										 	} // /while 

			  						?>
		  						</select>
			  					</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++;
			  		} // /for
			  		?>
			  	</tbody>			  	
			  </table>
			  
			  <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>
			  </br></br>
			  
			
			  <div class="form-group submitButtonFooter">
			    <div class="col-sm-offset-2 col-sm-10">
			    

			      <button type="submit" id="createOrderBtn" data-loading-text="Loading..." class="btn btn-success"><i class="glyphicon glyphicon-ok-sign"></i> Submit</button>

			      <button type="reset" class="btn btn-default" onclick="resetOrderForm()"><i class="glyphicon glyphicon-erase"></i> Reset</button>
			    </div>
			  </div>
			 
			</form>                    
					
				</div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <!-- /page content -->
		
		
		<?php
		include 'includes/footer.php';
		?>
        
      </div>
    </div>

    
    
	
    <!-- 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
}
?>