<?php include 'inc_classes.php';
$action = $_POST['action'];  
// $staff_id='';
if($action=='employee') 
{
     $emp_name=$_POST['emp_names'];
     $s_name="select name,admin_id from site_setting where 1 and system_status='Enabled' and name like '%".$emp_name."%' order by name ASC";
    $ptr_anme = mysql_query($s_name);
    echo ' <table class="table no-margin" style="text-align:left" id="table1">';
	while($update_data= mysql_fetch_array($ptr_anme)){
         echo "<tr id=".$update_data['admin_id']."><td><input type='checkbox' id='check_tab_".$update_data['admin_id']."' name='check_tab1' value='".$update_data['admin_id']."' onclick='select_me(".$update_data['admin_id'].");'></td><td id='staffName_".$update_data['admin_id']."'>".ucfirst($update_data['name'])."</td></tr>";
        }
        echo '</table>';
}
if($action=='staff') 
{
	$branch_name=$_POST['branch_name'];
    $sel_branch="select cm_id from site_setting where branch_name='".$branch_name."'";
    $ptr_branch = mysql_query($sel_branch);
	$branch_data= mysql_fetch_array($ptr_branch);
  echo  '<option  value="">Select Staff</option>';
        $categary="select admin_id,name from site_setting where cm_id='".$branch_data['cm_id']."'and system_status='Enabled' order by name ASC";
        $c_query=mysql_query($categary);
        while($data_c=mysql_fetch_array($c_query))
        {
            // $staff_id=$data_c['admin_id'];
           echo  '<option  value="'.$data_c['admin_id'].'">'.strip_tags(ucfirst($data_c['name'])). '</option>';
        }	
}
if($action=='admin')
{
	$branch_name1=$_POST['branch_name1'];
    $sel_branch1="select cm_id from site_setting where branch_name='".$branch_name1."'";
    $ptr_branch1 = mysql_query($sel_branch1);
	$branch_data1= mysql_fetch_array($ptr_branch1);
  echo  '<option  value="">Assinged To</option>';
        $branch="select admin_id,name from site_setting where cm_id='".$branch_data1['cm_id']."' and system_status='Enabled' order by name ASC";
        $ptr_branch=mysql_query($branch);
        while($data=mysql_fetch_array($ptr_branch))
        {
           echo  '<option  value="'.$data['admin_id'].'">'.strip_tags(ucfirst($data['name'])). '</option>';
        }	
}
if($action=='hours') 
{
	$priority=$_POST['priority'];
    $sel_priority="select hours,points from tk_performance where priority='".$priority."' order by hours ASC";
    $ptr_priority = mysql_query($sel_priority);
    echo  '<option  value="">Select Hours</option>';
	while($priority_data= mysql_fetch_array($ptr_priority)){
           echo  '<option  value="'.$priority_data['hours'].'">'.$priority_data['hours'].' [ Hours ]</option>';
}
}
if($action=='hold') 
{
$priority=$_POST['priority'];
$status=$_POST['status'];
if($status=='halt'){
echo '<div style="border-style: ridge none ridge none; width:50%">';
    echo '<div class="form-group">';
        echo '<label>Un-Halt Date</label>';
        echo '<div class="input-group date">';
            echo '<div class="input-group-addon"><i class="fa fa-calendar"></i></div>';
            echo '<input type="text" class="form-control pull-left datepicker"  style="width:210px;" name="unhalt_date" id="datepicker1" value="">';
        echo '</div>';
    echo '</div>';
    echo '<div class="form-group">';
        echo '<div><label><span style="color:red">*</span>Priority &nbsp;&nbsp;<span style="color:red"></span></label></div>';
        echo '<select class="form-control select2"  style="width:250px;" name="priority" id="select1">';
            echo '<option value="">Select </option>';
            echo '<option value="low">Low </option>';
            echo '<option value="medium">Medium </option>';
            echo '<option value="high">High </option>';
        echo '</select>';
    echo '</div>';
    echo '<div class="form-group">';
        echo '<label>New Dead Line</label>';
        echo '<div class="input-group date">';
            echo '<div class="input-group-addon"><i class="fa fa-calendar"></i></div>';
            echo '<input type="text" class="form-control pull-left datepicker"  style="width:210px;" name="up_deadline_date" id="datepicker2" value="">';
        echo '</div>';
    echo '</div>';
echo '</div>';
}
else{
    echo "";
}
}
// if($action=='reportstaff') 
// {
// 	 $branch_names=$_POST['branch_names'];
//     $sel_branchs="select cm_id from site_setting where branch_name='".$branch_names."'";
//     $ptr_branchs = mysql_query($sel_branchs);
// 	$branch_datas= mysql_fetch_array($ptr_branchs);
//   echo  '<option  value="">Select Staff</option>';
//         $categarys="select admin_id,name from site_setting where cm_id='".$branch_datas['cm_id']."'and system_status='Enabled' order by name ASC";
//         $c_querys=mysql_query($categarys);
//         while($datas=mysql_fetch_array($c_querys))
//         {
//            echo  '<option  value="'.$datas['admin_id'].'">'.strip_tags(ucfirst($datas['name'])). '</option>';
//         }	
// }
if($action=='reportstaff') 
{
	 $branch_names=$_POST['branch_names'];
    $sel_branchs="select cm_id from site_setting where branch_name='".$branch_names."'";
    $ptr_branchs = mysql_query($sel_branchs);
	$branch_datas= mysql_fetch_array($ptr_branchs);
  echo  '<option  value="">Select Staff</option>';
        $categarys="select admin_id,name from site_setting where cm_id='".$branch_datas['cm_id']."'and system_status='Enabled' order by name ASC";
        $c_querys=mysql_query($categarys);
        while($datas=mysql_fetch_array($c_querys))
        {
           echo  '<option  value="'.$datas['admin_id'].'">'.strip_tags(ucfirst($datas['name'])). '</option>';
        }	
}
if($action=='active') 
{
	 $repeate_valids=$_POST['repeat_valid'];
     $task_ids=$_POST['task_id'];
     $upd_task="update tk_individual_task set repetation_valid='". $repeate_valids."' where staff_task_id='".$task_ids."'";
    $ptr_upd_task = mysql_query($upd_task);
}
if($action=='validation') 
{
	 $validation=$_POST['valid'];
     $tasks_id=$_POST['tasks_id'];
     $admin_id=trim($_POST['admin_id']);
    $update_status="update tk_individual_task set `Validation`='".$validation."',`validation_admin`='".$admin_id."' where staff_task_id='".$tasks_id."'";
    $ptr_upd_tasks = mysql_query($update_status);
}
if($action=='faculty') 
{
	$branch_names1=$_POST['branch_name1'];
    $sel_branchs1="select cm_id from site_setting where branch_name='".$branch_names1."'";
    $ptr_branchs1 = mysql_query($sel_branchs1);
	$branch_datas1= mysql_fetch_array($ptr_branchs1);
  echo  '<option  value="">Select Faculty</option>';
        $branchs="select admin_id,name from site_setting where cm_id='".$branch_datas1['cm_id']."' and system_status='Enabled' and type='F' order by name ASC";
        $ptr_branchss=mysql_query($branchs);
        while($datas=mysql_fetch_array($ptr_branchss))
        {
           echo  '<option  value="'.$datas['admin_id'].'">'.strip_tags(ucfirst($datas['name'])). '</option>';
        }	
}
?>