<?php include 'inc_classes.php'; 
include "admin_authentication.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';
// }
$staff_task_id=$_GET['id'];
?>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Individual Task Detail</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">
    <!-- 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">
</head>
<script>
    function show_rating(value) {
        task_status = value.split("-");
        if (task_status[0] == "complete") {
            document.getElementById("rate").style.display = 'block';
            document.getElementById("due").style.display = 'none';
        }
        else {
            document.getElementById("rate").style.display = 'none';
        }
    }
    function complete_date(value) {
        // alert('hi');
        complt_date = value.split("-");
        // alert('complt_date'+ complt_date);
        added_date = document.getElementById("added_date").value;
        // alert('added_date'+ added_date);
        if (complt_date < added_date) {
            // document.getElementById("rate").style.display = 'block';
            // document.getElementById("due").style.display = 'none';
            alert('Something wrong ! Complete Date Should Be Greater Than Added Date');
            window.location.reload();
        }
        else {
           return true;
        }
    }
    function hold_status(status) {
        priority = document.getElementById("priority").value;
        document.getElementById("rate").style.display = 'none';
        var status_data = "action=hold&status=" + status + "&priority=" + priority;
        // alert(status);
        $.ajax({
            url: "tk_staff_ajax.php", type: "post", data: status_data, cache: false,
            success: function (retstatus) {
                // alert(retstatus);
                document.getElementById("hold_sta").innerHTML = retstatus;
                $('.datepicker').datepicker({ changeMonth: true, changeYear: true, format: 'dd/mm/yyyy', startDate: '-0d', showButtonPanel: true, closeText: 'Clear' });
            }
        });
    }
    function validations(valid) {
        tasks_id = document.getElementById("task_ids1").value;
        admin_ids = document.getElementById("admin_ids").value;
        var valid_data = "action=validation&valid=" + valid + "&tasks_id=" + tasks_id+ "&admin_id=" + admin_ids;
        // alert('task_id='+tasks_id);
        // alert(valid);
        $.ajax({
            url: "tk_staff_ajax.php", type: "post", data: valid_data, cache: false,
            success: function (retvalid) {
                alert("Status Successfully Updated as " + valid);
                setTimeout('document.location.href="tk_individual_task_detail.php?id=<?= $staff_task_id ?>";', 200);
            }
        });
    }
</script>
<?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>
                    <!-- <a href="tk_dashboard.php"> Back</a> -->
                    <h2>
                        Details
                    </h2>
                </div>
                <ol class="breadcrumb">
                    <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
                    <li class="active">Dashboard</li>
                </ol>
            </section>
            <section class="invoice">
                <div class="box box-default">
                    <div class="row">
                        <div class="col-xs-12">
                            <?php
                             if($_REQUEST['id']!='')
                             {
                                 $record_id=$_REQUEST['id'];
                                 $task_detail_data="select * from tk_individual_task where staff_task_id='".$record_id."' ";
                                 $ptr_detail=mysql_query($task_detail_data);
                                 $data=mysql_fetch_array($ptr_detail);
                                 $cm_id=$data['cm_id'];
                                 $staff_id1=$data['staff_id'];
                                //  $cmplt_date=$data['staff_complete_date'];
                                //  $complete_dates=date("Y-m-d",strtotime( $cmplt_date));
                             }
                             $sel_dept="SELECT dept_id FROM `dept_employee` WHERE 1 and staff_id='".$data['staff_id'] ."'";
                            $ptr_dept=mysql_query($sel_dept);
                            $data_dept=mysql_fetch_array($ptr_dept);

                            $select_manager="SELECT * FROM `dept_employee` WHERE 1 and status='manager' and dept_id='".$data_dept['dept_id']."'";
                            $ptr_manager=mysql_query($select_manager);
                            $data_manager=mysql_fetch_array($ptr_manager);
                            if(isset($_REQUEST['submit']))
                            {
                                $count=$data['deadline_count'];
                               
                                $point=$data['points'];
                                $staff_id=$data['staff_id'];
                                $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'];
                                $admin_name="select name from site_setting where 1 and admin_id='".$admin_id."'";
                                $ptr_admin_name=mysql_query($admin_name);
                                $fetch_admin_name=mysql_fetch_array($ptr_admin_name);
                                $status=$_POST['optradio']; 
                                $complete=$_POST['compl_date'];
                                $new_compl_date=explode("/",$complete);
                                $complt_date_fromat=$new_compl_date[2].''.$new_compl_date[1].''.$new_compl_date[0];
                                $complt_dates=$new_compl_date[2].'-'.$new_compl_date[1].'-'.$new_compl_date[0];
 
                                // if($complete_dates!='' && $data['staff_status']!='')
                                // if($complt_date_fromat)
                                // {
                                    $data_date= $complt_date_fromat;
                                // }
                                // else{
                                    // $data_date=date("Y-m-d");
                                //     $data_date=$complete_dates;
                                // }
                                if($status=='complete')
                                    {
                                        $rating=trim($_POST['rating']);
                                    }
                                else{
                                        $rating='';
                                    }
                                $staff_status=$_POST['staff_status'];
                                $unhalt_date=$_POST['unhalt_date'];
                                $priority=$_POST['priority'];
                                $up_deadline=$_POST['up_deadline_date'];
                                $new_date1=explode("/",$up_deadline);
                                $up_deadline_date=$new_date1[2].'-'.$new_date1[1].'-'.$new_date1[0];

                                        $rate_p="select rating_point from tk_quality_work_point where rating ='".$rating."'";
                                        $ptr_rate_p=mysql_query($rate_p);
                                        $data_rate_p=mysql_fetch_array($ptr_rate_p);
                                        $rating_point='';
                                        if($status=='complete'){
                                        $rating_point=$data_rate_p['rating_point'];
                                        }
                                        elseif($status=='in_complete'){
                                            $rating_point=0;
                                        }
                                     
                                    $comment='';
                                    $type='';
                                    $actual_dead_line=date("Y-m-d",strtotime($data['due_date']));
                                    if($_POST['comment']!='') {
                                        $comment=addslashes($_POST['comment']);
                                        $type='comment';
                                          }
                                    elseif( $due_date!=''){
                                        $comment=''.$fetch_admin_name['name'].' changed due date from '.$actual_dead_line.' to- '.$due_date.''; 
                                        $type='due_date_change';
                                    }
                                    elseif($status!='' && $_POST['optradio']!='in_progress'){
                                        if($status=='halt'){
                                            $comment=''.$fetch_admin_name['name'].' mark status as - '.$status.' and set deadline from '.$data['due_date'].' to '. $up_deadline_date.' and priority from '.$data['priority'].' to '.$priority.' and un_holt date is '.$unhalt_date.'';
                                            $type='status_as_halt';
                                        }
                                        else{
                                            $comment=''.$fetch_admin_name['name'].' changed task status as - '.$status.'';
                                            $type='status_change';
                                        }
                                        }
                                    elseif($staff_status!=''){
                                            $comment=''.$fetch_admin_name['name'].' marked my side task status as - '.$staff_status.'';
                                            $type='staff_status';
                                        }
                                    $points='';
                                    $dat1=date("Y-m-d");
                                    // $dd1= strtotime($dat1);
                                    if($actual_dead_line< $dat1 ){
                                        $deadline_count=$count+1;
                                    }
                                    else{
                                        $deadline_count=$count;
                                    }
                                    // echo '<br>'.$complt_dates  ;
                                    // echo '<br>'.$actual_dead_line;
                                    if($status=='complete') {
                                        $p='2';
                                        if($complt_dates <= $actual_dead_line  ){
                                            $points=$point;
                                        }
                                        elseif($count == 2 && $complt_dates > $actual_dead_line) {
                                            $points=$point/$p;
                                            }
                                        elseif($count == 3 && $complt_dates > $actual_dead_line) {
                                            $points=0;
                                            }
                                        elseif($count > 3 && $complt_dates > $actual_dead_line) {
                                            $points='-'.$point;
                                            // $poi=$point;
                                            }        
                                        elseif($complt_dates > $actual_dead_line){
                                            $points=$point/$p;
                                            }
                                        else{
                                            $points=$point;
                                            }
                                    }
                                    elseif($status=='in_complete')
                                         {
                                        $points='-'.$point;
                                        // $poi=$point;
                                        }
                                        $staff_names=$_POST['staff_names'];
                                        $sel_cm="select cm_id from site_setting where admin_id='".$staff_names."'";
                                        $ptr_cm=mysql_query($sel_cm);
                                        $data_cm=mysql_fetch_array( $ptr_cm);
                                        $cm_ids= $data_cm['cm_id'];
                                        
                                        // $compt_date=$_POST['complt_date'];
                                        // if($compt_date!=''){
                                        //     $new_dates=explode("/",$compt_date);
                                        //     $complte=$new_dates[2].'-'.$new_dates[1].'-'.$new_dates[0];
                                        //      $added_date= $complte;
                                        // }
                                        // else{
                                        //     $added_date=date('Y-m-d : H:i:s');
                                        // }
                                        // $priority=$_POST['priority'];
                                        // $up_deadline_date=$_POST['up_deadline_date'];
                                if($comment !="")
                                {
                                    // detail inserting
                                $task_details="insert into individual_task_details(`staff_task_id`,`comment`,`type`,`admin_id`,`cm_id`,`added_date`) values('".$staff_task_id."','".$comment."','".$type."','".$admin_id."','".$_SESSION['cm_id']."','".date('Y-m-d : H:i:s')."')";
                                    $ptr_data=mysql_query($task_details); 
                                }
                                if($due_date_fromat !="")
                                {
                                $update_status="update tk_individual_task set `due_date`='".$due_date_fromat."',`dd_change_admin_id`='".$admin_id."',`deadline_count`='".$deadline_count."' where staff_task_id='".$staff_task_id."'";
                                $ptr_ins_t=mysql_query($update_status); 
                                }
                                if($status !="" && $unhalt_date !='' && $up_deadline_date!='' && $priority !='' )
                                {
                                   $update_status_halt="update tk_individual_task set `status`='".$status."',`unhold_date`='".$unhalt_date."',`priority`='".$priority."',`due_date`='".$up_deadline_date."' where staff_task_id='".$staff_task_id."'";
                                $ptr_ins_halt=mysql_query($update_status_halt); 
                                }
                                if($staff_names !="" && $cm_ids !=''  )
                                {
                                  $update_staff="update tk_individual_task set `staff_id`='".$staff_names."',`cm_id`='".$cm_ids."' where staff_task_id='".$staff_task_id."'";
                                $ptr_update_staff=mysql_query($update_staff); 
                                if($ptr_update_staff)
                                {
                                    ?>
                                        <script>setTimeout('document.location.href="tk_individual_task_detail.php?id=<?= $staff_task_id ?>";', 100);</script>
                                    <?php
                                }
                                }
                                // tk_task update for the status inserting
                                if($status !="" )
                                {
                                    // if($data['assign_type']=='meeting' || $data['assign_type']=='staff_discussion')
                                    // {
                                    //     $sel_staff_cnt="select staff_task_id,staff_id,points from tk_individual_task where ref_id='".$data['ref_id']."'";
                                    //     $ptr_staff_cnt=mysql_query( $sel_staff_cnt);
                                    //     while($tot_cnt=mysql_fetch_array($ptr_staff_cnt))
                                    //     {
                                    //         // $point_p=0;
                                    //         // $ratings='';
                                    //         if($status=='complete') {
                                    //             $point_p=$tot_cnt['points'];
                                    //             $ratings=$rating;
                                    //         }
                                    //         elseif($status=='in_complete')
                                    //         {
                                    //             $point_p='-'.$tot_cnt['points'];
                                    //             $ratings=0;
                                    //         }
                                    //         // $point_p=$tot_cnt['points'];
                                    //     '<br>'.$update_status="update tk_individual_task set `status`='".$status."',`earn_points`='".$point_p."',`rating`='".$ratings."',`rating_point`='".$rating_point."',`sta_updated_admin_id`='".$admin_id."',`sta_complete_date`='".$data_date."' where staff_task_id='".$tot_cnt['staff_task_id']."'";
                                    //    $ptr_update_status=mysql_query($update_status);
                                      
                                    //       '<br>'.$ins_per="insert into tk_employee_performance (`staff_task_id`,`staff_id`,`earn_points`,`rating_point`,`date`,`cm_id`,`admin_id`)values('".$tot_cnt['staff_task_id']."','".$tot_cnt['staff_id']."','".$point_p."','".$rating_point."','".$data_date."','".$cm_id."','".$admin_id."')";
                                    //     $ptr_p=mysql_query($ins_per);
                                    
                                    //     }
                                    // }
                                    // else
                                    // {
                                        $update_status="update tk_individual_task set `status`='".$status."',`earn_points`='".$points."',`rating`='".$rating."',`rating_point`='".$rating_point."',`sta_updated_admin_id`='".$admin_id."',`sta_complete_date`='".$data_date."' where staff_task_id='".$staff_task_id."'";
                                        $ptr_ins_t=mysql_query($update_status); 
                                        if($status=='complete' || $status=='in_complete'){
                                           
                                                  $ins_per="insert into tk_employee_performance (`staff_task_id`,`staff_id`,`earn_points`,`rating_point`,`date`,`cm_id`,`admin_id`)values('".$staff_task_id."','".$staff_id."','".$points."','".$rating_point."','".$data_date."','".$cm_id."','".$admin_id."')";
                                            $ptr_p=mysql_query($ins_per);
                                        }
                                    // }
                                }
                                if($staff_status!="")
                                {
                                    $update_staff_status="update tk_individual_task set `staff_status`='".$staff_status."',`staff_complete_date`='".date('Y-m-d')."' where staff_task_id='".$staff_task_id."'";
                                    $ptr_ins_staff=mysql_query($update_staff_status); 
                                }
                                if($status=='complete')
                                {
                                    ?>
                                    <div class="alert alert-success alert-dismissible">
                                        <button type="button" class="close" data-dismiss="alert"
                                            aria-hidden="true">&times;</button>
                                        <h4><i class="icon fa fa-ban"></i> Alert!</h4>
                                        <p> Record Updated Successfully.</p>
                                    </div>
                                    <script>setTimeout('document.location.href="tk_individual_task_detail.php?id=<?= $staff_task_id ?>";', 500);</script>
                                    <?php
                                }
                                // }
                                //======================================
                                // if($_REQUEST['deleteComment']!='' && $_REQUEST['ids']!='')
                                // {
                                //     $id_detail=$_REQUEST['ids'];
                                //     $staff_delete="delete from individual_task_details where detail_id='".$id_detail."'and staff_task_id='".$record_id."' " ;
                                //     $ptr_staff_delete=mysql_query($staff_delete);
                                // }
                                // 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_ins_t=mysql_query($update_status);
                                // }
                            }
                            ?>
                        </div>
                        <div>
                            <form name="task_form" method="post">
                                <div class="row">
                                    <div class="table-responsive col-xs-6">
                                        <!-- <div class="table-responsive"> -->
                                        <table class="table no-margin" style="text-align:center">
                                            <thead>
                                                <tr>
                                                    <!-- <th style="text-align:center">Add New Memeber</th> -->
                                                    <th style="text-align:center">Task</th>
                                                    <th style="text-align:center">Assign By</th>
                                                    <th style="text-align:center">Assign To</th>
                                                    <th style="text-align:center">Priority</th>
                                                    <th style="text-align:center">Actual Dead Line</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <tr>
                                                    <!--<td>
                                                    <span class="dropdown">
                                                    <?php
                                                    if( $_SESSION['type']=='S' || $edit_access=='yes' && $data['assign_type']=='staff_discussion' || $data['assign_type']=='meeting' && $data['status']!='complete' && $data['task_type']=='adhoc' )
                                                    {
                                                    ?>
                                                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                                                            <small  style="margin-left:;"><i class="fa fa-user-plus"></i></small>
                                                        </a>
                                                        <?php
                                                    }
                                                    ?>
                                                        <ul class="dropdown-menu" style="margin-left:;">
                                                            <div class="direct-chat-messages">
                                                    
                                                            <?php
                                                                // if(isset($_REQUEST['add_staff']))
                                                                // {
                                                                //     $staff_ids=$_POST['staffs'];
                                                                //     $ref_id=$data['ref_id'];
                                                                //     $admin_id =$_SESSION['admin_id'];
                                                                //     $sel_staff_type="select type from site_setting where admin_id='".$staff_ids."'";
                                                                //     $ptr_staff_type=mysql_query($sel_staff_type);
                                                                //     $data_staff_type=mysql_fetch_array($ptr_staff_type);
                                                                //     $staff_type=$data_staff_type['type'];
                                                                //     $hourss=$data['hours'];
                                                                //     if($staff_type=='F'){
                                                                //         $pointss=$hourss*0.221;
                                                                //     }
                                                                //     else{
                                                                //         $pointss=$hourss*0.208;
                                                                //     }
                                                                                
                                                                //     '<br>'.$insert_task="insert into tk_individual_task(`task_type`,`ref_id`,`task_name`,`assign_type`,`staff_id`,`description`,`assign_by`,`priority`,`task_minute`,`task_hour`,`hours`,`time_type`,`points`,`due_date`,`date`,`deadline_count`,`Validation`,`status`,`repetation_id`,`repeat_date_month`,`repeat_date_year`,`cm_id`,`admin_id`,`added_date`) values('adhoc_task','".$ref_id."','".$data['task_name']."','".$data['assign_type']."','".$staff_ids."','".$data['description']."','".$data['assign_by']."','". $data['priority']."','".$data['task_minute']."','".$data['task_hour']."','".$hourss."','".$data['time_type']."','".$pointss."','".$data['due_date']."','".date('Y-m-d')."','1','valid','in_progress','".$data['repetation_id']."','".$data['repeat_date_month']."','".$data['repeat_date_year']."','".$data['cm_id']."','".$admin_id."','".date('Y-m-d : H:i:s')."')"; 
                                                                //     $ptr_data=mysql_query($insert_task); 
                                                                //     $task_id=mysql_insert_id();  
                                                                //     $task_details="insert into individual_task_details(`staff_task_id`,`admin_id`,`cm_id`,`added_date`) values('".$task_id."','".$admin_id."','".$_SESSION['cm_id']."','".date('Y-m-d : H:i:s')."')";
                                                                //     $ptr_data=mysql_query($task_details); 

                                                                //     $sel_days="select days from tk_repetation_days where staff_task_id='".$record_id."'";
                                                                //     $ptr_days=mysql_query($sel_days);
                                                                //     while($data_days=mysql_fetch_array($ptr_days))
                                                                //         {
                                                                //             $days=$data_days['days'];
                                                                //              echo $insert_days="insert into tk_repetation_days(`staff_task_id`,`repetation_id`,`days`) values('".$task_id."','".$data['repetation_id']."','".$data_days['days']."')";
                                                                //         }
                                                                //         $ptr_days=mysql_query($insert_days);
                                                                    
                                                                // }
                                                                // $ref_id=$data['ref_id'];
                                                                // $staff_id_coll='';
                                                                // $sel_team_id="select staff_id from tk_individual_task where ref_id='".$ref_id."'";
                                                                // $ptr_team_id=mysql_query($sel_team_id);
                                                                // $tot=mysql_num_rows($ptr_team_id); 
                                                                // $it=1;
                                                                // while($fetch_team_id=mysql_fetch_array($ptr_team_id))
                                                                // {
                                                                //     if($it==$tot)
                                                                //         {
                                                                //             $staff_id_coll .= $fetch_team_id['staff_id'];
                                                                //         }
                                                                //         else
                                                                //         {            
                                                                //             $staff_id_coll .=$fetch_team_id['staff_id'].',';
                                                                //         }
                                                                //         $it++; 
                                                                //     }                                                              
                                                                //         $sel_staff="select name,admin_id from site_setting where admin_id NOT IN(".$staff_id_coll.") and system_status='Enabled' order by name asc ";
                                                                //         $ptr_staff_data=mysql_query($sel_staff);
                                                                //         while($fetch_staff_data=mysql_fetch_array($ptr_staff_data))
                                                                //         {
                                                                //             $colla_id=$fetch_staff_data['admin_id'];    
                                                                            ?>
                                                                                    <div>
                                                                                        <span><input type="submit" name="add_staff" value=""></span>
                                                                                        <span><input type="hidden" name="staffs" value="<?php echo  $colla_id;?>"></span>
                                                                                        <span><?php  echo ucwords($fetch_staff_data['name']);?></span>
                                                                                    </div>
                                                                            <?php
                                                                        // }
                                                            ?>
                                                        </div>
                                                        </ul>
                                                        </span>
                                                    </td> -->
                                                    <td>
                                                        <?php echo ucwords($data['task_name']); ?>
                                                    </td>
                                                        <?php
                                                            $staff_name="select name from site_setting where 1 and admin_id='".$data['assign_by']."'";
                                                            $ptr_data_staff=mysql_query($staff_name);
                                                            $fetch_staff_name=mysql_fetch_array($ptr_data_staff); 
                                                            $staff_name1="select name from site_setting where 1 and admin_id='".$data['staff_id']."'";
                                                            $ptr_data_staff1=mysql_query($staff_name1);
                                                            $fetch_staff_name1=mysql_fetch_array($ptr_data_staff1);
                                                        ?>
                                                    <td>
                                                        <?php echo ucfirst($fetch_staff_name['name']);?>
                                                    </td>
                                                    <td>
                                                        <?php echo ucfirst($fetch_staff_name1['name']);?>
                                                    </td>
                                                    <td>
                                                        <?php echo ucfirst($data['priority']);?>
                                                        <input type="hidden" value="<?php echo $data['priority']; ?>" id="priority" />
                                                    </td>
                                                    <td>
                                                        <span style="color:blue;">
                                                            <?php 
                                                            if($data['due_date']!='')
                                                            {
                                                                $date1=date("d-m-Y");
                                                                $due_Date = date("d-m-Y", strtotime($data['due_date']));
                                                                if($due_Date < $date1 )
                                                                {
                                                                    ?>
                                                                    <span style="color:red;">
                                                                        <?php  echo $due_Date;?>
                                                                    </span>
                                                                    <?php
                                                                }
                                                                else
                                                                {
                                                                    ?>
                                                                    <span style="color:blue;">
                                                                        <?php  echo $due_Date;?>
                                                                    </span>
                                                                    <?php
                                                                }
                                                            }
                                                            ?>
                                                        </span>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <!-- <th style="text-align:center">Add New Memeber</th> -->
                                                    <th style="text-align:center">Task Category </th>
                                                    <th style="text-align:center" colspan="2">Task Time</th>
                                                    <th style="text-align:center">Task point </th>
                                                    <th style="text-align:center">Task Repeate</th>
                                                    <?php
                                                    if($data['assign_type']=='meeting' || $data['assign_type']=='staff_discussion' )
                                                    {
                                                        ?>
                                                        <th style="text-align:center">
                                                            <?php echo ucwords($data['assign_type'] )?> Staff </strong>
                                                        </th>
                                                        <?php
                                                    }
                                                    ?>
                                                </tr>
                                                <?php
                                                    $repeat="select repetation_type from tk_task_repetation_type where type_id='".$data['repetation_id']."' ";
                                                    $ptr_repeat=mysql_query($repeat);
                                                    $data_repeat=mysql_fetch_array($ptr_repeat);
                                                    $hour=$data['hours'];
                                                    $time1= convertToHoursMins($hour, '%02d hour %02d min');
                                                ?>
                                                <tr>
                                                    <td>
                                                        <?php echo ucfirst($data['assign_type']); ?>
                                                    </td>
                                                    <td colspan="2">
                                                        <?php echo $time1; ?>
                                                    </td>
                                                    <td>
                                                        <?php  echo ucwords($data['points']); ?>
                                                    </td>
                                                    <td>
                                                        <?php
                                                            if($data['repetation_id']==0){
                                                                echo 'Repeated';
                                                            }
                                                            else{
                                                            echo ucwords($data_repeat['repetation_type']);
                                                            }
                                                        ?>
                                                    </td>
                                                    <?php
                                                    if($data['assign_type']=='meeting' || $data['assign_type']=='staff_discussion' )
                                                    {
                                                        ?>
                                                        <td>
                                                            <?php
                                                                $sel_cnt="select count(staff_id) as tot_staff from tk_individual_task where ref_id='".$data['ref_id']."'";
                                                                $ptr_cnt=mysql_query($sel_cnt);
                                                                $data_cnt=mysql_fetch_array($ptr_cnt);
                                                                ?>
                                                            <button type="button" class="btn btn-default"
                                                                data-toggle="modal"
                                                                data-target="#<?php echo $data['ref_id']?>"
                                                                style="width:50px;">
                                                                <?php echo $data_cnt['tot_staff'];?>
                                                            </button>
                                                            <div class="modal fade" id="<?php echo $data['ref_id'];?>">
                                                                <div class="modal-dialog" style="width:300px;">
                                                                    <div class="modal-content">
                                                                        <div class="modal-header">
                                                                            <h4 class="modal-title">
                                                                                <span style="color:blue">
                                                                                    <?php echo ucwords($data['task_name']) ?>
                                                                                </span>- Collabraters
                                                                                <p>[
                                                                                    <?php echo ucwords($data['assign_type']) ?>]
                                                                                </p>
                                                                            </h4>
                                                                        </div>
                                                                        <div class="modal-body">
                                                                            <!-- body code -->
                                                                            <div class="box box-default">
                                                                                <div class="direct-chat-messages"
                                                                                    style="background-color::gray;">
                                                                                    <?php
                                                                                        $sel_id="select staff_id from tk_individual_task where ref_id='".$data['ref_id']."'";
                                                                                        $ptr_id=mysql_query($sel_id);
                                                                                        $i=1;
                                                                                        while($data_id=mysql_fetch_array($ptr_id))
                                                                                        {
                                                                                            $sel_name="select name from site_setting where 1 and admin_id='".$data_id['staff_id']."'";
                                                                                            $ptr_name=mysql_query($sel_name);
                                                                                            $data_name=mysql_fetch_array($ptr_name);
                                                                                            ?>
                                                                                            <p style="text-align:left;">
                                                                                                <?php echo ucfirst($i++.' . '.$data_name['name']);?>
                                                                                            </p>
                                                                                            <?php
                                                                                        }
                                                                                    ?>
                                                                                </div>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </td>
                                                        <?php
                                                    }
                                                    ?>
                                                </tr>
                                                <tr>
                                                    <th style="text-align:center">Valid By </th>
                                                    <th style="text-align:center" colspan="2">Todays Work Assign Hours
                                                    </th>
                                                    <?php
                                                    if($_SESSION['type']=='S' || $edit_access=='yes'&& $data['status']!='complete'  )
                                                    {
                                                    ?>
                                                    <th style="text-align:center">Re-Assign To </th>
                                                    <?php
                                                    }
                                                    ?>
                                                </tr>
                                                <tr>
                                                    <td style="text-align:center">
                                                        <?php
                                                            $sel_valid_name="select name from site_setting where admin_id='".$data['validation_admin']."'";
                                                            $pt_name=mysql_query($sel_valid_name);
                                                            $data_validation=mysql_fetch_array($pt_name);
                                                            echo  Ucwords($data_validation['name']);
                                                        ?>
                                                    </td>
                                                    <td style="text-align:center" colspan="2">
                                                        <?php
                                                            $task_hours="select sum(hours)as task_hour from tk_individual_task where 1 and Validation='valid' and staff_id='".$data['staff_id']."'and DATE(date)='".date("Y-m-d")."' order by added_date DESC";
                                                            $ptr_task_hours=mysql_query($task_hours);
                                                            $data_hour=mysql_fetch_array($ptr_task_hours);
                                                            $task_time=$data_hour['task_hour'];
                                                            // f($_SESSION['type']=='F'){
                                                            $sel_student_batch="select distinct(c_b_id) from batch_timetable where staff_id='".$data['staff_id']."' and date='".date("Y-m-d")."'";
                                                            $ptr_student_batch=mysql_query($sel_student_batch);
                                                            $tot_batch_id=mysql_num_rows($ptr_student_batch);
                                                            $batch_time= $tot_batch_id*2.5;
                                                            $hour=  $batch_time*60 ;
                                                            $tot_time= $task_time+ $hour;
                                                            $tot_hours= convertToHoursMins($tot_time, '%02d hour %02d min');
                                                            echo  $tot_hours;
                                                        ?>
                                                    </td>
                                                    <?php
                                                    if($_SESSION['type']=='S' || $edit_access=='yes' && $data['status']!='complete' )
                                                    {
                                                    ?>
                                                    <td style="text-align:center">
                                                        <select class="form-control select2" style="width:150px"
                                                            id="staff_names" name="staff_names">
                                                            <option value="">Assinged To</option>
                                                            <?php
                                                                $categary="select admin_id,name from site_setting where 1 and system_status='Enabled'
                                                                order by name ASC"; 
                                                                $c_query=mysql_query($categary);
                                                                while($data_c=mysql_fetch_array($c_query))
                                                                {
                                                                echo  '<option value="'.$data_c['admin_id'].'">'.ucfirst($data_c['name']). '</option>';
                                                                }
                                                            ?>
                                                        </select>
                                                    </td>
                                                    <?php
                                                    }
                                                    ?>
                                                </tr>
                                            </tbody>
                                        </table>
                                        <?php
                                        if($data['status']!='complete')
                                        {
                                            // if($_SESSION['type']=='S' || $edit_access=='yes' && $_SESSION['admin_id']!=$data['staff_id'] )
                                            if($_SESSION['type']=='S' ||  $edit_access=='yes' || $data_manager['staff_id']==$_SESSION['admin_id'] && $_SESSION['admin_id']!=$data['staff_id'] )
                                            {
                                                ?>
                                                <p><strong>Validation :</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                    <span>
                                                        <label>Valid
                                                            <input type="radio" name="validation" value="valid"
                                                                onchange="validations(this.value)" <?php
                                                                if($_POST['validation']=="valid" ) echo 'checked="checked"' ;
                                                                else if($data['Validation']=="valid" ) echo 'checked="checked"'
                                                                ; ?> >
                                                        </label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                        <label>In-Valid
                                                            <input type="radio" name="validation" value="in_valid"
                                                                onchange="validations(this.value)" <?php
                                                                if($_POST['validation']=="in_valid" ) echo 'checked="checked"' ;
                                                                else if($data['Validation']=="in_valid" )
                                                                echo 'checked="checked"' ; ?> >
                                                        </label>
                                                        <input type="hidden" name="task_id1" id="task_ids1"
                                                            value="<?php echo $record_id;?>">
                                                            <input type="hidden" name="admin" id="admin_ids"
                                                            value="<?php echo $_SESSION['admin_id'];?>">
                                                    </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                    <span>
                                                        <?php if($data['Validation']=="in_valid") {?>
                                                    <button type="button" class="btn btn-warning" data-toggle="modal"
                                                            data-target="#reason_invalid">
                                                            Invalid Reason
                                                    </button>
                                                    <?php }
                                                    if(isset($_REQUEST['submit_reason']))
                                                    {
                                                         $task_ids=$record_id;
                                                        //  $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."',`validation_admin`='".$_SESSION['admin_id']."' where staff_task_id='".$task_ids."'";
                                                        //      $ptr_ins_t=mysql_query($update_status);
                                                        //  }
                                                    }
                                                    ?>
                                                        <div class="modal fade" id="reason_invalid">
                                                            <div class="modal-dialog" style="width:300px;">
                                                                <div class="modal-content">
                                                                    <div class="modal-header">
                                                                        <h4 class="modal-title">
                                                                            <span style="color:blue">
                                                                                Add Task Invalid Reasons
                                                                            </span>
                                                                        </h4>
                                                                    </div>
                                                                    <div class="modal-body">
                                                                        <!-- body code -->
                                                                        <div class="box box-warning">
                                                                            <div class="form-group">
                                                                                <textarea type="" class="form-control" name="reason" id="reason" value=""
                                                                                         placeholder="Add Reason"></textarea>
                                                                            </div>
                                                                            <div class="form-group">
                                                                                <div class="">
                                                                                    <input type="submit" name="submit_reason" value="Submit" class="btn btn-block btn-success">
                                                                                </div>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </span>
                                                </p>
                                                <?php 
                                            }
                                        }
                                        ?>
                                        <p><strong>Description :</strong></p>
                                        <p class="text-muted well well-sm no-shadow" style="margin-top: 10px;">
                                            <?php echo strip_tags(ucwords($data['description'])); ?>
                                        </p>
                                    </div>
                                    <div class="col-xs-6 ">
                                        <div>
                                           <strong> Task Added Date : </strong><span style="color:blue"><?php echo  date("d-m-Y",strtotime($data['added_date']))?></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php if($data['staff_complete_date']!='') {?><strong> Staff Complete Date : </strong><span><?php echo  date("d-m-Y",strtotime($data['staff_complete_date'])) ?></span> <?php } ?>
                                           <input type="hidden" name="added_date" id="added_date"
                                                            value="<?php echo date("d/m/Y",strtotime($data['added_date'])) ;?>">
                                        </div><br>
                                        <?php
                                            $sel_task_status="select status,sta_updated_admin_id,sta_complete_date,rating,staff_status from tk_individual_task where staff_task_id='".$data['staff_task_id']."'";
                                            $ptr_data_sta=mysql_query($sel_task_status);
                                            $fetch_details_status=mysql_fetch_array($ptr_data_sta);
                                            $staff_name_status="select name from site_setting where 1 and admin_id='".$fetch_details_status['sta_updated_admin_id']."'";
                                            $ptr_data_staff_status=mysql_query($staff_name_status);
                                            $fetch_staff_name_status=mysql_fetch_array($ptr_data_staff_status);
                                        ?>
                                        <div class="form-group">
                                            <?php
                                            if($data['staff_id']==$_SESSION['admin_id'] && $data['status']!='complete')
                                            { 
                                                // && $data['assign_type']=='staff_assign' || $data['assign_type']=='self' 
                                                ?>
                                                <div class="form-group">
                                                    <label>My Task Status : </label>
                                                    <label class="radio-inline">
                                                        <input type="radio" name="staff_status" id="staff_status1" <?php
                                                            if($fetch_details_status['staff_status']=='complete' )
                                                            echo 'checked="checked"' ; ?>
                                                        value="complete" >Complete</label>
                                                    <label class="radio-inline">
                                                        <input type="radio" name="staff_status" id="staff_status" <?php
                                                            if($fetch_details_status['staff_status']=='in_progress' )
                                                            echo 'checked="checked"' ; ?>
                                                        value="in_progress" >In_Progress</label>
                                                </div>
                                                <?php
                                            }
                                            ?>
                                        </div>
                                        <?php
                                        if($_SESSION['type']=='S'  || $edit_access=='yes' || $data_manager['staff_id']==$_SESSION['admin_id'] && $_SESSION['admin_id']!=$data['staff_id']  || $data['task_type']=='system' )
                                        {
                                            ?>
                                            <div class="form-group">
                                                <label>Status : </label>
                                                <?php
                                                if($data['status']!='complete'  && $data['Validation']== "valid")
                                                {
                                                    ?>
                                                    <div>
                                                        <label class="radio-inline">
                                                        <input type="radio" name="optradio" id="" <?php
                                                            if($fetch_details_status['status']=='complete' )
                                                            echo 'checked="checked"' ; ?>
                                                        value="complete" onChange="show_rating(this.value)"
                                                        >Complete</label>
                                                        <label class="radio-inline">
                                                        <input type="radio" name="optradio" id="" <?php
                                                            if($fetch_details_status['status']=='in_progress' )
                                                            echo 'checked="checked"' ; ?>
                                                        value="in_progress"
                                                        onChange="show_rating(this.value),hold_status(this.value)">In_Progress</label>
                                                        <label class="radio-inline"><input type="radio" name="optradio" id=""
                                                            <?php if($fetch_details_status['status']=='in_complete' )
                                                            echo 'checked="checked"' ; ?>
                                                        value="in_complete"
                                                        onChange="show_rating(this.value),hold_status(this.value)">In-Complete</label>
                                                        <label class="radio-inline"><input type="radio" name="optradio"
                                                            id="task_hold_staus" <?php
                                                            if($fetch_details_status['status']=='halt' )
                                                            echo 'checked="checked"' ; ?>
                                                        value="halt"
                                                        onChange="show_rating(this.value),hold_status(this.value)">Halt</label>
                                                        <label class="radio-inline"><input type="radio" name="optradio" id=""
                                                            <?php if($fetch_details_status['status']=='cancel' )
                                                            echo 'checked="checked"' ; ?>
                                                        value="cancel"
                                                        onChange="show_rating(this.value),hold_status(this.value)">Cancel</label>
                                                    </div>
                                                    <?php
                                                }
                                                else
                                                {
                                                    ?>
                                                    <!-- <span><?php //echo ucfirst($fetch_staff_name_status['name'])?> marked as </span>&nbsp; -->
                                                    <span>
                                                        <?php  echo ucfirst($fetch_details_status['status']);?>
                                                    </span>
                                                    <?php
                                                    $due_Date=$data['due_date'];
                                                    $complete_Date=$fetch_details_status['sta_complete_date'];
                                                    $due_Date12 =date("Y-m-d",strtotime($due_Date));
                                                    $complete_Date12 =date("Y-m-d",strtotime( $complete_Date));
                                                    //  $due_Date = date("d-m-Y", strtotime($data['due_date']));
                                                    //  $complete_Date = date("d-m-Y", strtotime( $fetch_details_status['sta_complete_date']));
                                                    if($complete_Date12 > $due_Date12)
                                                    {
                                                        ?>
                                                        <span class="label label-danger" style="margin-left:20px;">
                                                        <?php
                                                        echo 'Over Due';
                                                    }
                                                    ?>
                                                        </span>
                                                    <?php
                                                } 
                                                ?>
                                            </div>
                                            <div class="form-group" id="rate" <?php
                                                if($fetch_details_status['status']=='complete')
                                                echo 'style="display:block"' ;else echo 'style="display:none"' ;?>>
                                                <label>Rating : </label>
                                                <?php
                                                if($data['status']!='complete' )
                                                {
                                                    ?>
                                                    <div>
                                                        <p class="text-muted well well-sm no-shadow" style="margin-top: 10px;">
                                                            <?php
                                                            if($data['deadline_count']==1)
                                                            {
                                                                $rate="select * from tk_quality_work_point";
                                                                $ptr_rate=mysql_query($rate);
                                                                while($data_rate=mysql_fetch_array($ptr_rate))
                                                                {
                                                                    $sel='';
                                                                    if($data_rate['rating']=='good')
                                                                    {
                                                                        $sel='checked="checked"';
                                                                    }
                                                                    ?>
                                                                    <label class="radio-inline">
                                                                        <input type="radio" name="rating" id="" <?php echo $sel; ?>
                                                                        <?php
                                                                        if($fetch_details_status['rating']=='excellent' ) echo 'checked="checked"';
                                                                        ?>
                                                                        value="
                                                                        <?php echo $data_rate['rating'] ; ?>">
                                                                        <?php echo ucfirst($data_rate['rating']); ?>
                                                                    </label>
                                                                    <?php
                                                                }
                                                            }
                                                            else
                                                            {
                                                                $rate1="select * from tk_quality_work_point where rating !='excellent'";
                                                                $ptr_rate1=mysql_query($rate1);
                                                                while($data_rate1=mysql_fetch_array($ptr_rate1))
                                                                {
                                                                    $sel='';
                                                                    if($data_rate1['rating']=='good')
                                                                    {
                                                                        $sel='checked="checked"';
                                                                    }
                                                                    ?>
                                                                            <label class="radio-inline">
                                                                                <input type="radio" name="rating" id="" <?php echo $sel; ?>
                                                                                <?php
                                                                            if($fetch_details_status['rating']=='excellent' ) echo 'checked="checked"' ;
                                                                            ?>
                                                                                value="
                                                                                <?php echo $data_rate1['rating'] ; ?>">
                                                                                <?php echo ucfirst($data_rate1['rating']); ?>
                                                                            </label>
                                                                            <?php
                                                                }
                                                            }
                                                            ?>
                                                        </p>
                                                        <!-- <div class="form-group">
                                                            <label>Task Complete Date: </label>
                                                            <div class="input-group date">
                                                                <div class="input-group-addon">
                                                                    <i class="fa fa-calendar"></i>
                                                                </div>
                                                                <input type="text" class="form-control pull-left" name="complt_date" id="datepicker1" style="width:150px" value="" placeholder="Complete Date">
                                                            </div>
                                                        </div> -->
                                                    </div>
                                                    <?php
                                                    // if($data['staff_complete_date']==''){
                                                    ?>
                                                    <label>
                                                    Task Complete Date : 
                                                </label>
                                                <div class="input-group date">  
                                                    <div class="input-group-addon">
                                                        <i class="fa fa-calendar"></i>
                                                    </div>
                                                    <input type="text" class="form-control pull-left" onChange="complete_date(this.value)"  readonly="readonly" name="compl_date" id="datepicker1" style="width:150px" value="<?php echo date("d/m/Y")?>"
                                                                placeholder="Task Complete Date">
                                                </div>
                                                    <?php
                                                // }
                                                // else{
                                                    ?>
                                                     <!-- <label>
                                                    Staff Complete Date : 
                                                </label>
                                                <span><?php echo  date("d-m-Y",strtotime($data['staff_complete_date'])) ?></span> -->
                                                    <?php
                                                // }
                                                }
                                                else
                                                {
                                                    ?>
                                                        <span style="color:blue">
                                                            <strong><?php echo ucfirst($fetch_details_status['rating']); ?></strong>
                                                        </span>
                                                    <?php
                                                }
                                                ?>
                                                
                                            </div>
                                            <div id="hold_sta" style="display:block">
                                            </div>
                                            <?php
                                            if($data['status']!='complete' )
                                            {
                                                ?>
                                                    <div class="form-group" id="due">
                                                        <label>Change Dead Line : </label>
                                                        <div class="input-group date">
                                                            <div class="input-group-addon">
                                                                <i class="fa fa-calendar"></i>
                                                            </div>
                                                            <input type="text" class="form-control pull-left" name="due_date"
                                                                id="datepicker" style="width:210px" value=""
                                                                placeholder="Update Due Date">
                                                        </div>
                                                    </div>
                                                <?php
                                            } 
                                        } 
                                        ?>
                                    </div>
                                </div>
                                <hr><hr>
                                <div class="row">
                                    <div class="col-xs-6">
                                        <i class="fa  fa-comments-o"></i>
                                        <?php
                                        $sel_task_Details="select comment,admin_id,detail_id,type,added_date from individual_task_details where staff_task_id='".$data['staff_task_id']."' order by detail_id ASC";
                                        $ptr_data_d=mysql_query($sel_task_Details);     
                                        $records=mysql_num_rows($ptr_data_d);
                                        if($records >= 2)
                                        {
                                            ?>
                                            <div class="direct-chat-messages" style="text-align:left">
                                                <?php                                           
                                                while( $fetch_details_data=mysql_fetch_array($ptr_data_d))
                                                {
                                                    $staff_name_com="select name,photo from site_setting where 1 and admin_id='".$fetch_details_data['admin_id']."'";
                                                    $ptr_staff_com=mysql_query($staff_name_com);
                                                    $fetch_staff_com=mysql_fetch_array($ptr_staff_com);
                                                    if($fetch_details_data['comment']!='')
                                                    {
                                                        $add_date=date("d-m-Y : H:i",strtotime($fetch_details_data['added_date']));
                                                        ?>
                                                        <div>
                                                            <span><img
                                                                    src="../faculty_login/staff_photo/<?php echo $fetch_staff_com['photo'];?>"
                                                                    width="20px" ; height="20px" ;></span>
                                                            <strong>
                                                                <?php echo ucfirst($fetch_staff_com['name']);?>
                                                            </strong>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">
                                                                <?php echo $add_date ;?>
                                                            </span>
                                                        </div>
                                                        <div style="margin-left:50px;">
                                                            <?php
                                                                // if($fetch_details_data['admin_id']==$_SESSION['admin_id'] || $_SESSION['type']=="S"){
                                                                // if($fetch_details_data['type']=='comment'){
                                                                ?>
                                                                    <!-- <a href="tk_individual_task_detail.php?deleteComment=1&ids=<?php //echo $fetch_details_data['detail_id'];?>&id=<?php //echo $data['staff_task_id'];?>" value="delete" style="color:red">
                                                                    <i class="fa fa-times-circle"></i> -->
                                                                    <?php
                                                                    // }  } ?>
                                                                    </a>
                                                                <li><em>
                                                                    <?php echo strip_tags(ucwords($fetch_details_data['comment']));?>
                                                                </em></li>
                                                        </div><br>
                                                        <?php
                                                    }
                                                } 
                                                ?>
                                            </div>
                                            <?php
                                        }
                                        ?>
                                    </div>
                                    <div class="col-xs-6">
                                        <div>
                                            <?php 
                                                // $sel_task_Due="select due_date_change,dd_change_admin_id from individual_task_details where staff_task_id='".$data['staff_task_id']."'";
                                                // $ptr_date=mysql_query($sel_task_Due);                                                   
                                                // $fetch_details=mysql_fetch_array($ptr_date);
                                                $staff_due_date="select name from site_setting where 1 and admin_id='".$data['dd_change_admin_id']."'";
                                                $ptr_data_duedate=mysql_query($staff_due_date);
                                                $fetch_name=mysql_fetch_array($ptr_data_duedate);      
                                                if($data['due_date_change']!='')
                                                {
                                                    ?>
                                                    <span><b>
                                                        <?php $due_Date_up = date("d-m-Y", strtotime($data['due_date_change']));
                                                        echo $fetch_name['name'];?>
                                                    </b></span>
                                                    <span> Changed Dead Line As: </span><span style="color:Blue;"><b>
                                                        <?php echo $due_Date_up;?>
                                                    </b></span>
                                                    <?php
                                                }  
                                                ?>
                                            </div>
                                            <br>
                                        <div>
                                            <?php
                                            if( $fetch_details_status['status']!='' && $fetch_details_status['status']!='in_progress')
                                            {
                                                ?>
                                                <span><b>
                                                    <?php 
                                                        echo ucfirst($fetch_staff_name_status['name']);?>
                                                </b></span>
                                                <span> Marked Task Status As </span>
                                                <!-- <span ><?php
                                                    // echo ucfirst($fetch_details_status['status']);?>
                                                </span> -->
                                                <?php if($fetch_details_status['status']=='complete') 
                                                { 
                                                    ?>
                                                    <span class="label label-success">
                                                        <?php echo ucfirst($fetch_details_status['status']);?>
                                                    </span>
                                                    <?php
                                                } 
                                                if($fetch_details_status['status']=='in_progress') 
                                                { 
                                                    ?>
                                                    <span class="label label-warning">
                                                        <?php echo ucfirst($fetch_details_status['status']);?>
                                                    </span>
                                                    <?php
                                                } 
                                                if($fetch_details_status['status']=='in_complete') 
                                                { 
                                                    ?>
                                                    <span class="label label-danger">
                                                        <?php echo ucfirst($fetch_details_status['status']);?>
                                                    </span>
                                                    <?php
                                                } 
                                                if($fetch_details_status['status']=='cancel') 
                                                { 
                                                    ?>
                                                    <span class="label label-default">
                                                        <?php echo ucfirst($fetch_details_status['status']);?>
                                                    </span>
                                                    <?php
                                                }
                                                if($fetch_details_status['status']=='halt') 
                                                { 
                                                    ?>
                                                    <span class="label label-primary">
                                                        <?php echo ucfirst($fetch_details_status['status']);?>
                                                    </span>
                                                    <?php
                                                }
                                                ?>
                                                <div> Rating :<span style="color:blue"> <strong>
                                                        <?php echo ucfirst($fetch_details_status['rating']); ?>
                                                    </strong></span>
                                                </div>
                                                <?php
                                            }  
                                            ?>
                                        </div><br>
                                    </div>
                                </div>
                                <br><br>
                                <div class="col-xs-12">
                                    <?php
                                    if($data['status']!='complete')
                                    {
                                        ?>
                                        <div class="form-group">
                                            <textarea class="form-control" name="comment" rows="3" <?php echo
                                                $comment_Err ;?>
                                            placeholder="Ask Quetions or Post Update..."></textarea>
                                        </div>
                                        <div class="form-group">
                                            <!-- <div class=""> -->
                                                <input type="submit" name="submit" value="Save Change"
                                                    class="btn btn-block btn-success">
                                            <!-- </div> -->
                                        </div>
                                        <?php
                                    }
                                    ?>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </section>
        </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 -->
    <link rel="stylesheet" href="bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css">
    <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>

    <!-- Page script -->
    <script>
        function delete_staff(staff_id, tm_id) {
            var staff_data = "action=delete_staff&staff_id=" + staff_id + "&tm_id=" + tm_id;
            // alert(staff_data);
            $.ajax({
                url: "ajax_task.php", type: "post", data: staff_data, cache: false,
                success: function (staffData) {
                    alert(staffData);
                    document.getElementById("st_id" + staff_id).innerHTML = '';
                }
            });
        }
    </script>
    <script>
        $(function () {
            //Initialize Select2 Elements
            $('.select2').select2()


            //Date picker
            $('#datepicker').datepicker({
                autoclose: true,
                format: 'dd/mm/yyyy',
                startDate: '-0d',
                Default: true,
                todayHighlight: true
            })
            $('#datepicker1').datepicker({
                autoclose: true,
                format: 'dd/mm/yyyy',
                startDate: '-1d',
                endDate: '+0d',
                Default: true,
                todayHighlight: true
            })
            //  $('#datepicker2').datepicker({
            //     autoclose: true,
            //     format: 'dd/mm/yyyy',
            //     Default: true,
            //     todayHighlight: true
            // })
            $('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'
            })
            $('input[type="checkbox"].flat-red, input[type="radio"].flat-red').iCheck({
                checkboxClass: 'icheckbox_flat-green',
                radioClass: 'iradio_flat-yellow'
            })

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

            //Timepicker
            $('.timepicker').timepicker({
                showInputs: false
            })
        })
    </script>
</body>

</html>