<?php include 'inc_classes.php'; 
include "admin_authentication.php";
?>
<?php
$edit_access='';
$sel_acc="select * from edit_previleges where admin_id='".$_SESSION['admin_id']."' and privilege_id='392'";
$ptr_access=mysql_query($sel_acc);
if(mysql_num_rows($ptr_access))
{
	$edit_access='yes';
}
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Dashboard Task</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.7 -->
    <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="bower_components/Ionicons/css/ionicons.min.css">
    <!-- daterange picker -->
    <link rel="stylesheet" href="bower_components/bootstrap-daterangepicker/daterangepicker.css">
    <!-- bootstrap datepicker -->
    <link rel="stylesheet" href="bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css">
    <!-- Morris chart -->
    <link rel="stylesheet" href="bower_components/morris.js/morris.css">
    <!-- Morris charts -->
    <link rel="stylesheet" href="../../bower_components/morris.js/morris.css">
    <link rel="stylesheet" href="bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css">
    <!-- iCheck for checkboxes and radio inputs -->
    <link rel="stylesheet" href="plugins/iCheck/all.css">
    <!-- Bootstrap Color Picker -->
    <link rel="stylesheet" href="bower_components/bootstrap-colorpicker/dist/css/bootstrap-colorpicker.min.css">
    <!-- Bootstrap time Picker -->
    <link rel="stylesheet" href="plugins/timepicker/bootstrap-timepicker.min.css">
    <!-- Select2 -->
    <link rel="stylesheet" href="bower_components/select2/dist/css/select2.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->
    <!-- Google Font -->
    <link rel="stylesheet"
        href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
    <style>
        span {
            margin-left: 20%;
            text-align: center;
        }

        .form-control {
            margin-left: 20px;
        }
    </style>
<script>
    // function tab_id(values)
	// {
    //     alert(tab);
	// 	var tab= document.getElementById("assign").value;
    //     <?php
    // //   echo  $tab=$_GET['assign'];
    //     ?>
    //     alert(tab);
    // }
    </script>
</head>
<?php
 function convertToHoursMins($time, $format = '%02d:%02d') {
    if ($time < 1) {
        return;
    }
    $hours = floor($time / 60);
    $minutes = ($time % 60);
    return sprintf($format, $hours, $minutes);
}
?>
<body class="hold-transition skin-blue sidebar-mini">
    <div class="wrapper">
        <?php include "include/header-main.php"; ?>
        <!-- Left side column. contains the logo and sidebar -->
        <?php include "include/menu_left.php"; ?>
        <!-- Content Wrapper. Contains page content -->
        <!-- Left side column. contains the logo and sidebar -->
        <!-- Content Wrapper. Contains page content -->
        <div class="content-wrapper">
            <!-- Content Header (Page header) -->
 <section class="content-header">
    <div class="row">
    <?php
         $date=date("Y-m-d");
         $sel_task_h="select sum(hours) as tot_hour from tk_individual_task where 1 and staff_id='".$_SESSION['admin_id']."' and DATE(added_date)='". $date."'";
         $ptr_task_h=mysql_query( $sel_task_h);
         $data_task_h=mysql_fetch_array( $ptr_task_h);
         ?>
        <div class="col-md-3 col-sm-6 col-xs-12 ">
                <div class="info-box bg-aqua">
                <h3 align="center">Today's Task Assign Hour</h3>
                <h4 align="center">
                    <?php 
                    if( $data_task_h['tot_hour']!=''){
                        $hours= $data_task_h['tot_hour'];
                        $time1= convertToHoursMins($hours, '%02d hour %02d min');
                        echo $time1;
                    }
                    else{
                        echo '0';
                    }
                        
                    ?>
                </h4>
            </div>
         </div>
         <?php
          $sel_task_c="select sum(hours) as tot_cmplt_hour from tk_individual_task where 1 and staff_id='".$_SESSION['admin_id']."' and DATE(sta_complete_date)='". $date."' and status='complete'";
          $ptr_task_c=mysql_query( $sel_task_c);
          $data_task_c=mysql_fetch_array( $ptr_task_c);
         ?>
          <div class="col-md-3 col-sm-6 col-xs-12">
             <div class="info-box bg-gray">
                 <h3 align="center">Today's Task Completed Hour</h3>
                 <h4 align="center" style="color:black;"><?php
                $tot_complete=$data_task_c['tot_cmplt_hour'];
                $complt_time= convertToHoursMins($tot_complete, '%02d hour %02d min');
                echo  $complt_time;
                 ?> </h4>
             </div>
         </div>
         <?php
        //  $faculty_hour=0;
         if($_SESSION['type']=='F'){
           $sel_student_batch="select distinct(c_b_id) from batch_timetable where staff_id='".$_SESSION['admin_id']."' and date='".$date."'";
            $ptr_student_batch=mysql_query($sel_student_batch);
            $tot_batch_id=mysql_num_rows($ptr_student_batch);
         
         ?>
        <div class="col-md-3 col-sm-6 col-xs-12">
            <div class="info-box bg-green">
                <h3 align="center">Todays Batch </h3>
                <div align="center"> Total Batch : <?php echo  $tot_batch_id; ?> </div>
                <div align="center"> Total Batch  Time:
                    <?php 
                     $batch_time= $tot_batch_id*2.5;
                        $hour=  $batch_time*60 ;
                        $time= convertToHoursMins($hour, '%02d hour %02d min');
                        echo  $time;
                    ?>
                </div>
            </div>
        </div>
        <?php
         }
          if($_SESSION['type']=='C' || $_SESSION['type']=='A'){
         $sel_student_batch="select distinct(followup_id) from followup_details where 1 and response!='5' and admin_id='".$_SESSION['admin_id']."' and followup_date='".$date."'";
            $ptr_student_batch=mysql_query($sel_student_batch);
            $tot_batch_id=mysql_num_rows($ptr_student_batch);
            $tot_id= $tot_batch_id*3;
             $sel_student_enq="select distinct(followup_id) from followup_details where 1 and response='5' and admin_id='".$_SESSION['admin_id']."' and followup_date='".$date."'";
            $ptr_student_enq=mysql_query($sel_student_enq);
            $tot_student_enq=mysql_num_rows($ptr_student_enq);
            $tot_enq= $tot_student_enq*45;
            $tot_time= $tot_enq+ $tot_id;     
         ?>
        <div class="col-md-3 col-sm-6 col-xs-12">
        <!-- <div class="col-md-3 col-sm-6 col-xs-12"> -->
            <div class="info-box bg-green">
                <h3 align="center">Todays Assign Sale Time     </h3>
                <div align="center">
                    <?php 
                       $times= convertToHoursMins($tot_time, '%02d hour %02d min');
                       echo  $times;
                    ?>
                </div>
            </div>
        </div>
        <?php
         }
         if($_SESSION['type']=='S' || $edit_access=='yes'){
            $sel_task_p="select count(staff_task_id) as tot_count from tk_individual_task where 1 and Validation='pending'";
             $ptr_student_pen=mysql_query($sel_task_p);
             $tot_pending=mysql_fetch_array( $ptr_student_pen);
          
          ?>
         <div class="col-md-3 col-sm-6 col-xs-12">
             <div class="info-box bg-red">
                 <h3 align="center">Validation Pending Records</h3>
                 <h3 align="center" style="color:black;"><strong><?php echo  $tot_pending['tot_count']; ?></strong> </h3>
             </div>
         </div>
         <?php
          }
          else{
            $sel_task_ps="select count(staff_task_id) as tot_counts from tk_individual_task where 1 and Validation='pending' and staff_id='".$_SESSION['admin_id']."'";
            $ptr_student_pens=mysql_query($sel_task_ps);
            $tot_pendings=mysql_fetch_array( $ptr_student_pens);
            ?>
            <div class="col-md-3 col-sm-6 col-xs-12">
                <div class="info-box bg-red">
                    <h3 align="center">My Validation Pending Records</h3>
                    <h4 align="center" style="color:black;"><strong><?php echo  $tot_pendings['tot_counts']; ?></strong> </h4>
                </div>
            </div>
            <?php
          }
         ?>
         <div class="col-md-3 col-sm-6 col-xs-12" style="align:right">
        <!-- <div class="col-md-3 col-sm-6 col-xs-12"> -->
            <div class="info-box bg-yellow">
            <h3 align="center"><?php echo date("l") ?></h3>
                <h4 align="center"><?php echo date("d-m-Y ") ?></h4>
                
                </div>
            <!-- </div> -->
        </div>
    </div>
        <!-- <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
            <li class="active">Dashboard</li>
        </ol> -->
 </section>
            <!-- main body code start -->
            <section class="content">
                <div class="row">
                    <div class="col-md-8">
                        <!-- Custom Tabs -->
                        <div class="nav-tabs-custom">
                            <!-- <form method="get" name="search"> -->
                            <ul class="nav nav-tabs">
                            <!-- <li class="dropdown">
                                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                                        Group Task<span class="caret"></span>
                                    </a>
                                    <ul class="dropdown-menu">
                                <li ><a href="#tab_1" data-toggle="tab">Upcoming Task</a></li>
                                <li><a href="#tab_2" data-toggle="tab"> Due Task</a></li>
                                <li><a href="#tab_3" data-toggle="tab"> Completed Task</a></li>
                                </ul>
                                </li> -->
                                <li class="dropdown active">
                                    <a class="dropdown-toggle" data-toggle="dropdown" href="#"> Task List  <span class="caret"></span>
                                    </a>
                                    <ul class="dropdown-menu">
                                    <li class="active"><a href="#tab_4" data-toggle="tab">Upcoming Task</a></li>
                                    <!-- <li><a href="#tab_10" data-toggle="tab">Over Due Task</a></li> -->
                                    <li><a href="#tab_11" data-toggle="tab">Cancled Task</a></li>
                                    <li><a href="#tab_12" data-toggle="tab"> Halt Task</a></li>
                                    <li><a href="#tab_13" data-toggle="tab"> In-Complete Task</a></li>
                                    <li><a href="#tab_6" data-toggle="tab"> Completed Todays Task</a></li>
                                    </ul>
                                </li>
                               
                                <li><a href="#tab_7" data-toggle="tab">Assigned By Me</a></li>
								<?php
								if($_SESSION['type']=='S' || $edit_access=='yes'){
									?>
									<li><a href="#tab_8"  data-toggle="tab">Staff Assigned Task</a>
                                <!-- <input type="hidden" value="tab_8" id="assign" name="assign" OnClick="tab_id(this.value)"></li> -->
                                	<?php
                                }
                                if($_SESSION['type']=='S' || $edit_access=='yes'){
                                     ?>
                                      <li><a href="#tab_14" data-toggle="tab">Staff Completed Task</a></li>
                                      <?php
                                }
                                ?>
                                     <li><a href="#tab_9" data-toggle="tab">Validation Pending Task</a></li>
                                     <?php
                                if($_SESSION['type']=='S' || $edit_access=='yes'){
                                     ?>
                                      <li><a href="#tab_15" data-toggle="tab">Invalid Task</a></li>
                                      <?php
                                }
                                ?>
                            </ul>
                                <!-- </from> -->
                            <div class="tab-content">
                                <!-- ====================================for upcoming task================================================== -->
                                <div class="tab-pane " id="tab_1">
                                <h3 style="text-align:center;color:blue"><strong>Upcoming Task</strong></h4><hr>
                                <div class="row">
                                    <div class="col-md-3"><strong>Task Name</strong></div>
                                    <div class="col-md-3"><strong> Project Name</strong></div>
                                    <div class="col-md-3"><strong>Added Date </strong></div>
                                    <div class="col-md-3"><strong>Due Date </strong></div>
                                 </div>
                                    <?php 
                                    $str_Date= date("Y-m-d");
                                   $my_task="select DISTINCT(tm.proj_id),tm.tm_id,tm.team_id,tm.task_name,tm.categary_id,tm.priority,tm.description,tm.status,tm.due_date,tm.added_date as add_date from tk_task_managment tm,tk_team_collabraters tmc, tk_task_collabraters tc where (tm.team_id=tmc.team_id or tm.tm_id=tc.tm_id)  and (tc.staff_id='".$_SESSION['admin_id']."' and tmc.staff_id='".$_SESSION['admin_id']."') and (status !='complete' or status !='pending') and due_date >= '".$str_Date."' order by tm_id DESC";  
                                    $query_run=mysql_query($my_task);
                                    while($fetch_my_upc_task=mysql_fetch_array($query_run))
                                    { 
                                        // $dDate = date("d-m-Y", strtotime($fetch_my_upc_task['due_date']));
                                        //  $dDate;
                                        // if($str_Date <= $dDate & $fetch_my_upc_task['status']!='complete' & $fetch_my_upc_task['status']!='pending')
                                        // {
                                            $my_project="select proj_name from tk_project where proj_id='".$fetch_my_upc_task['proj_id']."'";
                                            $query_project=mysql_query($my_project); 
                                            while($fetch_my_project=mysql_fetch_array($query_project))
                                            {
                                                 $my_team="select team_name from tk_team where 1 and team_id='".$fetch_my_upc_task['team_id']."'";
                                                $query_team=mysql_query($my_team);
                                                $fetch_my_team=mysql_fetch_array($query_team);
                                                $my_categary="select categary_name from tk_categary where 1 and categary_id='".$fetch_my_upc_task['categary_id']."'";
                                                $query_categary=mysql_query($my_categary);
                                                $fetch_my_categary=mysql_fetch_array($query_categary)
                                             ?>
                                    <!-- button of upcoming task -->
                                    <div>
                                        <a type="button" class="btn btn-default btn-block" data-toggle="modal"
                                            data-target="#<?php echo $fetch_my_upc_task['tm_id']; ?>" value=""
                                            style="text-align:left">
                                            <div class="row">
                                                <div class="col-md-3">
                                                    <?php echo ucfirst($fetch_my_upc_task['task_name']);  ?>
                                                </div>
                                                <div class="col-md-3">
                                                   <?php echo ucfirst($fetch_my_project['proj_name']);?>
                                                </div>
                                                <div class="col-md-3">
                                                    <?php
                                                        $add_task_Date = date("d-m-Y", strtotime($fetch_my_upc_task['add_date']));
                                                        echo $add_task_Date ;
                                                    ?>
                                                </div>
                                                <div class="col-md-3">
                                                    <?php
                                                        $_task_due_Date = date("d-m-Y", strtotime($fetch_my_upc_task['due_date']));
                                                        echo $_task_due_Date ;
                                                    ?>
                                                </div>
                                            </div>
                                        </a>
                                    </div>
                                    <!--end button of upcoming task -->
                                    <div class="modal fade" id="<?php echo $fetch_my_upc_task['tm_id']; ?>">
                                        <div class="modal-dialog">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <button type="button" class="close" data-dismiss="modal"
                                                        aria-label="Close">
                                                        <span aria-hidden="true">&times;</span></button>
                                                    <h4 class="modal-title">
                                                        <span>
                                                            <?php  echo ucfirst( $fetch_my_upc_task['task_name']). '<br>';?>
                                                        </span>
                                                    </h4>
                                                </div>
                                                <!-- upcoming task model body -->
                                                <div class="modal-body">
                                                    <div class="row">
                                                        <div class="col-md-5">
                                                            <div class="box-body table-responsive no-padding">
                                                                <table class="table table-hover">
                                                                    <tr>
                                                                        <td>Team Name:</td>
                                                                        <td style="color:blue">
                                                                            <?php echo ucfirst($fetch_my_team['team_name']);?>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td>Categary Name:</td>
                                                                        <td style="color:blue">
                                                                            <?php echo ucfirst($fetch_my_categary['categary_name']);?>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td>Added Date:</td>
                                                                        <td style="color:blue">
                                                                            <?php
                                                                                    $added_Date = date("d-m-Y", strtotime($fetch_my_upc_task['add_date']));
                                                                                    echo $added_Date ;
                                                                                    ?>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td>Due Date:</td>
                                                                        <td style="color:blue">
                                                                            <?php
                                                                                $due_Date = date("d-m-Y", strtotime($fetch_my_upc_task['due_date']));
                                                                                echo $due_Date ;
                                                                            ?>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td>Priority:</td>
                                                                        <td style="color:blue">
                                                                            <?php echo ucfirst($fetch_my_upc_task['priority']);?>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td>Status:</td>
                                                                        <td>
                                                                            <?php
                                                                                if($fetch_my_upc_task['status']=='in_progress') 
                                                                                { 
                                                                                    ?>
                                                                                <p class="label label-warning">
                                                                                    <?php echo ucfirst($fetch_my_upc_task['status']);?>
                                                                                </p>
                                                                                <?php
                                                                                        }  
                                                                            ?>
                                                                        </td>
                                                                    </tr>
                                                                    
                                                                </table>
                                                            </div><br>
                                                        </div>
                                                        <div class="col-md-7">
                                                            <div class="direct-chat-messages">
                                                                <!-- team assignee -->
                                                                <?php
                                                                    $p=1;
                                                                        $sel_team_staff="select staff_id from tk_team_collabraters where 1 and team_id='".$fetch_my_upc_task['team_id']."'";
                                                                        $ptr_data_s=mysql_query($sel_team_staff);
                                                                        
                                                                        while( $fetch_staff=mysql_fetch_array($ptr_data_s))
                                                                        {
                                                                        $staff_name="select name,photo from site_setting where 1 and admin_id='".$fetch_staff['staff_id']."'";
                                                                        $ptr_data_staff=mysql_query($staff_name);
                                                                        $fetch_staff_name=mysql_fetch_array($ptr_data_staff);     
                                                                ?>
                                                                <p><span>
                                                                        <?php echo $p++ ?>
                                                                    </span>
                                                                    .<strong style="color:maroon;font-size:12px;">
                                                                        <?php echo ucfirst($fetch_staff_name['name']);?>
                                                                    </strong>
                                                                </p>

                                                                <?php
                                                                    }
                                                                    ?>
                                                                <!-- task assignee -->
                                                                <?php
                                                                        $sel_task_staff="select staff_id from tk_task_collabraters where 1 and tm_id='".$fetch_my_upc_task['tm_id']."'";
                                                                        $ptr_data_task=mysql_query($sel_task_staff);
                                                                        
                                                                        while( $fetch_task_staff=mysql_fetch_array($ptr_data_task))
                                                                        {
                                                                        $task_staff_name="select name,photo from site_setting where 1 and admin_id='".$fetch_task_staff['staff_id']."'";
                                                                        $ptr_task_staff=mysql_query($task_staff_name);
                                                                        $fetch_task_staff_name=mysql_fetch_array($ptr_task_staff);     
                                                                ?>
                                                                <p><span>
                                                                        <?php echo $p++ ?>
                                                                    </span>
                                                                    .<strong style="color:maroon;font-size:12px;">
                                                                        <?php echo ucfirst( $fetch_task_staff_name['name']);?>
                                                                    </strong>
                                                                </p>

                                                                <?php
                                                                    }
                                                                    ?>
                                                            </div>
                                                        </div>
                                                        <!-- ========== start description and Comment ==============-->
                                                        <div class="row">
                                                            <div class="col-xs-12">
                                                                <p class="lead" style="color:green; margin-left:10px;"> Description :</p>
                                                                <p class="text-muted well well-sm no-shadow"
                                                                    style="margin-top: 10px;">
                                                                    <?php echo ucwords($fetch_my_upc_task['description']); ?>
                                                                </p>
                                                                <p class="lead" style=" margin-left:10px;">
                                                                <i class="fa  fa-comments-o"></i></p>
                                                                <?php
                                                                        $my_comment="select comment,staff_id from tk_task_details where 1 and tm_id='".$fetch_my_upc_task['tm_id']."'";
                                                                        $query_comment=mysql_query($my_comment);
                                                                        while($fetch_my_comment=mysql_fetch_array($query_comment))
                                                                        {
                                                                        $staff_name_c="select name,photo from site_setting where 1 and admin_id='".$fetch_my_comment['staff_id']."'";
                                                                                $ptr_data_staff_c=mysql_query($staff_name_c);
                                                                                $fetch_staff_name_c=mysql_fetch_array($ptr_data_staff_c);
                                                                            ?>
                                                                <img style="margin-left:10px;" src="../faculty_login/staff_photo/<?php echo $fetch_staff_name_c['photo'];?>" width="20px"; height="20px";><strong>
                                                                    <?php echo ucfirst($fetch_staff_name_c['name']);?>
                                                                </strong>

                                                                <div style="margin-left:50px;">
                                                                    <?php echo  strip_tags(ucwords($fetch_my_comment ['comment']));?>
                                                                </div>
                                                                <?php
                                                                        }
                                                                        ?>
                                                            </div>
                                                        </div><br>
                                                        <!-- ========== end description and Comment ==============-->
                                                
                                                       <!-- detail button upcoming task -->
                                                            <a target="_blank" style="padding-left:50%;"
                                                                href="tk_detail.php?id=<?php echo $fetch_my_upc_task['tm_id']; ?>"><button
                                                                    class="btn btn-info" type="button">Task
                                                                    Details</button></a>
                                                    </div>
                                                    <!-- end detail button upcoming task -->
                                                </div>
                                                <!-- end upcoming task model body -->
                                            </div>
                                        </div>
                                    </div>
                                    <?php
                                            }
                                        // }
                                    } 
                                                  ?>
                                </div>

                                <!-- second tab start -->
                                <!-- ========================================for due task======================================== -->
                                <div class="tab-pane" id="tab_2">
                                <h3 style="text-align:center;color:blue"><strong>Due Task</strong></h4><hr>
                                <div class="row">
                                    <div class="col-md-3"><strong>Task Name</strong></div>
                                    <div class="col-md-3"><strong> Project Name</strong></div>
                                    <div class="col-md-3"><strong>Added Date </strong></div>
                                    <div class="col-md-3"><strong>Due Date </strong></div>
                                 </div>
                                    <?php 
                                      $str_Dates= date("Y-m-d");
                                            $my_task="select DISTINCT(tm.proj_id),tm.tm_id,tm.team_id,tm.task_name,tm.categary_id,tm.priority,tm.description,tm.status,tm.due_date,tm.added_date as add_date from tk_task_managment tm,tk_team_collabraters tmc, tk_task_collabraters tc where (tm.team_id=tmc.team_id or tm.tm_id=tc.tm_id)  and (tmc.staff_id='".$_SESSION['admin_id']."' and tc.staff_id='".$_SESSION['admin_id']."')and (status !='complete' or status ='pending') and due_date < '".$str_Dates."'order by tm_id DESC ";  
                                            $query_run=mysql_query($my_task);
                                            while($fetch_my_due_task=mysql_fetch_array($query_run))
                                            {
                                            //  $dDate = date("d-m-Y", strtotime($fetch_my_due_task['due_date']));
                                                // if($dDate < $str_Date & $fetch_my_due_task['status']!='complete')
                                                // {
                                                $my_project="select proj_name,added_date from tk_project where proj_id='".$fetch_my_due_task['proj_id']."'";
                                                $query_project=mysql_query($my_project); 
                                                while($fetch_my_project=mysql_fetch_array($query_project))
                                                {
                                                $my_team="select team_name from tk_team where 1 and team_id='".$fetch_my_due_task['team_id']."'";
                                                    $query_team=mysql_query($my_team);
                                                    $fetch_my_team=mysql_fetch_array($query_team);
                                                    $my_categary="select categary_name from tk_categary where 1 and categary_id='".$fetch_my_due_task['categary_id']."'";
                                                    $query_categary=mysql_query($my_categary);
                                                    $fetch_my_categary=mysql_fetch_array($query_categary)
                                                ?>
                                    <!-- due task button -->
                                    <div>
                                        <a type="button" class="btn btn-default btn-block" data-toggle="modal"
                                            data-target="#<?php echo $fetch_my_due_task['tm_id']; ?>" value=""
                                            style="text-align:left">
                                            <div class="row">
                                                <div class="col-md-3">
                                                    <?php echo ucfirst($fetch_my_due_task['task_name']);  ?>
                                                </div>
                                                <div class="col-md-3">
                                                   <?php echo ucfirst($fetch_my_project['proj_name']);?>
                                                </div>
                                                <div class="col-md-3">
                                                    <?php
                                                        $add_task_Date = date("d-m-Y", strtotime($fetch_my_due_task['add_date']));
                                                        echo $add_task_Date ;
                                                    ?>
                                                </div>
                                                <div class="col-md-3" style="color:red;">
                                                    <?php
                                                        $due_task_Date = date("d-m-Y", strtotime($fetch_my_due_task['due_date']));
                                                        echo $due_task_Date ;
                                                    ?>
                                                </div>
                                            </div>
                                        </a>
                                    </div>
                                    <!--end of due task button -->
                                    <div class="modal fade" id="<?php echo $fetch_my_due_task['tm_id']; ?>">
                                        <div class="modal-dialog">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <button type="button" class="close" data-dismiss="modal"
                                                        aria-label="Close">
                                                        <span aria-hidden="true">&times;</span></button>
                                                    <h4 class="modal-title">
                                                        <span>
                                                            <?php  echo ucfirst( $fetch_my_due_task['task_name']). '<br>';?>
                                                        </span>
                                                    </h4>
                                                </div>
                                                <!-- model body of due task -->
                                                <div class="modal-body">
                                                    <div class="row">
                                                        <div class="col-md-5">
                                                            <div class="box-body table-responsive no-padding">
                                                                <table class="table table-hover">
                                                                    <tr>
                                                                        <td>Team Name:</td>
                                                                        <td style="color:blue">
                                                                            <?php echo ucfirst($fetch_my_team['team_name']);?>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td>Categary Name:</td>
                                                                        <td style="color:blue">
                                                                            <?php echo ucfirst($fetch_my_categary['categary_name']);?>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td>Added Date:</td>
                                                                        <td style="color:blue">
                                                                            <?php
                                                                                    $added_Date = date("d-m-Y", strtotime($fetch_my_due_task['add_date']));
                                                                                    echo $added_Date ;
                                                                                    ?>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td>Due Date:</td>
                                                                        <td style="color:red">
                                                                            <?php
                                                                                    $due_Date = date("d-m-Y", strtotime($fetch_my_due_task['due_date']));
                                                                                    echo $due_Date ;
                                                                                    ?>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td>Priority:</td>
                                                                        <td style="color:blue">
                                                                            <?php echo ucfirst($fetch_my_due_task['priority']);?>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td>Status:</td>
                                                                        <td>
                                                                            <?php
                                                                                if($fetch_my_due_task['status']=='in_progress') 
                                                                                { 
                                                                            ?>
                                                                            <p class="label label-warning">
                                                                                <?php echo ucfirst($fetch_my_due_task['status']);?>
                                                                            </p>
                                                                            <?php
                                                                                } 
                                                                                if($fetch_my_due_task['status']=='pending') 
                                                                                { 
                                                                                    ?>
                                                                            <p class="label label-danger">
                                                                                <?php echo ucfirst($fetch_my_due_task['status']);?>
                                                                            </p>
                                                                            <?php
                                                                                    } 
                                                                            ?>
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </div><br>
                                                        </div>
                                                        <div class="col-md-7">

                                                            <div class="direct-chat-messages">
                                                                <!-- team assignee -->
                                                                <?php
                                                                    $p=1;
                                                                        $sel_team_staff="select staff_id from tk_team_collabraters where 1 and team_id='".$fetch_my_due_task['team_id']."'";
                                                                        $ptr_data_s=mysql_query($sel_team_staff);
                                                                        
                                                                        while( $fetch_staff=mysql_fetch_array($ptr_data_s))
                                                                        {
                                                                        $staff_name="select name,photo from site_setting where 1 and admin_id='".$fetch_staff['staff_id']."'";
                                                                        $ptr_data_staff=mysql_query($staff_name);
                                                                        $fetch_staff_name=mysql_fetch_array($ptr_data_staff);     
                                                                ?>
                                                                <p><span>
                                                                        <?php echo $p++ ?>
                                                                    </span>
                                                                    .<strong style="color:maroon;font-size:12px;">
                                                                        <?php echo ucfirst($fetch_staff_name['name']);?>
                                                                    </strong>
                                                                </p>
                                                                <!-- task assignee -->
                                                                <?php
                                                                    }
                                                        
                                                                    ?>
                                                                <?php
                                                                        $sel_task_staff="select staff_id from tk_task_collabraters where 1 and tm_id='".$fetch_my_due_task['tm_id']."'";
                                                                        $ptr_data_task=mysql_query($sel_task_staff);
                                                                        
                                                                        while( $fetch_task_staff=mysql_fetch_array($ptr_data_task))
                                                                        {
                                                                        $task_staff_name="select name,photo from site_setting where 1 and admin_id='".$fetch_task_staff['staff_id']."'";
                                                                        $ptr_task_staff=mysql_query($task_staff_name);
                                                                        $fetch_task_staff_name=mysql_fetch_array($ptr_task_staff);     
                                                                ?>
                                                                <p><span>
                                                                        <?php echo $p++ ?>
                                                                    </span>
                                                                    .<strong style="color:maroon;font-size:12px;">
                                                                        <?php echo ucfirst( $fetch_task_staff_name['name']);?>
                                                                    </strong>
                                                                </p>
                                                                <?php
                                                                    }
                                                        
                                                                    ?>
                                                            </div>
                                                        </div>
                                                        <!-- ========== start description and Comment ==============-->
                                                        <div class="row">
                                                            <div class="col-xs-12">
                                                                <p class="lead" style="color:green; margin-left:10px;">
                                                                    Description :</p>

                                                                <p class="text-muted well well-sm no-shadow"
                                                                    style="margin-top: 10px;">
                                                                    <?php echo ucwords($fetch_my_due_task['description']); ?>

                                                                </p>
                                                                <p class="lead" style=" margin-left:10px;">
                                                                <i class="fa  fa-comments-o"></i></p>

                                                                <?php
                                                                    $my_comment="select comment,staff_id from tk_task_details where 1 and tm_id='".$fetch_my_due_task['tm_id']."'";
                                                                    $query_comment=mysql_query($my_comment);
                                                                    while($fetch_my_comment=mysql_fetch_array($query_comment))
                                                                    {
                                                                    $staff_name_c="select name,photo from site_setting where 1 and admin_id='".$fetch_my_comment['staff_id']."'";
                                                                    $ptr_data_staff_c=mysql_query($staff_name_c);
                                                                    $fetch_staff_name_c=mysql_fetch_array($ptr_data_staff_c);
                                                                        ?>
                                                                <img style="margin-left:10px;" src="../faculty_login/staff_photo/<?php echo $fetch_staff_name_c['photo'];?>" width="20px"; height="20px";><strong>
                                                                    <?php echo ucfirst($fetch_staff_name_c['name']);?>
                                                                </strong>

                                                                <div style="margin-left:50px;">
                                                                    <?php echo  strip_tags(ucwords($fetch_my_comment ['comment']));?>
                                                                </div>
                                                                <?php
                                                                    }
                                                                    ?>
                                                            </div>
                                                        </div><br>
                                                        <!-- ========== end description and Comment ==============-->
                                                    
                                                        <!-- due task detail button -->
                                                   
                                                            <a target="_blank" style="padding-left:40%;"
                                                                href="tk_detail.php?id=<?php echo $fetch_my_due_task['tm_id']; ?>"><button
                                                                    class="btn btn-info" type="button">Task
                                                                    Details</button>
                                                            </a>
                                                    </div>
                                                    <!-- end due task detail button -->
                                                </div>
                                                <!-- end of due task model body -->
                                            </div>
                                        </div>
                                    </div>
                                    <!-- end of due task model -->
                                    <?php
                                                                            }
                                                                    }
                                                                            ?>

                                </div>
                                <!-- /.tab-pane -->
                                <!-- =============================for completed task============================= -->
                                <div class="tab-pane" id="tab_3">
                                <h3 style="text-align:center;color:blue"><strong>Completed Task</strong></h4><hr>
                                <div class="row">
                                    <div class="col-md-4"><strong>Task Name</strong></div>
                                    <div class="col-md-3"><strong> Project Name</strong></div>
                                    <div class="col-md-3"><strong>Added Date </strong></div>
                                    <div class="col-md-2"></div>
                                 </div>
                                    <?php 
                                           $my_task="select DISTINCT(tm.proj_id),tm.tm_id,tm.team_id,tm.task_name,tm.categary_id,tm.priority,tm.description,tm.status ,tm.due_date,tm.sta_complete_date,tm.added_date as add_date from tk_task_managment tm,tk_team_collabraters tmc, tk_task_collabraters tc where (tm.team_id=tmc.team_id or tm.tm_id=tc.tm_id)  and (tmc.staff_id='".$_SESSION['admin_id']."' and tc.staff_id='".$_SESSION['admin_id']."')and status ='complete'  order by tm_id DESC";  
                                            $query_run=mysql_query($my_task);
                                            while($fetch_my_task=mysql_fetch_array($query_run))
                                            {
                                                $my_project="select proj_name,added_date from tk_project where proj_id='".$fetch_my_task['proj_id']."'";
                                                $query_project=mysql_query($my_project); 
                                                while($fetch_my_project=mysql_fetch_array($query_project))
                                                {
                                                    $my_team="select team_name from tk_team where 1 and team_id='".$fetch_my_task['team_id']."'";
                                                    $query_team=mysql_query($my_team);
                                                    $fetch_my_team=mysql_fetch_array($query_team);
                                                    $my_categary="select categary_name from tk_categary where 1 and categary_id='".$fetch_my_task['categary_id']."'";
                                                    $query_categary=mysql_query($my_categary);
                                                    $fetch_my_categary=mysql_fetch_array($query_categary)
                                                ?>
                                    <!-- complete task button  -->
                                    <div>
                                        <a type="button" class="btn btn-default btn-block" data-toggle="modal"
                                            data-target="#<?php echo $fetch_my_task['tm_id']; ?>" value=""
                                            style="text-align:left">
                                            <div class="row">
                                                <div class="col-md-4">
                                                    <?php echo ucfirst($fetch_my_task['task_name']);  ?>
                                                </div>
                                                <div class="col-md-3">
                                                   <?php echo ucfirst($fetch_my_project['proj_name']);?>
                                                </div>
                                                <div class="col-md-3">
                                                    <?php
                                                        $add_task_Date = date("d-m-Y", strtotime($fetch_my_task['add_date']));
                                                        echo $add_task_Date ;
                                                    ?>
                                                </div>
                                                <div class="col-md-2">
                                                <?php
                                            $due_Date = date("d-m-Y", strtotime($fetch_my_task['due_date']));
                                            $complete_Date = date("d-m-Y", strtotime($fetch_my_task['sta_complete_date']));
                                            if($complete_Date > $due_Date){
                                                ?>
                                                <span class="label label-danger" > <?php echo 'Over Due';?></span>
                                                <?php
                                            }
                                        ?>
                                        </div>
                                            </div>
                                        </a>
                                    </div>
                                    <!-- complete task button end  -->
                                    <!--  start complete task model -->
                                    <div class="modal fade" id="<?php echo $fetch_my_task['tm_id']; ?>">
                                        <div class="modal-dialog">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <button type="button" class="close" data-dismiss="modal"
                                                        aria-label="Close">
                                                        <span aria-hidden="true">&times;</span></button>
                                                    <h4 class="modal-title">
                                                        <span>
                                                            <?php  echo ucfirst( $fetch_my_task['task_name']). '<br>';?>
                                                        </span>
                                                    </h4>
                                                </div>
                                                <!-- model body of completed task -->
                                                <div class="modal-body">
                                                    <div class="row">
                                                        <div class="col-md-5">
                                                            <div class="box-body table-responsive no-padding">
                                                                <table class="table table-hover">
                                                                    <tr>
                                                                        <td>Team Name:</td>
                                                                        <td style="color:blue">
                                                                            <?php echo ucfirst($fetch_my_team['team_name']);?>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td>Categary Name:</td>
                                                                        <td style="color:blue">
                                                                            <?php echo ucfirst($fetch_my_categary['categary_name']);?>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td>Added Date:</td>
                                                                        <td style="color:blue">
                                                                            <?php
                                                                                    $added_Date = date("d-m-Y", strtotime($fetch_my_task['add_date']));
                                                                                    echo $added_Date ;
                                                                                    ?>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td>Due Date:</td>
                                                                        <td style="color:blue">
                                                                            <?php
                                                                                    $due_Date = date("d-m-Y", strtotime($fetch_my_task['due_date']));
                                                                                    echo $due_Date ;
                                                                                    ?>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td>Priority:</td>
                                                                        <td style="color:blue">
                                                                            <?php echo ucfirst($fetch_my_task['priority']);?>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td>Status:</td>
                                                                        <td>
                                                                            
                                                                            <p class="label label-success">
                                                                                <?php echo ucfirst($fetch_my_task['status']);?>
                                                                            </p>&nbsp;&nbsp;
                                                                            <?php
                                                                            $due_Date = date("d-m-Y", strtotime($fetch_my_task['due_date']));
                                                                            $complete_Date = date("d-m-Y", strtotime( $fetch_my_task['sta_complete_date']));
                                                                            if($complete_Date > $due_Date){
                                                                                ?>
                                                                                <p class="label label-danger" > <?php echo 'Over Due';?></p>
                                                                                <?php
                                                                            }
                                                                            ?>
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </div><br>
                                                        </div>
                                                        <div class="col-md-7">
                                                            <div class="direct-chat-messages"  style="text-align:left">
                                                                <!-- team assignee -->
                                                                <?php
                                                                    $p=1;
                                                                        $sel_team_staff="select staff_id from tk_team_collabraters where 1 and team_id='".$fetch_my_task['team_id']."' ";
                                                                        $ptr_data_s=mysql_query($sel_team_staff);
                                                                        
                                                                        while( $fetch_staff=mysql_fetch_array($ptr_data_s))
                                                                        {
                                                                        $staff_name="select name,photo from site_setting where 1 and admin_id='".$fetch_staff['staff_id']."'";
                                                                        $ptr_data_staff=mysql_query($staff_name);
                                                                        $fetch_staff_name=mysql_fetch_array($ptr_data_staff);     
                                                                ?>
                                                                <p><span>
                                                                        <?php echo $p++ ?>
                                                                    </span>
                                                                    .<strong style="color:maroon;font-size:12px; ">
                                                                        <?php echo ucfirst($fetch_staff_name['name']);?>
                                                                    </strong>
                                                                </p>

                                                                <?php
                                                                    }
                                                                    ?>
                                                                <!-- task assignee -->
                                                                <?php
                                                                    
                                                                        $sel_task_staff="select staff_id from tk_task_collabraters where 1 and tm_id='".$fetch_my_task['tm_id']."'";
                                                                        $ptr_data_task=mysql_query($sel_task_staff);
                                                                        
                                                                        while( $fetch_task_staff=mysql_fetch_array($ptr_data_task))
                                                                        {
                                                                        $task_staff_name="select name,photo from site_setting where 1 and admin_id='".$fetch_task_staff['staff_id']."'";
                                                                        $ptr_task_staff=mysql_query($task_staff_name);
                                                                        $fetch_task_staff_name=mysql_fetch_array($ptr_task_staff);     
                                                                ?>
                                                                <p ><span>
                                                                        <?php echo $p++ ?>
                                                                    </span>
                                                                    .<strong style="color:maroon;font-size:12px;" >
                                                                        <?php echo ucfirst( $fetch_task_staff_name['name']);?>
                                                                    </strong>
                                                                </p>

                                                                <?php
                                                                    }
                                                                    ?>
                                                            </div>
                                                        </div>
                                                        <!-- ========== start description and Comment ==============-->
                                                        <div class="row">
                                                            <div class="col-xs-12">
                                                                <p class="lead" style="color:green; margin-left:10px;">
                                                                    Description :</p>

                                                                <p class="text-muted well well-sm no-shadow"
                                                                    style="margin-top: 10px;">
                                                                    <?php echo ucwords($fetch_my_task['description']); ?>

                                                                </p>
                                                                <p class="lead" style=" margin-left:10px;">
                                                                <i class="fa  fa-comments-o"></i></p>

                                                                <?php
                                                                    $my_comment="select comment,staff_id from tk_task_details where 1 and tm_id='".$fetch_my_task['tm_id']."'";
                                                                    $query_comment=mysql_query($my_comment);
                                                                    while($fetch_my_comment=mysql_fetch_array($query_comment))
                                                                    {
                                                                    $staff_name_c="select name,photo from site_setting where 1 and admin_id='".$fetch_my_comment['staff_id']."'";
                                                                            $ptr_data_staff_c=mysql_query($staff_name_c);
                                                                            $fetch_staff_name_c=mysql_fetch_array($ptr_data_staff_c);
                                                                        ?>
                                                                <img style="margin-left:10px;" src="../faculty_login/staff_photo/<?php echo $fetch_staff_name_c['photo'];?>" width="20px"; height="20px";><strong>
                                                                    <?php echo ucfirst($fetch_staff_name_c['name']);?>
                                                                </strong>

                                                                <div style="margin-left:50px;">
                                                                    <?php echo  strip_tags(ucwords($fetch_my_comment ['comment']));?>
                                                                </div>
                                                                <?php
                                                                    }
                                                                    ?>
                                                            </div>
                                                        </div><br>
                                                          <!-- ========== end description and Comment ==============-->
                        
                                                            <!-- detail button of complete task -->
                                                            <a target="_blank" style="padding-left:40%;"
                                                                href="tk_detail.php?id=<?php echo $fetch_my_task['tm_id']; ?>"><button
                                                                    class="btn btn-info" type="button">Task
                                                                    Details</button>
                                                            </a>
                                                    </div>
                                                    <!-- detail button end -->
                                                </div>
                                                <!-- end of complete task model body -->
                                            </div>
                                        </div>
                                    </div>
                                    <!-- end of complete task model -->
                                    <?php
                                            }
                                     }
                                       ?>
                                           </div>
 <!-- =================================================== Personal Task ============================================================================================ -->

                <!-- ==================================Personal upcoming Task============================================ --> 
                        <div class="tab-pane active" id="tab_4">
                            <div class="box-header with-border">
                                <h3 style="color:blue" class="box-title"><strong> Upcoming Task Name </strong></h3>
                                <div class="box-body">
                                    <div class="table-responsive">
                                        <?php
                                        $dats=date("Y-m-d");
                                        $my_upc_task="select * from tk_individual_task where 1 and staff_id='".$_SESSION['admin_id']."'and (status !='complete'and status !='halt' and status !='cancel' and status !='in_complete')  and Validation='valid' and task_type='adhoc_task' and DATE(added_date)<='".$dats."' order by due_date ASC";  
                                        $ptr_upc_task=mysql_query($my_upc_task);
                                        $no_of_records=mysql_num_rows($ptr_upc_task);
                                        if($no_of_records)
                                        {
                                            ?>
                                            <table class="table no-margin">
                                                <thead>
                                                    <tr>
                                                        <th>Task Name</th>
                                                        <th>Assinged BY</th>
                                                        <th>Created Date</th>
                                                        <th>Dead Line</th>
                                                        <th>Updated Dead Line </th>
                                                        <th>Details</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                <?php 
                                                while($my_task=mysql_fetch_array($ptr_upc_task))
                                                {
                                                    if($my_task['staff_status']=='complete'){
                                                    $bg_color='style="background-color:rgb(172,225,175);"';
                                                    }
                                                    elseif($my_task['staff_status']=='in_progress'){
                                                        $bg_color='style="background-color:rgb(252,255,164);"';
                                                        }
                                                        else{
                                                            $bg_color='';
                                                        }

                                                    $dat_d = date("Y-m-d");
                                                    $Date12= strtotime($dat_d);
                                                    $task_d = $my_task['due_date'];
                                                    $due_Dates =strtotime( $task_d);
                                                    if($due_Dates >= $Date12)
                                                    {
                                                        ?>
                                                        <tr  <?php echo $bg_color; ?>>
                                                            <td> <b><?php echo ucwords($my_task['task_name']);?></b><br>
                                                            <?php
                                                            $hours=$my_task['hours'];
                                                            $time1= convertToHoursMins($hours, '%02d hour %02d min');
                                                            echo $time1.'<br>';
                                                            echo 'Points- '.$my_task['points'].'<br>';
                                                            echo 'Priority- '.ucfirst($my_task['priority']);
                                                             ?>
                                                        </td>
                                                            <td>
                                                                <?php
                                                                    $staff_name_c="select name,photo from site_setting where 1 and admin_id='".$my_task['assign_by']."'";
                                                                    $ptr_data_staff_c=mysql_query($staff_name_c);
                                                                    $fetch_staff_name_c=mysql_fetch_array($ptr_data_staff_c);
                                                                    echo ucfirst($fetch_staff_name_c['name']);
                                                                ?>
                                                            </td>
                                                            <td>
                                                                <?php
                                                                    $add_task_Date = date("d-m-Y", strtotime($my_task['added_date']));
                                                                    echo $add_task_Date ;
                                                                ?>
                                                            </td>
                                                            <td>
                                                                <?php
                                                                    $due_d_Date = date("d-m-Y", strtotime($my_task['due_date']));
                                                                    echo $due_d_Date ;
                                                                ?>
                                                            </td>
                                                            <td>
                                                                <?php
                                                                if($my_task['due_date_change']!='')
                                                                {
                                                                    $task_d = date("d-m-Y", strtotime($my_task['due_date_change']));
                                                                    ?>
                                                                    <p style="color:blue;"> <?php echo $task_d;?> </p>
                                                                    <?php
                                                                }
                                                                ?>
                                                            </td>
                                                            <td>
                                                                <strong><a href="tk_individual_task_detail.php?id=<?= $my_task['staff_task_id'] ?>"  value=""> Details </a></strong>
                                                            </td>
                                                        </tr> 
                                                        <?php
                                                    }
                                                    elseif($due_Dates < $Date12)
                                                    {
                                                        $text_color='style="text-color:red"'
                                                        ?>
                                                        <tr <?php echo $bg_color; ?>>    
                                                        <td  style="color:red;"><b> <?php echo ucwords($my_task['task_name']);?></b><br>
                                                            <?php
                                                            $hours=$my_task['hours'];
                                                            $time1= convertToHoursMins($hours, '%02d hour %02d min');
                                                            echo $time1.'<br>';
                                                            echo 'Points- '.$my_task['points'].'<br>';
                                                            echo 'Priority- '.ucfirst($my_task['priority']);
                                                             ?>
                                                        </td>
                                                            <td  style="color:red;">
                                                                <?php
                                                                $staff_name1="select name from site_setting where 1 and admin_id='".$my_task['assign_by']."'";
                                                                $ptr_data_staff1=mysql_query($staff_name1);
                                                                $fetch_staff_name1=mysql_fetch_array($ptr_data_staff1);
                                                                
                                                                echo ucfirst($fetch_staff_name1['name']);
                                                            ?>
                                                            </td>
                                                            <td  style="color:red;">
                                                                <?php
                                                                    $add_task_Date = date("d-m-Y", strtotime($my_task['added_date']));
                                                                    echo $add_task_Date ;
                                                                ?>
                                                            </td>
                                                            <td  style="color:red;">
                                                                <?php
                                                                    $task_d_Date = date("d-m-Y", strtotime($my_task['due_date']));
                                                                    echo $task_d_Date ;
                                                                ?>
                                                            </td>
                                                            <td  style="color:red;">
                                                                <?php
                                                                $dat=date("d-m-Y");
                                                                $dd= strtotime($dat);
                                                                $task_d_Date12 = $my_task['due_date_change'];
                                                                $complete_Dates =strtotime( $task_d_Date12);
                                                                if($my_task['due_date_change']!='')
                                                                {
                                                                    $task_d_Date1 = date("d-m-Y", strtotime($my_task['due_date_change']));
                                                                    if($complete_Dates < $dd)
                                                                    {
                                                                        ?>
                                                                        <p  style="color:red;">
                                                                        <?php
                                                                        echo $task_d_Date1 ;
                                                                        ?></p><?php
                                                                    }
                                                                    else
                                                                    {
                                                                        ?>
                                                                        <p  style="color:blue;">
                                                                        <?php
                                                                        echo $task_d_Date1 ;
                                                                        ?></p><?php
                                                                    }
                                                                }
                                                                ?>
                                                            </td>
                                                            <td >
                                                                <strong><a href="tk_individual_task_detail.php?id=<?= $my_task['staff_task_id'] ?>"  value=""> Details </a></strong>
                                                            </td>
                                                        </tr>
                                                        <?php
                                                    }
                                                }
                                                ?>
                                                </tbody>
                                            </table>
                                            <?php
                                        }
                                        else
                                        {
                                            ?> 
                                            <div ><h4 style="background-color:;text-align:center"> No Record Avialable According To Your Creteria</h4></div>
                                            <?php
                                        }
                                       ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                            
         <!-- ================================ Personal Cancle Task ===================================== -->
                        <div class="tab-pane" id="tab_11">
                            <div class="box-header with-border">
                                <h3 style="color:blue" class="box-title"><strong> Cancel Task Name </strong></h3>
                                <div class="box-body">
                                    <div class="table-responsive">
                                        <?php
                                        $Date12 = date("Y-m-d");
                                        // if($_SESSION['type']=='S' || $edit_access=='yes')
                                        // { 
                                        //     $my_cancle_task1="select * from tk_individual_task where 1 and status ='cancel' and Validation='valid' and task_type='adhoc_task' order by added_date DESC";
                                        // }
                                        // else
                                        // {
                                             $my_cancle_task1="select * from tk_individual_task where 1 and assign_by='".$_SESSION['admin_id']."'and status ='cancel' and Validation='valid' and task_type='adhoc_task' order by added_date DESC";
                                        // }
                                        // echo  $my_upc_task1;
                                        $ptr_cancle_task1=mysql_query($my_cancle_task1);
                                        $no_of_cancle_records=mysql_num_rows($ptr_cancle_task1);
                                        if($no_of_cancle_records)
                                            {
                                                ?>
                                                <table class="table no-margin">
                                                    <thead>
                                                        <tr>
                                                            <th>Task Name</th>
                                                            <?php
                                                            if($_SESSION['type']=='S' || $edit_access=='yes'){
                                                            ?>
                                                            <th>Assinged To</th>
                                                            <th>Assinged By</th>
                                                            <?php
                                                            }
                                                            ?>
                                                            <th>Created Date</th>
                                                            <th>Dead Line</th>
                                                            <th>Details</th>
                                                        </tr>
                                                    </thead>
                                                    <tbody>
                                                        <?php 
                                                        while($my_cancle_task=mysql_fetch_array($ptr_cancle_task1))
                                                        {
                                                            if($my_cancle_task['staff_status']=='complete'){
                                                                    $bg_color='style="background-color:rgb(172,225,175);"';
                                                                }
                                                            elseif($my_cancle_task['staff_status']=='in_progress'){
                                                                    $bg_color='style="background-color:rgb(252,255,164);"';
                                                                }
                                                            else{
                                                                    $bg_color='';
                                                                }
                                                            ?>
                                                            <tr <?php echo $bg_color; ?>>
                                                                <td><?php echo ucwords($my_cancle_task['task_name']);?></td>
                                                                <?php
                                                                if($_SESSION['type']=='S' || $edit_access=='yes')
                                                                {
                                                                    ?>
                                                                <td>
                                                                    <?php
                                                                        $staff_names1="select name,photo from site_setting where 1 and admin_id='".$my_cancle_task['staff_id']."'";
                                                                        $ptr_staff=mysql_query($staff_names1);
                                                                        $fetch_staff_names1=mysql_fetch_array($ptr_staff);
                                                                        
                                                                        echo ucfirst($fetch_staff_names1['name']);
                                                                    ?>
                                                                </td>
                                                                <td>
                                                                    <?php
                                                                        $admin_name1="select name,photo from site_setting where 1 and admin_id='".$my_cancle_task['assign_by']."'";
                                                                        $ptr_admin_name1=mysql_query($admin_name1);
                                                                        $fetch_admin_name1=mysql_fetch_array($ptr_admin_name1);
                                                                        
                                                                        echo ucfirst($fetch_admin_name1['name']);
                                                                    ?>
                                                                </td>
                                                                    <?php
                                                                }
                                                                ?>
                                                                <td>
                                                                    <?php
                                                                        $add_task_Date = date("d-m-Y", strtotime($my_cancle_task['added_date']));
                                                                        echo $add_task_Date ;
                                                                    ?>
                                                                </td>
                                                                <td>
                                                                    <?php
                                                                        $due_d_Date = date("d-m-Y", strtotime($my_cancle_task['due_date']));
                                                                        echo $due_d_Date ;
                                                                    ?>
                                                                </td>
                                                                <td>
                                                                    <strong><a href="tk_individual_task_detail.php?id=<?= $my_cancle_task['staff_task_id'] ?>"  value="">Details</a></strong>
                                                                </td>
                                                            </tr>
                                                            <?php
                                                        }
                                                        ?>
                                                    </tbody>
                                                </table>
                                                <?php
                                            }
                                            else
                                            {
                                                ?> 
                                                    <div ><h4 style="background-color:;text-align:center"> No Record Avialable According To Your Creteria</h4></div>
                                                <?php
                                            }
                                        ?>
                                    </div>
                                </div>
                            </div>
                        </div>

     <!-- ================================ Personal Halt Task ===================================== -->

                    <div class="tab-pane" id="tab_12">
                        <div class="box-header with-border">
                            <h3 style="color:blue" class="box-title"><strong> Halt Task Name </strong></h3>
                            <div class="box-body">
                                <div class="table-responsive">
                                    <?php
                                    $Date12 = date("Y-m-d");
                                    // if($_SESSION['type']=='S' || $edit_access=='yes')
                                    // {    
                                    //     $my_halt_task3="select * from tk_individual_task where 1 and status ='halt' and Validation='valid' and task_type='adhoc_task' order by added_date DESC";
                                    // }
                                    // else
                                    // {
                                        $my_halt_task3="select * from tk_individual_task where 1 and staff_id='".$_SESSION['admin_id']."'and status ='halt' and Validation='valid' and task_type='adhoc_task' order by added_date DESC";
                                    // }
                                    // echo $my_upc_task3;
                                    $ptr_halt_task=mysql_query($my_halt_task3);
                                    $no_of_halt_records=mysql_num_rows($ptr_halt_task);
                                    if($no_of_halt_records)
                                    {
                                        ?>
                                        <table class="table no-margin">
                                            <thead>
                                                <tr>
                                                    <th>Task Name</th>
                                                     <?php
                                                    if($_SESSION['type']=='S' || $edit_access=='yes'){
                                                     ?>
                                                    <th>Assinged To</th>
                                                    <th>Assinged By</th>
                                                     <?php
                                                     }
                                                    ?>
                                                    <th>Created Date</th>
                                                    <th>Dead Line</th>
                                                    <th>Details</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                            <?php 
                                                while($my_halt_task=mysql_fetch_array($ptr_halt_task))
                                                {
                                                    if($my_halt_task['staff_status']=='complete'){
                                                        $bg_color='style="background-color:rgb(172,225,175);"';
                                                        }
                                                        elseif($my_halt_task['staff_status']=='in_progress'){
                                                            $bg_color='style="background-color:rgb(252,255,164);"';
                                                            }
                                                            else{
                                                                $bg_color='';
                                                            }
                                                    ?>
                                                    <tr <?php echo $bg_color; ?>>
                                                        <td><?php echo ucwords($my_halt_task['task_name']);?></td>
                                                        <?php
                                                        if($_SESSION['type']=='S' || $edit_access=='yes'){
                                                            ?>
                                                        <td>
                                                            <?php
                                                                $staff_name_c="select name,photo from site_setting where 1 and admin_id='".$my_halt_task['staff_id']."'";
                                                                $ptr_data_staff_c=mysql_query($staff_name_c);
                                                                $fetch_staff_name_c=mysql_fetch_array($ptr_data_staff_c);
                                                                
                                                                echo ucfirst($fetch_staff_name_c['name']);
                                                            ?>
                                                        </td>
                                                        <td>
                                                            <?php
                                                                $admin_name="select name,photo from site_setting where 1 and admin_id='".$my_halt_task['assign_by']."'";
                                                                $ptr_admin_name=mysql_query($admin_name);
                                                                $fetch_admin_name=mysql_fetch_array($ptr_admin_name);
                                                                
                                                                echo ucfirst($fetch_admin_name['name']);
                                                            ?>
                                                        </td>
                                                        <?php
                                                        }
                                                        ?>
                                                        <td>
                                                            <?php
                                                                $add_task_Date = date("d-m-Y", strtotime($my_halt_task['added_date']));
                                                                echo $add_task_Date ;
                                                            ?>
                                                        </td>
                                                        <td>
                                                            <?php
                                                                $dat1=date("d-m-Y");
                                                                $dd1= strtotime($dat1);
                                                                $task_dat = $my_halt_task['due_date'];
                                                                $last_Dates =strtotime( $task_dat);
                                                                $task_d_Date1 = date("d-m-Y", strtotime($my_halt_task['due_date']));
                                                                if($last_Dates < $dd1)
                                                                {
                                                                    ?>
                                                                    <p  style="color:red;">
                                                                    <?php echo $task_d_Date1 ;?></p>
                                                                    <?php
                                                                } 
                                                                else
                                                                {
                                                                    ?>
                                                                    <p  style="color:blue;">
                                                                    <?php echo $task_d_Date1 ;?></p>
                                                                    <?php
                                                                } 
                                                            ?>
                                                        </td>
                                                        <td>
                                                            <strong><a href="tk_individual_task_detail.php?id=<?= $my_halt_task['staff_task_id'] ?>" value="">Details</a></strong>
                                                        </td>
                                                    </tr>
                                                    <?php
                                                }
                                            ?>
                                            </tbody>
                                        </table>
                                        <?php
                                    }
                                    else
                                    {
                                        ?> 
                                            <div ><h4 style="background-color:;text-align:center"> No Record Avialable According To Your Creteria</h4></div>
                                        <?php
                                    }
                                    ?>
                                </div>
                            </div>
                        </div>
                    </div>
                
        <!-- ================================= Personal In-complete Task ====================================== -->

                    <div class="tab-pane" id="tab_13">
                        <div class="box-header with-border">
                            <h3 style="color:blue" class="box-title"><strong>In-Complete Task</strong></h3>
                            <div class="box-body">
                                <div class="table-responsive">
                                    <?php
                                    $Date12 = date("Y-m-d");
                                    // if($_SESSION['type']=='S' || $edit_access=='yes')
                                    // {
                                    //     $my_incmplt_task3="select * from tk_individual_task where 1 and status ='in_complete' and Validation='valid' and task_type='adhoc_task' order by added_date DESC";
                                    // }
                                    // else
                                    // {
                                        $Date12 = date("Y-m-d");
                                        $my_incmplt_task3="select * from tk_individual_task where 1 and staff_id='".$_SESSION['admin_id']."'and status ='in_complete' and Validation='valid' and task_type='adhoc_task' order by added_date DESC";
                                    // }
                                        //  echo $my_upc_task3;
                                    $ptr_incmplt_task=mysql_query($my_incmplt_task3);
                                    $no_of_incmplt_records=mysql_num_rows($ptr_incmplt_task);
                                    if($no_of_incmplt_records)
                                    {
                                        ?>
                                        <table class="table no-margin">
                                            <thead>
                                                <tr>
                                                    <th>Task Name</th>
                                                    <?php
                                                    if($_SESSION['type']=='S' || $edit_access=='yes')
                                                    {
                                                    ?>
                                                    <th>Assinged To</th>
                                                    <th>Assinged By</th>
                                                    <?php
                                                     }
                                                    ?>
                                                    <th>Created Date</th>
                                                    <th>Dead Line</th>
                                                    <th>Details</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <?php 
                                                while($data_incmplt=mysql_fetch_array($ptr_incmplt_task))
                                                {
                                                    if($data_incmplt['staff_status']=='complete'){
                                                        $bg_color='style="background-color:rgb(172,225,175);"';
                                                        }
                                                        elseif($data_incmplt['staff_status']=='in_progress'){
                                                            $bg_color='style="background-color:rgb(252,255,164);"';
                                                            }
                                                            else{
                                                                $bg_color='';
                                                            }
                                                    ?>
                                                    <tr <?php echo $bg_color; ?>>
                                                        <td><?php echo ucwords($data_incmplt['task_name']);?></td>
                                                        <?php
                                                        if($_SESSION['type']=='S' || $edit_access=='yes')
                                                        {
                                                        ?>
                                                        <td>
                                                        <?php
                                                            $staff_name_c="select name,photo from site_setting where 1 and admin_id='".$data_incmplt['staff_id']."'";
                                                            $ptr_data_staff_c=mysql_query($staff_name_c);
                                                            $fetch_staff_name_c=mysql_fetch_array($ptr_data_staff_c);
                                                            
                                                            echo ucfirst($fetch_staff_name_c['name']);
                                                        ?>
                                                        </td>
                                                        <td>
                                                            <?php
                                                                $staff="select name,photo from site_setting where 1 and admin_id='".$data_incmplt['assign_by']."'";
                                                                $ptr_staff_c=mysql_query($staff);
                                                                $fetch_staff=mysql_fetch_array($ptr_staff_c);
                                                    
                                                                echo ucfirst($fetch_staff['name']);
                                                            ?>
                                                        </td>
                                                        <?php
                                                        }
                                                        ?>
                                                        <td>
                                                            <?php
                                                                $add_task_Date = date("d-m-Y", strtotime($data_incmplt['added_date']));
                                                                echo $add_task_Date ;
                                                            ?>
                                                        </td>
                                                        <td>
                                                            <?php
                                                                $dat1=date("d-m-Y");
                                                                $dd1= strtotime($dat1);
                                                                $task_dat = $data_incmplt['due_date'];
                                                                $last_Dates =strtotime( $task_dat);
                                                                $task_d_Date1 = date("d-m-Y", strtotime($data_incmplt['due_date']));
                                                                if($last_Dates < $dd1){
                                                                ?>
                                                                <p  style="color:red;">
                                                                <?php echo $task_d_Date1 ;?></p>
                                                                <?php
                                                                }
                                                                else
                                                                {
                                                                ?>
                                                                <p  style="color:blue;">
                                                                <?php
                                                                echo $task_d_Date1 ;
                                                                ?></p><?php
                                                                } 
                                                            ?>
                                                        </td>
                                                        <td>
                                                            <strong><a href="tk_individual_task_detail.php?id=<?= $data_incmplt['staff_task_id'] ?>" value="">Details</a></strong>
                                                        </td>
                                                    </tr>
                                                    <?php
                                                }
                                                ?>
                                            </tbody>
                                        </table>
                                        <?php
                                    }
                                    else
                                    {
                                        ?> 
                                            <div ><h4 style="background-color:;text-align:center"> No Record Avialable According To Your Creteria</h4></div>
                                        <?php
                                    }
                                       ?>
                                </div>
                            </div>
                        </div>
                    </div>

         <!-- =========================================personal completed task ============================================== -->

                    <div class="tab-pane" id="tab_6">
                        <div class="box-header with-border">
                            <h3 style="color:blue" class="box-title"><strong>Todays Complete Task</strong></h3>
                            <div class="box-body">
                                <div class="table-responsive">
                                    <?php
                                    // if($_SESSION['type']=='S' || $edit_access=='yes')
                                    // {
                                    //     $my_cmp_task="select * from tk_individual_task where 1 and  status ='complete' and Validation='valid' and task_type='adhoc_task' order by added_date DESC";
                                    // }
                                    // else
                                    // {
                                    $my_cmp_task="select * from tk_individual_task where 1 and staff_id='".$_SESSION['admin_id']."'and status ='complete' and Validation='valid' and task_type='adhoc_task' and DATE(sta_complete_date)='".date("Y-m-d")."' order by added_date DESC"; 
                                    // }
                                    $ptr_cmp_task=mysql_query($my_cmp_task);
                                    $no_of_records=mysql_num_rows($ptr_cmp_task);
                                    if($no_of_records)
                                    {
                                        ?>
                                        <table class="table no-margin">
                                            <thead>
                                                <tr>
                                                    <th>Task Name</th>
                                                     <?php
                                                    if($_SESSION['type']=='S' || $edit_access=='yes'){
                                                     ?>
                                                    <th>Assinged To</th>
                                                     <?php
                                                     }
                                                    ?>
                                                    <th>Created Date</th>
                                                    <th colspan="2">Completed Date</th>
                                                    <th>Details</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                            <?php 
                                            while($complete_task=mysql_fetch_array($ptr_cmp_task))
                                            {
                                                ?>
                                                <tr>
                                                    <td><?php echo ucwords($complete_task['task_name']);?></td>
                                                    <?php
                                                    if($_SESSION['type']=='S' || $edit_access=='yes'){
                                                        ?>
                                                    <td>
                                                        <?php
                                                            $staff_name_c="select name,photo from site_setting where 1 and admin_id='".$complete_task['staff_id']."'";
                                                            $ptr_data_staff_c=mysql_query($staff_name_c);
                                                            $fetch_staff_name_c=mysql_fetch_array($ptr_data_staff_c);
                                                            
                                                            echo ucfirst($fetch_staff_name_c['name']);
                                                        ?>
                                                    </td>
                                                    <?php
                                                    }
                                                    ?>
                                                    <td>
                                                    <?php
                                                        $add_task_Date = date("d-m-Y", strtotime($complete_task['added_date']));
                                                        echo $add_task_Date ;
                                                        ?>
                                                    </td>
                                                    <td>
                                                        <?php
                                                            $due_Date=$complete_task['due_date'];
                                                            $complete_Date=$complete_task['sta_complete_date'];
                                                            $due_Date12 = date("Y-m-d",strtotime($due_Date));
                                                            $complete_Date12 =date("Y-m-d",strtotime( $complete_Date));
                                                            $complete_d = date("d-m-Y", strtotime($complete_task['sta_complete_date']));
                                                            echo $complete_d;
                                                        ?>
                                                    </td>
                                                    <td>
                                                        <?php
                                                        if($complete_Date12 > $due_Date12)
                                                        {
                                                            ?>
                                                                <p class="label label-danger" style="margin-left:1px;"> <?php echo 'Over Due';?></p>
                                                            <?php
                                                        }
                                                        ?>
                                                    </td>
                                                    <td>
                                                        <strong><a href="tk_individual_task_detail.php?id=<?= $complete_task['staff_task_id'] ?>" value="">Details</a></strong>
                                                    </td>
                                                </tr>
                                                <?php
                                            }
                                            ?>
                                            </tbody>
                                        </table>
                                        <?php
                                    }
                                    else
                                    {
                                        ?> 
                                            <div ><h4 style="background-color:;text-align:center"> No Record Avialable According To Your Creteria</h4></div>
                                        <?php
                                    }
                                    ?>
                                </div>
                            </div>
                        </div>
                    </div>
    <!--====================================================== Assign by me task ================================================ -->
                    <div class="tab-pane" id="tab_7">
                        <div class="box-header with-border">
                            <h3 style="color:blue" class="box-title"><strong> Assinged By Me </strong></h3>
                            <div class="box-body">
                                <div class="table-responsive">
                                    <?php
                                    $Date12 = date("Y-m-d");
                                    $my_assignme_task="select * from tk_individual_task where 1 and assign_by='".$_SESSION['admin_id']."'and (status !='complete' and status !='halt' and status !='cancel' and status !='in_complete') and Validation='valid' and task_type='adhoc_task' order by added_date DESC";       
                                    $ptr_assign_me_task=mysql_query($my_assignme_task);
                                    $no_of_assignme_records=mysql_num_rows($ptr_assign_me_task);
                                    if($no_of_assignme_records)
                                    {
                                        ?>
                                        <table class="table no-margin">
                                            <thead>
                                                <tr>
                                                    <th>Task Name</th>
                                                    <th>Assinged To</th>
                                                    <th>Created Date</th>
                                                    <th>Dead Line</th>
                                                    <th>Details</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                            <?php
                                                while($data_assign_me_task=mysql_fetch_array($ptr_assign_me_task))
                                                {
                                                    if($data_assign_me_task['staff_status']=='complete'){
                                                        $bg_color='style="background-color:rgb(172,225,175);"';
                                                        }
                                                        elseif($data_assign_me_task['staff_status']=='in_progress'){
                                                            $bg_color='style="background-color:rgb(252,255,164);"';
                                                            }
                                                            else{
                                                                $bg_color='';
                                                            }
                                                    ?>
                                                    <tr <?php echo $bg_color; ?>>
                                                    <td> <b><?php echo ucwords($data_assign_me_task['task_name']);?></b><br>
                                                            <?php
                                                            $hours=$data_assign_me_task['hours'];
                                                            $time1= convertToHoursMins($hours, '%02d hour %02d min');
                                                            echo $time1.'<br>';
                                                            echo 'Points- '.$data_assign_me_task['points'].'<br>';
                                                            echo 'Priority- '.ucfirst($data_assign_me_task['priority']);
                                                             ?>
                                                        </td>
                                                        <td>
                                                            <?php
                                                                $staff_name_c="select name,photo from site_setting where 1 and admin_id='".$data_assign_me_task['staff_id']."'";
                                                                $ptr_data_staff_c=mysql_query($staff_name_c);
                                                                $fetch_staff_name_c=mysql_fetch_array($ptr_data_staff_c);
                                                                
                                                                echo ucfirst($fetch_staff_name_c['name']);
                                                            ?>
                                                        </td>
                                                        <td>
                                                            <?php
                                                                $add_task_Date = date("d-m-Y", strtotime($data_assign_me_task['added_date']));
                                                                echo $add_task_Date ;
                                                            ?>
                                                        </td>
                                                        <td>
                                                            <?php
                                                                $date=date("d-m-Y");
                                                                $due_date1=$data_assign_me_task['due_date'];
                                                                $date1=strtotime($date);
                                                                $due_date=strtotime($due_date1);
                                                                $due_d_Date = date("d-m-Y", strtotime($data_assign_me_task['due_date']));
                                                                if($date1 > $due_date){
                                                                ?>
                                                                <p style="color:red;"><?php
                                                                echo $due_d_Date ;
                                                                ?></p><?php
                                                                }
                                                                else
                                                                {?>
                                                                <p style="color:blue;"><?php
                                                                echo $due_d_Date ;
                                                                ?></p><?php
                                                                }
                                                            ?>
                                                        </td>
                                                        <td>
                                                            <strong><a href="tk_individual_task_detail.php?id=<?= $data_assign_me_task['staff_task_id'] ?>" value="">Details</a></strong>
                                                        </td>
                                                    </tr>
                                                    <?php
                                                }
                                            ?>
                                            </tbody>
                                        </table>
                                        <?php
                                    }
                                    else
                                    {
                                        ?> 
                                            <div ><h4 style="background-color:;text-align:center"> No Record Avialable According To Your Creteria</h4></div>
                                        <?php
                                    }
                                    ?>
                                </div>
                            </div>
                        </div>
                    </div>
				<!--============================END====================================-->
	<!--===================================STAFF Assigned Task============================================-->
				<?php
					if($_SESSION['type']=='S' || $edit_access=='yes')
					{
						?>
						<div class="tab-pane" id="tab_8">
                            <div class="box-header with-border">
                                <h3 style="color:blue" class="box-title"><strong> Staff Assigned Task</strong></h3>
                                <div class="box-body">
                                    <div class="table-responsive">
                                        <?php
                                        $my_staff_assign_task="select * from tk_individual_task where 1 and assign_by!='".$_SESSION['admin_id']."' and (status !='complete' and status !='halt' and status !='cancel' and status !='in_complete') and Validation='valid' and task_type='adhoc_task' order by added_date DESC";
										$ptr_assign_task=mysql_query($my_staff_assign_task);
                                        $no_of_assign_records=mysql_num_rows($ptr_assign_task);
                                        if($no_of_assign_records)
                                        {
                                            ?>
                                            <table class="table no-margin">
                                                <thead>
                                                <tr>
                                                    <th>Task Name</th>
                                                    <th>Assinged To</th>
                                                    <th>Assinged By</th>
                                                    <th>Created Date</th>
                                                    <th>Dead Line</th>
                                                    <th>Details</th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                <?php
                                                    while($assign_task=mysql_fetch_array($ptr_assign_task))
                                                    {
                                                        if($assign_task['staff_status']=='complete'){
                                                            $bg_color='style="background-color:rgb(172,225,175);"';
                                                            }
                                                            elseif($assign_task['staff_status']=='in_progress'){
                                                                $bg_color='style="background-color:rgb(252,255,164);"';
                                                                }
                                                                else{
                                                                    $bg_color='';
                                                                }
                                                        ?>
                                                        <tr <?php echo $bg_color; ?>>
                                                        <td> <b><?php echo ucwords($assign_task['task_name']);?></b><br>
                                                            <?php
                                                            $hours=$assign_task['hours'];
                                                            $time1= convertToHoursMins($hours, '%02d hour %02d min');
                                                            echo $time1.'<br>';
                                                            echo 'Points- '.$assign_task['points'].'<br>';
                                                            echo 'Priority- '.ucfirst($assign_task['priority']);
                                                             ?>
                                                        </td>
                                                            <td>
                                                                <?php
                                                                    $staff_name_c="select name,photo from site_setting where 1 and admin_id='".$assign_task['staff_id']."'";
                                                                    $ptr_data_staff_c=mysql_query($staff_name_c);
                                                                    $fetch_staff_name_c=mysql_fetch_array($ptr_data_staff_c);
                                                                    
                                                                    echo ucfirst($fetch_staff_name_c['name']);
                                                                ?>
                                                            </td>
                                                            <td>
                                                                <?php
                                                                    $staff_names="select name,photo from site_setting where 1 and admin_id='".$assign_task['assign_by']."'";
                                                                    $ptr_staff_names=mysql_query($staff_names);
                                                                    $fetch_staff_names=mysql_fetch_array($ptr_staff_names);
                                                                    
                                                                    echo ucfirst($fetch_staff_names['name']);
                                                                ?>
                                                            </td>
                                                            <td>
                                                                <?php
                                                                    $add_task_Date = date("d-m-Y", strtotime($assign_task['added_date']));
                                                                    echo $add_task_Date ;
                                                                ?>
                                                            </td>
                                                            <td>
                                                                <?php
                                                                    $date=date("d-m-Y");
                                                                    $due_date1=$assign_task['due_date'];
                                                                    $date1=strtotime($date);
                                                                    $due_date=strtotime($due_date1);
                                                                    $due_d_Date = date("d-m-Y", strtotime($assign_task['due_date']));
                                                                    if($date1 > $due_date){
                                                                    ?>
                                                                    <p style="color:red;"><?php
                                                                    echo $due_d_Date ;
                                                                    ?></p><?php
                                                                    }
                                                                    else
                                                                    {?>
                                                                    <p style="color:blue;"><?php
                                                                    echo $due_d_Date ;
                                                                    ?></p><?php
                                                                    }
                                                                ?><br>
                                                                <?php
                                                                ?>
                                                            </td>
                                                            <td>
                                                                <strong><a href="tk_individual_task_detail.php?id=<?= $assign_task['staff_task_id'] ?>" value="">Details</a></strong>
                                                            </td>
                                                        </tr>
                                                        <?php
                                                    }
                                                    ?>
                                                </tbody>
                                            </table>
                                            <?php
                                        }
                                        else
                                        {
                                            ?> 
                                             <div ><h4 style="background-color:;text-align:center"> No Record Avialable According To Your Creteria</h4></div>
                                            <?php
                                        }
                                        ?>
                                    </div>
                                </div>
                            </div>
                        </div>
						<?php
					}
				?>
<!-- ===================================================== Staff Side Complete Task ===================================== -->
                        <?php
                if($_SESSION['type']=='S' || $edit_access=='yes')
					{
						?>
						<div class="tab-pane" id="tab_14">
                            <div class="box-header with-border">
                                <h3 style="color:blue" class="box-title"><strong> Staff Assigned Completed Task</strong></h3>
                                <div class="box-body">
                                    <div class="table-responsive">
                                        <?php
                                        $staff_cmplt_task="select * from tk_individual_task where 1  and (status !='complete' and status !='halt' and status !='cancel' and status !='in_complete') and Validation='valid' and task_type='adhoc_task' and Staff_status='complete' order by added_date DESC";
										$ptr_staff_cmplt_task=mysql_query($staff_cmplt_task);
                                        $no_of_cpmlt_records=mysql_num_rows($ptr_staff_cmplt_task);
                                        if($no_of_cpmlt_records)
                                        {
                                            ?>
                                            <table class="table no-margin">
                                                <thead>
                                                <tr>
                                                    <th>Task Name</th>
                                                    <th>Assinged To</th>
                                                    <th>Assinged By</th>
                                                    <th>Created Date</th>
                                                    <th>Dead Line</th>
                                                    <th>Details</th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                <?php
                                                    while($data_staff_task=mysql_fetch_array($ptr_staff_cmplt_task))
                                                    {
                                                        if($data_staff_task['staff_status']=='complete'){
                                                            $bg_color='style="background-color:rgb(172,225,175);"';
                                                            }
                                                            elseif($data_staff_task['staff_status']=='in_progress'){
                                                                $bg_color='style="background-color:rgb(252,255,164);"';
                                                                }
                                                                else{
                                                                    $bg_color='';
                                                                }
                                                        ?>
                                                        <tr <?php echo $bg_color; ?>>
                                                        <td> <b><?php echo ucwords($data_staff_task['task_name']);?></b><br>
                                                            <?php
                                                            $hours=$data_staff_task['hours'];
                                                            $time1= convertToHoursMins($hours, '%02d hour %02d min');
                                                            echo $time1.'<br>';
                                                            echo 'Points- '.$data_staff_task['points'].'<br>';
                                                            echo 'Priority- '.ucfirst($data_staff_task['priority']);
                                                             ?>
                                                        </td>
                                                            <td>
                                                                <?php
                                                                    $staff_name_c="select name,photo from site_setting where 1 and admin_id='".$data_staff_task['staff_id']."'";
                                                                    $ptr_data_staff_c=mysql_query($staff_name_c);
                                                                    $fetch_staff_name_c=mysql_fetch_array($ptr_data_staff_c);
                                                                    
                                                                    echo ucfirst($fetch_staff_name_c['name']);
                                                                ?>
                                                            </td>
                                                            <td>
                                                                <?php
                                                                    $staff_names="select name,photo from site_setting where 1 and admin_id='".$data_staff_task['assign_by']."'";
                                                                    $ptr_staff_names=mysql_query($staff_names);
                                                                    $fetch_staff_names=mysql_fetch_array($ptr_staff_names);
                                                                    
                                                                    echo ucfirst($fetch_staff_names['name']);
                                                                ?>
                                                            </td>
                                                            <td>
                                                                <?php
                                                                    $add_task_Date = date("d-m-Y", strtotime($data_staff_task['added_date']));
                                                                    echo $add_task_Date ;
                                                                ?>
                                                            </td>
                                                            <td>
                                                                <?php
                                                                    $date=date("d-m-Y");
                                                                    $due_date1=$data_staff_task['due_date'];
                                                                    $date1=strtotime($date);
                                                                    $due_date=strtotime($due_date1);
                                                                    $due_d_Date = date("d-m-Y", strtotime($data_staff_task['due_date']));
                                                                    if($date1 > $due_date){
                                                                    ?>
                                                                    <p style="color:red;"><?php
                                                                    echo $due_d_Date ;
                                                                    ?></p><?php
                                                                    }
                                                                    else
                                                                    {?>
                                                                    <p style="color:blue;"><?php
                                                                    echo $due_d_Date ;
                                                                    ?></p><?php
                                                                    }
                                                                ?><br>
                                                                <?php
                                                                ?>
                                                            </td>
                                                            <td>
                                                                <strong><a href="tk_individual_task_detail.php?id=<?= $data_staff_task['staff_task_id'] ?>" value="">Details</a></strong>
                                                            </td>
                                                        </tr>
                                                        <?php
                                                    }
                                                    ?>
                                                </tbody>
                                            </table>
                                            <?php
                                        }
                                        else
                                        {
                                            ?> 
                                             <div ><h4 style="background-color:;text-align:center"> No Record Avialable According To Your Creteria</h4></div>
                                            <?php
                                        }
                                        ?>
                                    </div>
                                </div>
                            </div>
                        </div>
						<?php
					}
				?>
<!-- =========================================Validation Pending Task task ============================================== -->
                        <?php                       
                            if(isset($_REQUEST['submit_valiadtion']))
                            {
                                $task_ids=$_POST['task_id1'];
                                $validation=$_POST['validation'];
                                $reason=$_POST['reason'];
                                $admin_id =$_SESSION['admin_id'];
   
                                if($reason!='')
                                {
                                    $insert_project="insert into tk_task_validation(`staff_task_id`,`reasons`,`added_date`,`admin_id`) values('".$task_ids."','".$reason."','".date('Y-m-d : H:i:s')."','".$admin_id."')";
                                    $ptr_ins=mysql_query($insert_project);
                                }
                                if($validation!='')
                                {
                                    $update_status="update tk_individual_task set `Validation`='".$validation."' where staff_task_id='".$task_ids."'";
                                    $ptr_update=mysql_query($update_status);
                                }
                            }
                        ?>
                        <div class="tab-pane" id="tab_9">
                            <div class="box-header with-border">
                                <h3 style="color:blue" class="box-title"><strong>Validation Pending Task</strong></h3>
                                <div class="box-body">
                                    <div class="table-responsive">
                                    <?php
                                         if($_SESSION['type']=='S' || $edit_access=='yes'){ 
                                            // $Date12 = date("Y-m-d");
                                            $pending_task1="select * from tk_individual_task where 1 and Validation='pending' and task_type='adhoc_task' order by added_date DESC";
                                        }
                                        else{
                                            // $Date12 = date("Y-m-d");
                                            $pending_task1="select * from tk_individual_task where 1 and staff_id='".$_SESSION['admin_id']."'and Validation='pending' and task_type='adhoc_task' order by added_date DESC"; 
                                        }
										$ptr_pending_task=mysql_query($pending_task1);
                                        $no_of_records1=mysql_num_rows($ptr_pending_task);
                                        if($no_of_records1)
                                        {
                                            ?>
                                            <table class="table no-margin">
                                                <thead>
                                                    <tr>
                                                        <th>Task Name</th>
                                                        <?php
                                                        if($_SESSION['type']=='S' || $edit_access=='yes')
														{
                                                            ?>
															<th>Assinged To</th>
                                                            <?php  
                                                        }
                                                        ?>
                                                        <th>Assinged BY</th>
                                                        <th>Created Date</th>
                                                        <th>Dead Line</th>
                                                        <th>Validation</th>
                                                        <?php
                                                        if($_SESSION['type']=='S' || $edit_access=='yes'){
                                                            ?>
                                                        <th>Details</th>
                                                            <?php  
                                                        }
                                                        ?>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                <?php
                                                    while($data_valid=mysql_fetch_array($ptr_pending_task))
                                                    {
                                                        ?>
                                                        <tr>
                                                            <td><?php echo ucfirst($data_valid['task_name']);  ?></td>
                                                            <?php
                                                            if($_SESSION['type']=='S' || $edit_access=='yes'){
                                                            ?>
                                                            <td> 
                                                                <?php
                                                                    $staff_name_v="select name,photo from site_setting where 1 and admin_id='".$data_valid['staff_id']."'";
                                                                    $ptr_data_staff_v=mysql_query($staff_name_v);
                                                                    $fetch_staff_name_v=mysql_fetch_array($ptr_data_staff_v);
                                                                    echo ucfirst($fetch_staff_name_v['name']);
                                                                ?>
                                                            </td>
                                                            <?php  
                                                            }
                                                            ?>
                                                            <td> 
                                                                <?php
                                                                    $staff_name_v1="select name,photo from site_setting where 1 and admin_id='".$data_valid['assign_by']."'";
                                                                    $ptr_data_staff_v1=mysql_query($staff_name_v1);
                                                                    $fetch_staff_name_v1=mysql_fetch_array($ptr_data_staff_v1);
                                                                    echo ucfirst($fetch_staff_name_v1['name']);
                                                                ?>
                                                            </td>
                                                            <td>
                                                                <?php
                                                                    $add_task_Date = date("d-m-Y : H:m", strtotime($data_valid['added_date']));
                                                                    echo $add_task_Date ;
                                                                ?>
                                                            </td>
                                                            <!-- <td> -->
                                                            <?php
															$date0=date("d-m-Y");
															$due_date1=$data_valid['due_date'];
															$date1=strtotime($date0);
															$due_date=strtotime($due_date1);
															$due_d_Date = date("d-m-Y", strtotime($data_valid['due_date']));
															if($date1 > $due_date){
																?>
																<td style="color:red;"><?php
																echo $due_d_Date ;
																?></td><?php
															}
															else
															{?>
																<td style="color:blue;"><?php
																echo $due_d_Date ;
																?></td><?php
															}
                                                                ?>
                                                            <!-- </td> -->
                                                            <td>
                                                                <?php
                                                                if($_SESSION['type']=='S' || $edit_access=='yes')
                                                                {
                                                                    ?>
                                                                    <button type="button" class="btn btn-default" data-toggle="modal"
                                                                    data-target="#<?php echo $data_valid['staff_task_id'];?>" style="width:70px;"><?php echo ucfirst($data_valid['Validation']);?></button>
                                                                    <div class="modal fade" id="<?php echo $data_valid['staff_task_id'];?>">
                                                                        <div class="modal-dialog">
                                                                            <div class="modal-content">
                                                                            <div class="modal-header">
                                                                                <button type="button" class="close"
                                                                                    data-dismiss="modal" aria-label="Close">
                                                                                    <span aria-hidden="true">&times;</span>
                                                                                </button>
                                                                                <h4><label>Task Validation </label></h4> 
                                                                            </div>
                                                                                <div class="modal-body">
                                                                                    <div class="box box-default">
                                                                                        <form name="task_form12" method="post">
                                                                                            <div class="box-body">
                                                                                                <div class="row">
                                                                                                    <div class="col-md-8">
                                                                                                        <div class="form-group" style="margin-left:30%;">
                                                                                                            <label>Valid
                                                                                                            <input type="radio" name="validation" value="valid" <?php if($_POST['validation'] == "valid") echo 'checked="checked"'; else if($data_valid['Validation']== "valid") echo 'checked="checked"'; ?> class="minimal" >
                                                                                                            </label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                                                                            <label>In-Valid
                                                                                                                <input type="radio" name="validation" value="in_valid"  <?php if($_POST['validation'] == "in_valid") echo 'checked="checked"'; else if($data_valid['Validation']== "in_valid") echo 'checked="checked"'; ?> class="minimal-red">
                                                                                                            </label>
                                                                                                        </div>
                                                                                                        <div class="form-group">
                                                                                                                <input type="hidden" name="task_id1" value="<?php echo $data_valid['staff_task_id'];?>">
                                                                                                                <textarea type="text" class="form-control" name="reason" id="reason"
                                                                                                                    value=""  placeholder="Add Query"></textarea>
                                                                                                        </div>
                                                                                                        <div class="form-group" style="margin-left:10%;">
                                                                                                                <input type="submit" name="submit_valiadtion" value="Submit" class="btn btn-block btn-success">
                                                                                                        </div>
                                                                                                    </div>
                                                                                                </div>
                                                                                            </div>
                                                                                        </form>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                    <?php 
                                                                }
                                                                else
                                                                {
                                                                    echo '<div style="color:red;">'.ucwords($data_valid['Validation']).'</div>';
                                                                }
                                                                ?>
                                                            </td>
                                                            <?php
                                                                if($_SESSION['type']=='S' || $edit_access=='yes'){
                                                                ?>
                                                            <td>
                                                                <strong><a href="tk_individual_task_detail.php?id=<?= $data_valid['staff_task_id'] ?>" value="">Details</a></strong>&nbsp;&nbsp;&nbsp;&nbsp;
                                                                <a href="tk_add_individual_task.php?id=<?=$data_valid['staff_task_id']?>"><i class="fa fa-edit"></i></a>
                                                            </td>
                                                            <?php 
                                                                }
                                                            ?>
                                                        </tr>
                                                        <?php
                                                    }
                                                    ?>   
                                                </tbody>
                                            </table>
                                            <?php
                                        }
                                        else
                                        {
                                            ?> 
                                             <div ><h4 style="background-color:;text-align:center"> No Record Avialable According To Your Creteria</h4></div>
                                            <?php
                                        }
                                        ?>
                                    </div>
                                </div>
                            </div>
                        </div>
    <!-- ==================================In Valid Task ===================================== -->
    <?php
                if($_SESSION['type']=='S' || $edit_access=='yes')
					{
						?>
						<div class="tab-pane" id="tab_15">
                            <div class="box-header with-border">
                                <h3 style="color:blue" class="box-title"><strong>Invalid Task</strong></h3>
                                <div class="box-body">
                                    <div class="table-responsive">
                                        <?php
                                        $my_upc_tasks="select * from tk_individual_task where 1  and  Validation='in_valid' and task_type='adhoc_task' order by added_date DESC";
										$ptr_upc_tasks=mysql_query($my_upc_tasks);
                                        $no_of_records12=mysql_num_rows($ptr_upc_tasks);
                                        if($no_of_records12)
                                        {
                                            ?>
                                            <table class="table no-margin">
                                                <thead>
                                                <tr>
                                                    <th>Task Name</th>
                                                    <th>Assinged To</th>
                                                    <th>Assinged By</th>
                                                    <th>Created Date</th>
                                                    <th>Dead Line</th>
                                                    <th>Validation</th>
                                                    <th>Details</th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                <?php
                                                    while($invalid_task=mysql_fetch_array($ptr_upc_tasks))
                                                    {
                                                        // if($invalid_task['staff_status']=='complete'){
                                                        //     $bg_color='style="background-color:rgb(172,225,175);"';
                                                        //     }
                                                        //     elseif($invalid_task['staff_status']=='in_progress'){
                                                        //         $bg_color='style="background-color:rgb(252,255,164);"';
                                                        //         }
                                                        //         else{
                                                        //             $bg_color='';
                                                        //         }
                                                        ?>
                                                        <tr>
                                                        <td> <b><?php echo ucwords($invalid_task['task_name']);?></b><br>
                                                            <?php
                                                            $hours=$invalid_task['hours'];
                                                            $time1= convertToHoursMins($hours, '%02d hour %02d min');
                                                            echo $time1.'<br>';
                                                            echo 'Points- '.$invalid_task['points'].'<br>';
                                                            echo 'Priority- '.ucfirst($invalid_task['priority']);
                                                             ?>
                                                        </td>
                                                            <td>
                                                                <?php
                                                                    $staff_name_c="select name,photo from site_setting where 1 and admin_id='".$invalid_task['staff_id']."'";
                                                                    $ptr_data_staff_c=mysql_query($staff_name_c);
                                                                    $fetch_staff_name_c=mysql_fetch_array($ptr_data_staff_c);
                                                                    
                                                                    echo ucfirst($fetch_staff_name_c['name']);
                                                                ?>
                                                            </td>
                                                            <td>
                                                                <?php
                                                                    $staff_names="select name,photo from site_setting where 1 and admin_id='".$invalid_task['assign_by']."'";
                                                                    $ptr_staff_names=mysql_query($staff_names);
                                                                    $fetch_staff_names=mysql_fetch_array($ptr_staff_names);
                                                                    
                                                                    echo ucfirst($fetch_staff_names['name']);
                                                                ?>
                                                            </td>
                                                            <td>
                                                                <?php
                                                                    $add_task_Date = date("d-m-Y : H:m", strtotime($invalid_task['added_date']));
                                                                    echo $add_task_Date ;
                                                                ?>
                                                            </td>
                                                            <td>
                                                                <?php
                                                                    $date=date("d-m-Y");
                                                                    $due_date1=$invalid_task['due_date'];
                                                                    $date1=strtotime($date);
                                                                    $due_date=strtotime($due_date1);
                                                                    $due_d_Date = date("d-m-Y", strtotime($invalid_task['due_date']));
                                                                    if($date1 > $due_date){
                                                                    ?>
                                                                    <p style="color:red;"><?php
                                                                    echo $due_d_Date ;
                                                                    ?></p><?php
                                                                    }
                                                                    else
                                                                    {?>
                                                                    <p style="color:blue;"><?php
                                                                    echo $due_d_Date ;
                                                                    ?></p><?php
                                                                    }
                                                                ?><br>
                                                                <?php
                                                                ?>
                                                            </td>
                                                            <td>
                                                                <?php
                                                                    echo ucwords($invalid_task['Validation']) ;
                                                                ?>
                                                            </td>
                                                            <td>
                                                                <strong><a href="tk_individual_task_detail.php?id=<?= $invalid_task['staff_task_id'] ?>" value="">Details</a></strong>
                                                            </td>
                                                        </tr>
                                                        <?php
                                                    }
                                                    ?>
                                                </tbody>
                                            </table>
                                            <?php
                                        }
                                        else
                                        {
                                            ?> 
                                             <div ><h4 style="background-color:;text-align:center"> No Record Avialable According To Your Creteria</h4></div>
                                            <?php
                                        }
                                        ?>
                                    </div>
                                </div>
                            </div>
                        </div>
						<?php
					}
				?>
					<!--=================END Staff Assigned Task==================-->
                </div>
                <!-- /.tab-content -->
            </div>
            <!-- nav-tabs-custom -->
        </div>
        <!-- end of task code -->
   <!--=============================== ===================== To Do List start ===================== =====================================-->
                <div class="col-md-4">
                    <div class="box box-primary">
                        <div class="box-header">
                            <i class="ion ion-clipboard"></i>
                            <h3 class="box-title">To Do List</h3>
                        </div>
                        <div class="box-body">
                            <ul class="todo-list">
                                <?php
                                if(isset($_POST['submit']))
                                {
                                    $task_name=addslashes($_POST['task_name']);
                                    $due_date=$_POST['due_date'];
                                    $new_date=explode("/",$due_date);
                                    $due_date_fromat=$new_date[2].''.$new_date[1].''.$new_date[0];
                                    $admin_id =$_SESSION['admin_id'];

                                    if($task_name !=""  )
                                    {
                                        $insert_task="insert into tk_personal_task(`task_name`,`due_date`,`status`,`cm_id`,`admin_id`,`added_date`) values('".$task_name."','".$due_date_fromat."','added','".$_SESSION['cm_id']."','".$admin_id."','".date('Y-m-d : H:i:s')."')";
                                        $ptr_ins_t=mysql_query($insert_task);  
                                        // if ($ptr_ins_t)
                                        // {
                                        ?>
                                        <!-- <div class="alert alert-success alert-dismissible"><p>Success.</p></div>
                                        <script>setTimeout('document.location.href="tk_dashboard.php";', 1000);</script> -->
                                        <?php
                                        // }
                                    }
                                }
                                if(isset($_POST['status_change']))
                                {
                                    $task_id=$_POST['task_id'];
                                    $upd_status="update tk_personal_task set `status`='complete' where tpt_id='".$task_id."'";
                                    $ptr_upd_status=mysql_query($upd_status); 
                                    // if ($ptr_upd_status)
                                    //     {
                                    ?>
                                    <!-- <div class="alert alert-success alert-dismissible"><p>Success.</p></div> -->
                                    <!-- <script>setTimeout('document.location.href="tk_dashboard.php";', 1000);</script> -->
                                    <?php
                                    // }
                                }
                                $sel_task="select tpt_id,task_name,due_date,status from tk_personal_task where 1 and admin_id='".$_SESSION['admin_id']."'and status !='complete'  order by due_date asc"; 
                                $ptr_sel_task=mysql_query($sel_task);
                                $i=1;
                                while($data=mysql_fetch_array($ptr_sel_task))
                                {
                                    ?>
                                    <li>
                                        <!-- <span class="text" ><?php //echo $i++;  ?>.</span> -->
                                        <span class="text" style="width:190px;text-align:left;"><?php echo ucwords($data['task_name']);  ?></span>
                                        <?php
                                        $current_date=date("d-m-Y");
                                        $dueDate = $data['due_date'];
                                        $new_current_date =strtotime($current_date);
                                        $new_dueDate =strtotime($dueDate);
                                        $due_Date = date("d-m-Y", strtotime($data['due_date']));
                                        if( $new_current_date > $new_dueDate)
                                        {
                                            ?>
                                                <span class="label label-danger"><?php  echo $due_Date ;?></span>
                                            <?php
                                        }
                                        else
                                        {
                                            ?>
                                                <span class="label label-warning"><?php echo $due_Date ;?> </span>
                                            <?php
                                        } 
                                        ?>
                                        <div class="tools">
                                            <!-- <a href="tk_personal_task.php?id=<?=$data['tpt_id'] ?>"> <i class="fa fa-edit"></i></a> -->
                                            <form name="personal_task_form" method="post">  
                                                <input type="hidden" name="task_id" value="<?php echo $data['tpt_id'];?>" >        
                                                <input type="submit" name="status_change" value="Complete" class="btn btn-success btn-xs" >              
                                            </form>
                                        </div>
                                    </li>
                                    <?php
                                }
                                ?>
                            </ul>
                        </div>
                            <form name="task_form" method="post">
                                <div class="box-footer clearfix no-border">
                                    <div class="row">
                                        <div class="col-md-7 form-group">
                                            <textarea  name="task_name"  class="form-control"  Required  style="height:35px;"  placeholder="Task  Name"></textarea>
                                        </div>
                                        <div class="col-md-3 form-group">
                                            <input type="text"  name="due_date" id="datepicker" class="form-control" placeholder="Due Date" Required value="" style="width:80px;">
                                        </div>
                                        <div class="col-md-2 form-group">
                                            <button type="submit" name="submit" value="Submit" class="btn btn-default pull-right"><i class="fa fa-plus"></i></button>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
<!-- ================================== To Do List end ========================================== -->
				
<!-- ==================================SYSTEM TASK START ========================================== -->
                <!-- <div class="row"> -->
            <div class="box box-info">
                <div class="box-header with-border">
                    <h3 class="box-title"> Systems Tasks</h3>
                    <!-- <div class="box-tools pull-right">
                        <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
                        </button>
                        <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
                    </div> -->
                </div>
                <!-- /.box-header -->
                <div class="box-body">
                    <div class="table-responsive">
                        <?php
						
						$where_assign=" and staff_id='".$_SESSION['admin_id']."'";	
						// if($_SESSION['type']=='S' || $edit_access=='yes')
                        // {
						// 	$where_assign="";
						// }
						$my_system_task="select * from tk_individual_task where 1 and task_type='system' and (status !='complete' and status !='halt' and status !='cancel' and status !='in_complete') and Validation='valid' ".$where_assign." order by added_date DESC";
						$ptr_system_task=mysql_query($my_system_task);
						$no_of_sys_records=mysql_num_rows($ptr_system_task);
						if($no_of_sys_records)
						{
							?>
							<table class="table no-margin" width="100%">
								<thead>
									<tr>
										<th width="20%">Task Name</th>
										<th width="35">Task Description</th>
										<th width="12%">Assinged To</th>
										<th width="8%">Created Date</th>
										<th width="8%"><span>Dead Line</span></th>
										<th width="8%">Details</th>
										<th width="8%">Action</th>
									</tr>
								</thead>
								<tbody>
								<?php
								while($data_system_task=mysql_fetch_array($ptr_system_task))
								{
									?>
									<tr>
										<td><?php echo ucwords($data_system_task['task_name']);?></td>
										<td><?php echo ucwords($data_system_task['description']);?></td>
										<td>
											<?php
											$staff_name_c="select name,photo from site_setting where 1 and admin_id='".$data_system_task['staff_id']."'";
											$ptr_data_staff_c=mysql_query($staff_name_c);
											$fetch_staff_name_c=mysql_fetch_array($ptr_data_staff_c);
											echo ucfirst($fetch_staff_name_c['name']);
											?>
										</td>
										<td>
											<?php
											$add_task_Date=date("d-m-Y", strtotime($data_system_task['added_date']));
											echo $add_task_Date ;
											?>
										</td>
										<td>
											<?php
											$date=date("d-m-Y");
											$due_date1=$data_system_task['due_date'];
											$date1=strtotime($date);
											$due_date=strtotime($due_date1);
											$due_d_Date = date("d-m-Y", strtotime($data_system_task['due_date']));
											if($date1 > $due_date){
												?>
												<span style="color:red;"><?php
												echo $due_d_Date ;
												?></span><?php
											}
											else
											{?>
												<span style="color:blue;"><?php
												echo $due_d_Date ;
												?></span><?php
											}
											?>
										</td>
										<td>
											<strong><a target="_blank" href="tk_individual_task_detail.php?id=<?= $data_system_task['staff_task_id'] ?>" value="">Details</a></strong>
										</td>
										<td>
											<strong><a target="_blank" href="https://www.isasbeautyschool.org/faculty_login/<?php echo $data_system_task['url']; ?>" value="">Action</a></strong>
										</td>
									</tr>
									<?php
								}
								?>
								</tbody>
							</table>
							<?php
						}
						else
						{
							?> 
							 <div><h4 style="background-color:;text-align:center">No Record Avialable According To Your Creteria</h4></div>
							<?php
						}
						?>
                    </div>
                	<!-- /.table-responsive -->
                </div>
                <!-- /.box-body -->
                <div class="box-footer clearfix">
                <!-- <a href="javascript:void(0)" class="btn btn-sm btn-info btn-flat pull-left">Place New Order</a> -->
                <a href="javascript:void(0)" class="btn btn-sm btn-default btn-flat pull-right">View All Task</a>
                </div>
            <!-- /.box-footer -->
            </div>
<!-- ==================================SYSTEM TASK END========================================== -->
          <!-- /.box -->
        <!-- </div> -->
            <!-- </div> -->
        </section>
            <!-- main body code end -->
    </div>
        <?php include "include/footer-main.php"; ?>
    </div>
    <!-- jQuery 3 -->
    <script src="bower_components/jquery/dist/jquery.min.js"></script>
    <!-- Bootstrap 3.3.7 -->
    <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
    <!-- Select2 -->
    <script src="bower_components/select2/dist/js/select2.full.min.js"></script>
    <!-- InputMask -->
    <script src="plugins/input-mask/jquery.inputmask.js"></script>
    <script src="plugins/input-mask/jquery.inputmask.date.extensions.js"></script>
    <script src="plugins/input-mask/jquery.inputmask.extensions.js"></script>
    <!-- date-range-picker -->
    <script src="bower_components/moment/min/moment.min.js"></script>
    <script src="bower_components/bootstrap-daterangepicker/daterangepicker.js"></script>
    <!-- bootstrap datepicker -->
    <script src="bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js"></script>
    <!-- bootstrap color picker -->
    <script src="bower_components/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.min.js"></script>
    <!-- bootstrap time picker -->
    <script src="plugins/timepicker/bootstrap-timepicker.min.js"></script>
    <!-- SlimScroll -->
    <script src="bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
    <!-- iCheck 1.0.1 -->
    <script src="plugins/iCheck/icheck.min.js"></script>
    <!-- FastClick -->
    <script src="bower_components/fastclick/lib/fastclick.js"></script>
    <!-- AdminLTE App -->
    <script src="dist/js/adminlte.min.js"></script>
    <!-- AdminLTE for demo purposes -->
    <script src="dist/js/demo.js"></script>

    <!-- Morris.js charts -->
    <script src="../../bower_components/raphael/raphael.min.js"></script>
    <!-- <script src="../../bower_components/morris.js/morris.min.js"></script> -->
    <!-- date-range-picker -->
    <script src="bower_components/moment/min/moment.min.js"></script>
    <script src="bower_components/bootstrap-daterangepicker/daterangepicker.js"></script>
    <!-- bootstrap datepicker -->
    <script src="bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js"></script>
    <!-- bootstrap color picker -->
    <script src="bower_components/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.min.js"></script>
    <!-- bootstrap time picker -->
    <script src="plugins/timepicker/bootstrap-timepicker.min.js"></script>

    <!-- Page script -->
        <script>
        $(function () {
            //Initialize Select2 Elements
            $('.select2').select2()

            //Datemask dd/mm/yyyy
            /*$('#datemask').inputmask('dd/mm/yyyy', { 'placeholder': 'dd/mm/yyyy' })
            //Datemask2 mm/dd/yyyy
            $('#datemask2').inputmask('mm/dd/yyyy', { 'placeholder': 'mm/dd/yyyy' })
            //Money Euro
            $('[data-mask]').inputmask()
        
            //Date range picker
            $('#reservation').daterangepicker()
            //Date range picker with time picker
            $('#reservationtime').daterangepicker({ timePicker: true, timePickerIncrement: 30, format: 'MM/DD/YYYY h:mm A' })
            //Date range as a button
            $('#daterange-btn').daterangepicker(
              {
                ranges   : {
                  'Today'       : [moment(), moment()],
                  'Yesterday'   : [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
                  'Last 7 Days' : [moment().subtract(6, 'days'), moment()],
                  'Last 30 Days': [moment().subtract(29, 'days'), moment()],
                  'This Month'  : [moment().startOf('month'), moment().endOf('month')],
                  'Last Month'  : [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
                },
                startDate: moment().subtract(29, 'days'),
                endDate  : moment()
              },
              function (start, end) {
                $('#daterange-btn span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'))
              }
            )*/

            //Date picker
            $('#datepicker').datepicker({
                autoclose: true,
                format: 'dd/mm/yyyy',
                startDate: '-0d',
                Default: true,
                todayHighlight: true
            })
            $('#datepicker1').datepicker({
                autoclose: true,
                format: 'dd/mm/yyyy',
                Default: true,
                todayHighlight: true
            })
            //iCheck for checkbox and radio inputs
            $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
                checkboxClass: 'icheckbox_minimal-blue',
                radioClass: 'iradio_minimal-blue'
            })
            //Red color scheme for iCheck
            $('input[type="checkbox"].minimal-red, input[type="radio"].minimal-red').iCheck({
                checkboxClass: 'icheckbox_minimal-red',
                radioClass: 'iradio_minimal-red'
            })
            //Flat red color scheme for iCheck
            $('input[type="checkbox"].flat-red, input[type="radio"].flat-red').iCheck({
                checkboxClass: 'icheckbox_flat-green',
                radioClass: 'iradio_flat-green'
            })

            //Colorpicker
            $('.my-colorpicker1').colorpicker()
            //color picker with addon
            $('.my-colorpicker2').colorpicker()

            //Timepicker
            $('.timepicker').timepicker({
                showInputs: false
            })
        })
    </script>
    <?php
  // }
// }
	// else{
		?> 
		 <!-- <div ><h4 style="background-color:;text-align:center">No Record Avialable According To Your Creteria</h4></div> -->
		<?php
	// }

   ?>
<!-- </div></div> -->

 <!-- ============================personal due task==================================== -->
	<!-- <div class="tab-pane" id="tab_5"> -->

	<!-- <h4 style="color:red"><strong>Due Task</strong></h4><hr> -->
	<!-- <div class="direct-chat-messages">
		<div style="width:750px;"> -->
	<?php
	// $my_due_task='';
	// if($_SESSION['type']!='S'){ 
	//  $Dates = date("Y-m-d");
	//  $my_due_task="select * from tk_individual_task where 1 and staff_id='".$_SESSION['admin_id']."'and (status !='complete' and status !='halt' and status !='cancel' and status !='pending') and due_date < '".$Dates."' and Validation='valid' order by added_date DESC";         
	// }
	// else{
	//  $Dates = date("Y-m-d");
	//  $my_due_task="select * from tk_individual_task where 1 and (status !='complete' and status !='halt' and status !='cancel' and status !='pending') and due_date < '".$Dates."' and Validation='valid' order by added_date DESC";  
	// }
	// echo  $my_due_task;
	//  $ptr_due_task=mysql_query($my_due_task);
	//  $no_of_records=mysql_num_rows($ptr_due_task);
	//         if($no_of_records)
	//         {
				?>
	<!-- <div class="row"> -->
	<!-- <div class="col-md-3" align="center"><strong>Task Name</strong></div>
	<?php //if($_SESSION['type']=='S'){?>
	<div class="col-md-3" align="center"><strong>Staff Name</strong></div>
	<?php// } ?>
	<div class="col-md-2" align="center"><strong>Created Date </strong></div>
	<div class="col-md-2" align="center"><strong>Dead Line </strong></div>
	<div class="col-md-2" align="center"><b>Updated Dead Line </b></div> -->

	<!-- <div class="col-md-3"><strong> Updated Dead Line </strong></div> -->
 <!-- </div> -->
	<?php 
//   while($due_task=mysql_fetch_array($ptr_due_task))
//     {
		// echo $due_task['due_date'];?>
</body>

</html>