<?php include("../secure.php"); ?>
<!DOCTYPE html>
<html lang="en" data-layout="vertical" data-topbar="light" data-sidebar="dark" data-sidebar-size="lg" data-sidebar-image="none">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
        <meta name="description" content="Smarthr - Bootstrap Admin Template">
		<meta name="keywords" content="admin, estimates, bootstrap, business, corporate, creative, management, minimal, modern, accounts, invoice, html5, responsive, CRM, Projects">
        <meta name="author" content="Dreamguys - Bootstrap Admin Template">
        <meta name="robots" content="noindex, nofollow">
        <title>Dept - HR Marsa System </title>
        
                <style>
@font-face {
    font-family: 'DroidSansArabic';
    src: url('../../font/DroidSansArabic.ttf');
}
body * {
    font-family: "DroidSansArabic", sans-serif ;
}
    </style>
    <style>
		.dropdown {
			position: relative;
			display: inline-block;
		}
		
		.dropdown-content {
			display: none;
			position: absolute;
			z-index: 1;
			background-color: #f9f9f9;
			min-width: 160px;
			box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
			padding: 12px 16px;
			border-radius: 5px;
		}
		
		.dropdown:hover .dropdown-content {
			display: block;
		}
		
		.dropdown-checkbox label {
			display: block;
			margin-bottom: 10px;
		}
		
		.dropdown-checkbox input[type="checkbox"] {
			margin-right: 10px;
		}
		
		.selected-items {
			margin-top: 10px;
			font-weight: bold;
		}
	</style>
		<?php 
	$lang=$_GET['lang'];  
    $link_lang='lang='.$lang;
    $company_id=$_GET['company_id']; 
    $main_system_id='2222';
    $type_l = $_GET["type"];
    $vacation_id = $_GET["v_id"];
	?> 
	
	 <?php include("../languege_filee_hr.php");?>
	 
	 <?php include("../hr_permission.php");?>
     <?php include("../Function/level_salf.php");?>
		<!-- Favicon -->
        <link rel="shortcut icon" type="image/x-icon" href="../../assets/img/favicon.png">
        
        <link rel="stylesheet" href="../../assets/plugins/alertify/alertify.min.css">
        
		<?php
	if($lang=='ar'){
	?>


         <link rel="stylesheet" href="../../assets/css/bootstrap.rtl.min.css">
   
		<!-- Fontawesome CSS -->
        <link rel="stylesheet" href="../../assets/plugins/fontawesome/css/fontawesome.min.css">
    	<link rel="stylesheet" href="../../assets/plugins/fontawesome/css/all.min.css">

		<!-- Lineawesome CSS -->
        <link rel="stylesheet" href="../../assets/css/line-awesome.min.css">
		<link rel="stylesheet" href="../../assets/css/material.css">
		
		<!-- Fontawesome CSS -->
        <link rel="stylesheet" href="../../assets/css/font-awesome.min.css">
		
		<!-- Datatable CSS -->
		<link rel="stylesheet" href="../../assets/css/dataTables.bootstrap4.min.css">
		
		<!-- Main CSS -->
        <link rel="stylesheet" href="../../assets/css/style.css">
             
             
             
             
        <?php }else{ ?>
            <link rel="stylesheet" href="../../assets_en/css/bootstrap.min.css">
   
		<!-- Fontawesome CSS -->
        <link rel="stylesheet" href="../../assets_en/plugins/fontawesome/css/fontawesome.min.css">
    	<link rel="stylesheet" href="../../assets_en/plugins/fontawesome/css/all.min.css">

		<!-- Lineawesome CSS -->
        <link rel="stylesheet" href="../../assets_en/css/line-awesome.min.css">
		<link rel="stylesheet" href="../../assets_en/css/material.css">
		
		<!-- Fontawesome CSS -->
        <link rel="stylesheet" href="../../assets_en/css/font-awesome.min.css">
		
		<!-- Datatable CSS -->
		<link rel="stylesheet" href="../../assets_en/css/dataTables.bootstrap4.min.css">
		
		<!-- Main CSS -->
        <link rel="stylesheet" href="../../assets_en/css/style.css">
        

            <?php } ?>
		
		 
    </head>
    <body>
		<!-- Main Wrapper -->
        <div class="main-wrapper">
		
			<!-- Toper -->
            <?php include("../toper.php"); ?>
			<!-- /Toper -->
			
			<!-- header -->
            <?php include("../header.php");?>
			
			<!-- /header -->
			
			<!-- Page Wrapper -->
            <div class="page-wrapper">
			
				<!-- Page Content -->
                <div class="content container-fluid">
				
					<!-- Page Header -->
					<div class="page-header">
						<div class="row align-items-center">
							<div class="col">
                                <?php 
                                if($lang=='ar'){$level_salf="مستويات نوع الإجازه";}else{$employy_solf="Type Vacation level";}
                                if($lang=='ar'){$add_level="إضافة مستوى";}else{$add_level="Add Level";}
                                if($lang=='ar'){$add_promolevel="إضافة مستوى الترقية";}else{$add_promolevel="Add Promotion level";}
                                if($lang=='ar'){$choose_company="حدد الشركه حتى تتمكن من إضافة مستوى";}else{$choose_company="choose company to add level";}
                                ?>
								<h3 class="page-title"><?php echo $level_salf; ?></h3>
								<ul class="breadcrumb">
									<li class="breadcrumb-item"><a href="../main/index.php?<?php echo $link_lang; ?>&company_id=<?php echo $company_id; ?>"><?php echo $Dashboard; ?></a></li>
									<li class="breadcrumb-item active"><?php echo $level_salf; ?></li>
								</ul>
							</div>
							<div class="col-auto float-end ms-auto">
							
							

                            
							 <?php 
							
							 if($urow['user_type']=='Top_Manager' or $urow['user_type']=='System_Manager'){ ?>
                             <?php if($company_id=="all_company"){ ?>
                                <a href="#" class="btn add-btn" data-bs-toggle="modal" data-bs-target=""><i class="fa fa-plus"></i><?php  echo $choose_company; ?></a>
                            <?php }else{ ?>
                                <?php include("../modals/hr_add_level_modal.php");?>
                                <a href="#" class="btn add-btn" data-bs-toggle="modal" data-bs-target="#add_salf_level"><i class="fa fa-plus"></i><?php  echo $add_level; ?></a>
                            <?php }?>
								
                              
                                <?php }else{ ?>
							
							<?php }  ?>
                           
							</div>
						</div>
					</div>
					<!-- /Page Header -->
					<div class="card">
						<div class="card-body">
							<?php 
                           
                            if($lang=='ar'){$acceptrefuselevel="تهيئة مستويات الموافقة والرفض";}else{$acceptrefuselevel="Accept Refuse advance";}
                            if($lang=='ar'){$promo="تهيئة مستويات الترقية";}else{$promo="promotion levels";}
                            
                            ?>
							<ul class="nav nav-tabs nav-tabs-solid nav-justified">
                            
		                       <li class="nav-item"><a class="nav-link a active" href="hr_types_vacations_levels.php?v_id=<?php echo $vacation_id;?>&type=vacation&<?php echo $link_lang; ?>&company_id=<?php echo $company_id;?>" ><?php echo $acceptrefuselevel;?></a></li>
                               <li class="nav-item"><a class="nav-link a " href="hr_advance_promo.php?<?php echo $link_lang; ?>&company_id=<?php echo $company_id;?>" ><?php echo $promo;?></a></li>
                             
                            </ul>
						</div>
					</div>
					<div class="row">
					    
		<div class="alert1" id="messages" style="font-family:'Tajawal',sans-serif;">
		    
         	   <?php if(isset($_SESSION['message'])): ?>
            <div class="alert3 alert3-success">
            <?php echo $_SESSION['message']; ?>
            <script>
    setTimeout(function() {
        let alert = document.querySelector(".alert3");
            alert.remove();
    }, 3000);
    </script>
           </div>
            <?php endif; ?>
           <?php unset($_SESSION['message']); ?></div>
			
			
			<?php
			   $modal_table_name='holidays_waseet_tbl';
              
                $id_name='holidays_waseet';
                  $proccess_details_delete='حذف العطله رقم '.$modal_id;
                   $proccess_details_en_delete='Delete Holiday Number'.$modal_id;
                  $proccess_details_delete_enable='تنشيط العطله رقم '.$modal_id;
                   $proccess_details_en_delete_enable='Enable Holiday Number'.$modal_id;
                  $proccess_details_delete_disable='الغاء تنشيط العطله رقم '.$modal_id;
                $proccess_details_en_delete_disable='Disable Holiday Number'.$modal_id;
               
                $proccess_details_enable=' تنشيط القسم رقم '.$modal_id;
                 $proccess_details_en_enable='Enable Holiday Number'.$modal_id;        
			
			?>		    
			<input type="hidden" name="modal_table_name" id="modal_table_name" readonly value="<?php echo $modal_table_name; ?>"> 
            <input type="hidden" name="id_name" id="id_name" readonly value="<?php echo $id_name; ?>"> 
           <input type="hidden" name="proccess_details_delete" id="proccess_details_delete" readonly value="<?php echo $proccess_details_delete; ?>"> 
           <input type="hidden" name="proccess_details_en_delete" id="proccess_details_en_delete" readonly value="<?php echo $proccess_details_en_delete; ?>">
           
           
              <input type="hidden" name="$proccess_details_delete_disable" id="proccess_details_delete_disable" readonly value="<?php echo $proccess_details_delete_disable; ?>"> 
           <input type="hidden" name="proccess_details_en_delete_disable" id="proccess_details_en_delete_disable" readonly value="<?php echo $proccess_details_en_delete_disable; ?>">
           
           
           <input type="hidden" name="proccess_details_enable" id="proccess_details_enable" readonly value="<?php echo $proccess_details_enable; ?>"> 
           <input type="hidden" name="proccess_details_en_enable" id="proccess_details_en_enable" readonly value="<?php echo $proccess_details_en_enable; ?>">
           
					    
						<div class="col-md-12">
							<div>
							    <div class="table-responsive">
							    <table class="table">
								<!--table class="table table-striped custom-table mb-0 datatable" -->
                                <thead>
										<tr>
                                    <?php 
                                        if($lang=='ar'){$employ="الموظف";}else{$employ="Employ";}
                                        if($lang=='ar'){$level="المستوى";}else{$level="level";}
                                        if($lang=='ar'){$level="المستوى";}else{$level="level";}
                                        if($lang=='ar'){$Rearrangement="إعادة ترتيب";}else{$Rearrangement="Re arrangement";}
                                        if($lang=='ar'){$level="المستوى";}else{$level="level";}
                                        if($lang=='ar'){$rejected_move_on="في حالة الرفض الانتقال الى ";}else{$rejected_move_on="If rejected, move on";}
                                        if($lang=='ar'){$Reset="اعادة تعيين";}else{$Reset="Reset";}
                                    ?>	
                                            <th><?php echo $id; ?></th>
											<th><?php echo $level; ?></th>
											<th><?php echo $the_companyr; ?></th>
											<!--<th><?php //echo $solaf_frmsmak_name; ?></th> -->
                                            <th><?php echo $dept; ?></th>
                                            <th><?php echo $employ; ?></th>
                                            <th><?php echo $Rearrangement; ?></th>
                                            <th><?php echo $rejected_move_on; ?></th>
                                            <th><?php echo $Reset; ?></th>
										</tr>
									</thead>
									<tbody>
                                   
                                    <?php
                    include("dbConfig.php");
                    
                    if(($urow['user_type']=='Top_Manager' or $urow['user_type']=='System_Manager')or($view_solaf_ul==1)){
                        if($company_id=='all_company'){
                            
                               $sql_cw="SELECT * FROM hr_advance_level_tbl where  company_id IN ('$ids') AND company_id!='' AND deleted='0' and type='$type_l' ORDER BY level ASC";
                                }else{
                               $sql_cw="SELECT * FROM hr_advance_level_tbl where company_id='$company_id' AND company_id!='' AND deleted='0' and type='$type_l' ORDER BY level ASC ";
                                }
                                
                               }else{
                                
                                    $sql_cw="SELECT * FROM hr_advance_level_tbl where employ_id='".$urow['user_id']."'AND company_id!='' AND deleted='0' and type='$type_l' ORDER BY level ASC";  
                             
                               }

                        $result_cw = $conn->query($sql_cw);
                        if ($result_cw->num_rows > 0) {
                          while($row_cw = $result_cw->fetch_assoc()) {
                        
                          ?> 
							    
                                        <tr class="D">
											
											<td><?php echo $row_cw["id"];?></td>
											<td><?php echo $row_cw["level"];?>
                                            <input type="hidden" name="lev_num" class="lev_num" id="lev_num<?php echo $row_cw["id"];?>" readonly value="<?php echo $row_cw["level"]; ?>"> 
                                            </td>
											<td>
                                            <input type="hidden" name="companyy_id" class="companyy_id" id="companyy_id<?php echo $row_cw["id"];?>" readonly value="<?php echo $row_cw["company_id"]; ?>">   
                                            <?php 
                                            $sql_company = "SELECT * FROM main_company_tbl where company_id='".$row_cw["company_id"]."'";
                                              $result_company = $conn->query($sql_company);
                                                 if ($result_company->num_rows > 0) {
                                                    while($row_company = $result_company->fetch_assoc()) { 
                                                     if($lang=='ar'){$company_name=$row_company["company_name_ar"];}else{$company_name=$row_company["company_name_en"];}
                                                    echo $company_name;
                                                    }}
                                                    ?>
                                            </td>
                                            <td>
                                            <?php 
                                             if($lang=='ar'){$dept_manager="مدير القسم";}else{$dept_manager="dept_manager";}
                                            if($row_cw["dept_id"]==""){
                                                echo $dept_manager;
                                            }else{
                                            $sql_dept = "SELECT * FROM dept_tb where dept_id='".$row_cw["dept_id"]."'";
                                              $result_dept = $conn->query($sql_dept);
                                                 if ($result_dept->num_rows > 0) {
                                                    while($row_dept = $result_dept->fetch_assoc()) { 
                                                     if($lang=='ar'){$dept_name=$row_dept["dept_name"];}else{$dept_name=$row_dept["dept_name_en"];}
                                                    echo $dept_name;
                                                    }}
                                                }
                                                    ?>
                                            </td>
											<td><?php 
                                              $sql_lm = "SELECT * FROM hr_level_employ_approval where company_id='".$row_cw["company_id"]."' and level='".$row_cw["level"]."'";
                                              $result_lm = $conn->query($sql_lm);
                                               if ($result_lm->num_rows > 0) {
                                                while($row_lm = $result_lm->fetch_assoc()) { 
                                                    $sql_employ = "SELECT * FROM hr_employ_tbl where employ_id='".$row_lm["employ_id"]."'";
                                                    $result_employ = $conn->query($sql_employ);
                                                     if ($result_employ->num_rows > 0) {
                                                      while($row_employ = $result_employ->fetch_assoc()) { 
                                                        if($lang=='ar'){$employ_name=$row_employ["employ_name_ar"];}else{$employ_name=$row_employ["employ_name_en"];}
                                                    echo $employ_name."</br>";    
                                                    }}
                                                }}

                                            
                                            ?></td>
                                          
                                            <td>
                                                <?php
                                            if($lang=='ar'){$at_the_begning="في البداية";}else{$at_the_begning="at the begning";}
                                            if($lang=='ar'){$after="بعد";}else{$after="after";}
                                            ?>
                                                <select class="form-control O_Level" id="o_level<?php echo $row_cw["id"];?>" data-id='<?php echo $row_cw["id"];?>'>
                                                <option value=""> .... </option>
                                               
 <?php
 if(($urow['user_type']=='Top_Manager' or $urow['user_type']=='System_Manager')or($view_solaf_ul==1)){
    if($company_id=='all_company'){
        
           $sql="SELECT * FROM hr_advance_level_tbl where  company_id IN ('$ids') AND company_id!='' AND deleted='0' and type='salf'";
            }else{
           $sql="SELECT * FROM hr_advance_level_tbl where company_id='$company_id'AND company_id!='' AND deleted='0' and type='salf'";
            }
            
           }else{
            
                $sql="SELECT * FROM hr_advance_level_tbl where employ_id='".$urow['user_id']."'AND company_id!='' AND deleted='0' and type='salf'";  
         
           }
 $result = $conn->query($sql);
  if ($result->num_rows > 0) {?>
     
     <?php  while($row = $result->fetch_assoc()) { 
                 if($row["dept_id"]=="" && $row_cw["dept_id"]!=""){ ?>
                   <option value="<?php echo $row["id"];?>" data-id="<?php echo $row["level"]?>">مدير القسم</option>
                 <?php }   ?>              
    <?php $sql_dept = "SELECT * FROM dept_tb where dept_id='".$row["dept_id"]."' and dept_id!='".$row_cw["dept_id"]."'";
     $result_dept = $conn->query($sql_dept);
      if ($result_dept->num_rows > 0) {?>
      
         <?php  while($row_dept = $result_dept->fetch_assoc()) { 
          
if($lang=='ar'){$dept_name=$row_dept["dept_name"];}else{$dept_name=$row_dept["dept_name_en"];}
     
?>

    <option value="<?php echo $row["id"];?>" data-id="<?php echo $row["level"]?>"><?php echo $accept." ".$dept_name ;?></option>

  

        <?php }}else{ ?>
            
      <?php  } ?>
         
     <?php }
  } else {?>
  <option value="0">لا يوجد</option>
    <?php  }?>
  </select>
                                            </td>
                                            <td><?php 
                                            if($row_cw["level_refuse"]=="returnto_employee" && $lang=="ar"){
                                                echo "إرجاع للموظف";
                                            }elseif($row_cw["level_refuse"]=="returnto_employee" && $lang=="en"){
                                                echo "returnto to employee";
                                            }elseif($row_cw["level_refuse"]=="final_reject" && $lang=="ar"){
                                                echo "رفض نهائي";
                                            }elseif($row_cw["level_refuse"]=="final_reject" && $lang=="en"){
                                                echo "final_reject";
                                            }else{
                                                if($lang=="ar"){
                                                    echo "المستوى"." ".$row_cw["level_refuse"];
                                                }else{
                                                    echo "Level"." ".$row_cw["level_refuse"];
                                                }
                                               
                                            }
                                           ?></td>
                                            <td>
                                                <?php
                                            if($lang=='ar'){$at_the_begning="في البداية";}else{$at_the_begning="at the begning";}
                                            if($lang=='ar'){$after="بعد";}else{$after="after";}
                                            ?>
                                                <select class="form-control reject_Level" id="reject_Level<?php echo $row_cw["id"];?>" data-id='<?php echo $row_cw["id"];?>'>
                                                <option value=""> .... </option>
                                                <option value="returnto_employee"> إرجاع للموظف </option>
                                                <option value="final_reject"> رفض نهائي </option>
 <?php
 if(($urow['user_type']=='Top_Manager' or $urow['user_type']=='System_Manager')or($view_solaf_ul==1)){
    if($company_id=='all_company'){
        
           $sql="SELECT * FROM hr_advance_level_tbl where  company_id IN ('$ids') AND company_id!='' AND deleted='0' and type='salf'";
            }else{
           $sql="SELECT * FROM hr_advance_level_tbl where company_id='$company_id'AND company_id!='' AND deleted='0' and type='salf'";
            }
            
           }else{
            
                $sql="SELECT * FROM hr_advance_level_tbl where employ_id='".$urow['user_id']."'AND company_id!='' AND deleted='0' and type='salf'";  
         
           }
 $result = $conn->query($sql);
  if ($result->num_rows > 0) {?>
     
     <?php  while($row = $result->fetch_assoc()) { 
                     if($row["dept_id"]=="" && $row_cw["dept_id"]!=""){ ?>
                        <option value="<?php echo $row["id"];?>" data-id="<?php echo $row["level"]?>">مدير القسم <?php echo $row["level"];?></option>
                      <?php }   ?>
                      <?php             
     $sql_dept = "SELECT * FROM dept_tb where dept_id='".$row["dept_id"]."' and dept_id!='".$row_cw["dept_id"]."'";
     $result_dept = $conn->query($sql_dept);
      if ($result_dept->num_rows > 0) {?>
      
         <?php  while($row_dept = $result_dept->fetch_assoc()) { 
          
if($lang=='ar'){$dept_name=$row_dept["dept_name"];}else{$dept_name=$row_dept["dept_name_en"];}
     
?>

    <option value="<?php echo $row["level"];?>" data-id="<?php echo $row["level_refuse_stat_details_ar"]?>"><?php echo $accept." ".$dept_name."".$row["level"];?></option>

  

        <?php }}else{ ?>
            
      <?php  } ?>
         
     <?php }
  } else {?>
  <option value="0">لا يوجد</option>
    <?php  }?>
  </select>
                                            </td>
											<?php }} ?>
										</tr>
								

									</tbody>
								</table>
							</div>
						</div>
					</div>
                </div>
                	</div>
				<!-- /Page Content -->
				
				<!-- Edit Department Modal -->
				<div id="edit_department" class="modal custom-modal fade" role="dialog">
					<div class="modal-dialog modal-dialog-centered" role="document">
						<div class="modal-content">
							<div class="modal-header">
								<h5 class="modal-title">Edit Department</h5>
								<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
									<span aria-hidden="true">&times;</span>
								</button>
							</div>
							<div class="modal-body">
								<form>
									<div class="form-group">
										<label>Department Name <span class="text-danger">*</span></label>
										<input class="form-control" value="IT Management" type="text">
									</div>
									<div class="submit-section">
										<button class="btn btn-primary submit-btn">Save</button>
									</div>
								</form>
							</div>
						</div>
					</div>
				</div>
				
            </div>
			<!-- /Page Wrapper -->

        </div>
		<!-- /Main Wrapper -->
		
	 
		<!-- sitting -->
		<?php include("../setting.php"); ?>
	    <!-- /sitting -->

	<!-- Footer -->
		<?php include("../footer.php"); ?>
		<!-- /Footer -->

	 <!-- jQuery -->
        <script src="../../assets/js/jquery-3.6.0.min.js"></script>

        <!-- Feather Icon JS -->
        <script src="../../assets/js/feather.min.js"></script>

        <!-- Slimscroll JS -->
        <script src="../../assets/js/jquery.slimscroll.min.js"></script>

        <!-- Datatable JS -->
        <script src="../../assets/js/jquery.dataTables.min.js"></script>
        <script src="../../assets/js/dataTables.bootstrap4.min.js"></script>
        
        <!-- Bootstrap Core JS -->
        <script src="../../assets/js/bootstrap.bundle.min.js"></script>

        <!-- Custom JS -->
        <script src="../../assets/js/script.js"></script>
      

		 <!-- Theme Settings JS -->
		<script src="../../assets/js/layout.js"></script>
		<script src="../../assets/js/theme-settings.js"></script>

		<!-- Custom JS -->
		<!--script src="../../assets/js/app.js"></script-->
		
		<script src="../script_lang.js"></script> 
		
		  <!-- Alertify JS -->
		<script src="../../assets/plugins/alertify/alertify.min.js"></script>
		<!--script src="../../assets/plugins/alertify/custom-alertify.min.js"></script-->
        <!-- /Alertify JS -->
		
	    <script>
  $(document).ready(function(e) {
   $(".O_Level").change(function(){
 var lang = '<?php echo $lang;?>';
 if(lang=="ar"){
    var confirmation = confirm('هل انت متاكد انك تريد التبديل');
 }else{
    var confirmation = confirm('Are you sure you want to proceed?');
 }
  
 if (confirmation) {
    var id_first = $(this).attr('data-id');
    var selectedOption = $('#o_level'+id_first).find('option:selected');
    var id_second = selectedOption.val();
    var level_second = selectedOption.data('id');
    var level_first = $("#lev_num"+id_first).val();
    //alert(id_first);
    //alert(level_first);
    //alert(id_second);
    //alert(level_second);
    var company_id = $("#companyy_id"+id_first).val();
   
   $.ajax({
    type: "POST",
    url: "hr_reorder_level.php",
    data: {
        id_first:id_first,id_second:id_second,level_first:level_first,level_second:level_second,company_id:company_id				
    },
    success: function(data) {
     if(data==1){
alert("تمت عملية اعادة الترتيب بنجاح");
location.reload();
     }
    },
    error:function(data){
        
       alert(data); //===Show Error Message====
    }
    });
 }
      });
      });
       </script>	
<script>
  $(document).ready(function(e) {
   $(".reject_Level").change(function(){
 var lang = '<?php echo $lang;?>';
 if(lang=="ar"){
    var confirmation = confirm('هل انت متاكد انك تريد التبديل');
 }else{
    var confirmation = confirm('Are you sure you want to proceed?');
 }
  
 if (confirmation) {
    var id_first = $(this).attr('data-id');
    var selectedOption = $('#reject_Level'+id_first).find(":selected").val();
    var company_id = $("#companyy_id"+id_first).val();
    
   $.ajax({
    type: "POST",
    url: "hr_reorder_refuse_level.php",
    data: {
        id_first:id_first,selectedOption:selectedOption,company_id:company_id				
    },
    success: function(data) {
     if(data==1){
alert("تم اعادة التعيين بنجاح");
location.reload();
     }
    },
    error:function(data){
        
       alert(data); //===Show Error Message====
    }
    });
 }
      });
      });
       </script>	
       
       
       
       	<script>
       	 var modal_table_name=$('#modal_table_name').val();
       	 var id_name=$('#id_name').val();
       	 var proccess_details_delete_disable=$('#proccess_details_delete_disable').val();
       	 var proccess_details_en_delete_disable=$('#proccess_details_en_delete_disable').val();
       	 
       	 var proccess_details_enable=$('#proccess_details_enable').val();
       	 var proccess_details_en_enable=$('#proccess_details_en_enable').val();
       	  
    $(".checktoggle").click(function(e){
        var id = $(this).attr('data-id');
        //alert(id);
        
           var id_check=$('#id_check').val(); 
        if(id_check==''){
      alertify.error(message_per);
        }else{
        
        if($('#user'+id).is(':checked') ){
      if(confirm(message_disabled)){
         //alert("Checkbox Is checked");
    $('#user'+id).prop('checked', true);
    
   //======================
      var add_user_id=$('#add_user_id').val();
      var company_id=$('#company_id').val();
      var g = $(this).attr('data-id');
      var date_did = $("#date_did"+g).val();
   //alert(g);
          $.post('../modals/hr_disabeld_code.php', {'g':g,'add_user_id':add_user_id,'company_id':company_id,'modal_table_name':modal_table_name,'id_name':id_name,'proccess_details_delete_disable':proccess_details_delete_disable,'proccess_details_en_delete_disable':proccess_details_en_delete_disable}, function(r) {
              //alert(r);
        if (r == 1) {
     //  alert("تمت العمليه بنجاح");
      alertify.error(message_success);
         // window.location.reload();
         $(".D"+i).css("background-color", "#ccc");
         $(".D"+i).fadeOut("slow");
       

               }
             });
             
      }else{
        return false;
      }
   
   //======================
}
else{
   // alert("Checkbox Is not checked");
    $('#user'+id).prop('checked', false);
     if(confirm(message_enabled)){
    
      //======================
      var add_user_id=$('#add_user_id').val();  
      var company_id=$('#company_id').val();
      var g = $(this).attr('data-id');
      var date_did = $("#date_did"+g).val();
  // alert(g);
          $.post('../modals/hr_enable_code.php', {'g':g,'add_user_id':add_user_id,'company_id':company_id,'modal_table_name':modal_table_name,'id_name':id_name,'proccess_details_enable':proccess_details_enable,'proccess_details_en_enable':proccess_details_en_enable}, function(r) {
             // alert(r);
        if (r == 1) {
     //  alert("تمت العمليه بنجاح");
   alertify.success(message_success);
         $(".D"+i).css("background-color", "#ccc");
         $(".D"+i).fadeOut("slow");
          window.location.reload();

               }
             });
             
      }else{
        return false;
      }
   
 }  //====================== 
    
}
    });
</script>
       
       
		
		
   <style>
.alert {
  text-align: center;
  padding: 10px;
  background: rgb(168, 240, 177);
  color: green;
  margin-bottom: 10px;
  display: none;
}
.alert3 {
  text-align: center;
  padding: 10px;
  background: rgb(168, 240, 177);
  color: green;
  margin-bottom: 10px;
  
}
.alert4 {
  text-align: center;
  padding: 10px;
  margin-bottom: 10px;
  border-color: #ebad30;
  font-size:18px;
}

</style>	
		
    </body>
</html>




