<?php include 'inc_classes.php'; 

include "admin_authentication.php";
include "include/headHeader.php";
?>

<?php

$edit_access='';

$sel_acc="select * from edit_previleges where admin_id='".$_SESSION['admin_id']."' and privilege_id='392'";

$ptr_access=mysql_query($sel_acc);

if(mysql_num_rows($ptr_access))

{

	$edit_access='yes';

}

?>

<!DOCTYPE html>

<html>

<head>

    <meta charset="utf-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <title> Ticket Dashboard</title>

    <!-- Tell the browser to be responsive to screen width -->

    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">

    <!-- Bootstrap 3.3.7 -->

    <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">

    <!-- Font Awesome -->

    <link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css">

    <!-- Ionicons -->

    <link rel="stylesheet" href="bower_components/Ionicons/css/ionicons.min.css">

    <!-- daterange picker -->

    <link rel="stylesheet" href="bower_components/bootstrap-daterangepicker/daterangepicker.css">

    <!-- bootstrap datepicker -->

    <link rel="stylesheet" href="bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css">

    <!-- Morris chart -->

    <link rel="stylesheet" href="bower_components/morris.js/morris.css">

    <!-- Morris charts -->

    <link rel="stylesheet" href="../../bower_components/morris.js/morris.css">

    <link rel="stylesheet" href="bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css">

    <!-- iCheck for checkboxes and radio inputs -->

    <link rel="stylesheet" href="plugins/iCheck/all.css">

    <!-- Bootstrap Color Picker -->

    <link rel="stylesheet" href="bower_components/bootstrap-colorpicker/dist/css/bootstrap-colorpicker.min.css">

    <!-- Bootstrap time Picker -->

    <link rel="stylesheet" href="plugins/timepicker/bootstrap-timepicker.min.css">

    <!-- Select2 -->

    <link rel="stylesheet" href="bower_components/select2/dist/css/select2.min.css">

    <!-- Theme style -->

    <link rel="stylesheet" href="dist/css/AdminLTE.min.css">

    <!-- AdminLTE Skins. Choose a skin from the css/skins

       folder instead of downloading all of them to reduce the load. -->

    <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->

    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->

    <!--[if lt IE 9]>

  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>

  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>

  <![endif]-->

    <!-- Google Font -->

    <link rel="stylesheet"

        href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">

    <style>

        span {

            margin-left: 20%;

            text-align: center;

        }



        .form-control {

            margin-left: 20px;

        }

    </style>

<script>

    // function tab_id(values)

	// {

    //     alert(tab);

	// 	var tab= document.getElementById("assign").value;

    //     <?php

    // //   echo  $tab=$_GET['assign'];

    //     ?>

    //     alert(tab);

    // }

    </script>

</head>

<?php

 function convertToHoursMins($time, $format = '%02d:%02d') {

    if ($time < 1) {

        return;

    }

    $hours = floor($time / 60);

    $minutes = ($time % 60);

    return sprintf($format, $hours, $minutes);

}

?>

<body class="hold-transition skin-blue sidebar-mini">

    <div class="wrapper">

        <?php include "include/header-main.php"; ?>

        <!-- Left side column. contains the logo and sidebar -->

        <?php include "include/menu_left.php"; ?>

        <!-- Content Wrapper. Contains page content -->

        <!-- Left side column. contains the logo and sidebar -->

        <!-- Content Wrapper. Contains page content -->

        <div class="content-wrapper">

            <!-- Content Header (Page header) -->

            <section class="content-header">
                <div class="row">
                </div>
                <!-- <ol class="breadcrumb">
                    <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
                    <li class="active">Dashboard</li>
                </ol> -->
            </section>
            <!-- main body code start -->

            <section class="content">
                <div class="row">
                    <div class="col-md-12">
                        <!-- Custom Tabs -->
                        <div class="nav-tabs-custom">
                            <ul class="nav nav-tabs">
                                <li class="dropdown active">
                                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">  List  <span class="caret"></span></a>
                                    <ul class="dropdown-menu">
                                    <li class="active"><a href="#tab_1" data-toggle="tab">My Tickets</a></li>
                                    <li><a href="#tab_2" data-toggle="tab">Cancled Tickets</a></li>
                                    <li><a href="#tab_3" data-toggle="tab"> Halt Tickets</a></li>
                                    <li><a href="#tab_5" data-toggle="tab"> Me Solved Ticket</a></li>
                                    <li><a href="#tab_6" data-toggle="tab"> Me assign Solved Tickets</a></li>
                                    </ul>
                                </li>
                                <!-- <li class="active"><a href="#tab_4" data-toggle="tab">My Tickets</a></li> -->
                                <li><a href="#tab_4" data-toggle="tab">Me Assign Ticket</a></li>								
                            </ul>
                            <div class="tab-content">
                <!-- ==================================My Ticket============================================ --> 
                        <div class="tab-pane active" id="tab_1">
                            <div class="box-header with-border">
                                <h3 class="box-title"><strong> My Tickets </strong></h3>
                                <div class="box-body">
                                    <div class="table-responsive">
                                        <table class="table no-margin">
                                            <thead>
                                                <tr>
                                                    <th>Sr No </th>
                                                    <th>Ticket ID</th>
                                                    <th>Subject</th>
                                                    <th>Status</th>
                                                    <th>Generation</th>
                                                    <th>Priority</th>
                                                    <th>Assign By</th>
                                                    <th>Details</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <?php
                                                $sel_in="select * from ts_incidence where 1 and assign_to='".$_SESSION['admin_id']."' and status='in_progress' order by added_date desc";
                                                $ptr_in=mysql_query($sel_in);
                                                $i=1;
                                                while($data_in=mysql_fetch_array($ptr_in))
                                                {
                                                    ?>
                                                    <tr>
                                                        <td>
                                                            <?php
                                                            echo $i++;
                                                            ?>
                                                        </td>
                                                        <td>
                                                            <?php
                                                                echo $data_in['inc_id'];
                                                            ?>
                                                        </td>
                                                        <td>
                                                        <?php
                                                            echo ucwords($data_in['subject']);
                                                            ?>
                                                        </td>
                                                        <td>
                                                            <?php
                                                            //  echo ucfirst($data_in['status']);
                                                                ?>
                                                            <?php if($data_in['status']=='solved') 
                                                                { 
                                                                    ?>
                                                                    <p class="label label-success"> <?php echo ucfirst($data_in['status']);?></p>
                                                                    <?php
                                                                } 
                                                                if($data_in['status']=='in_progress') 
                                                                { 
                                                                    ?>
                                                                    <p class="label label-warning"><?php echo ucfirst($data_in['status']);?></p>
                                                                    <?php
                                                                } 
                                                                if($data_in['status']=='cancel') 
                                                                { 
                                                                    ?>
                                                                    <p class="label label-danger"><?php echo ucfirst($data_in['status']);?></p>
                                                                    <?php
                                                                } 
                                                                if($data_in['status']=='halt') 
                                                                { 
                                                                    ?>
                                                                    <p class="label label-primary"><?php echo ucfirst($data_in['status']);?></p>
                                                                    <?php
                                                                } 
                                                                if($data_in['status']=='pending') 
                                                                { 
                                                                    ?>
                                                                    <p class="label label-danger"><?php echo ucfirst($data_in['status']);?></p>
                                                                    <?php
                                                                } 
                                                            ?>
                                                        </td>
                                                        <td>
                                                            <?php
                                                                echo ucwords($data_in['generation']);
                                                                ?>
                                                        </td>
                                                        <td>
                                                            <?php
                                                                echo ucwords($data_in['priority']);
                                                            ?>
                                                        </td>
                                                        <td>
                                                            <?php
                                                                $sel_staff="select name from site_setting where admin_id='".$data_in['admin_id']."'";
                                                                $ptr_staff=mysql_query($sel_staff);
                                                                $data_staff=mysql_fetch_array($ptr_staff);
                                                                echo ucwords($data_staff['name']);
                                                            ?>
                                                        </td>
                                                        <td>
                                                        <strong><a href="ts_ticket_detail.php?id=<?= $data_in['inc_id'] ?>"  value="">Details</a></strong>
                                                        </td>
                                                    </tr>
                                                    <?php
                                                }
                                                ?>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>

         <!-- ================================  Cancle Ticket ===================================== -->

                        <div class="tab-pane" id="tab_2">
                            <div class="box-header with-border">
                                <h3 class="box-title"><strong> My Cancel Tickets </strong></h3>
                                <div class="box-body">
                                    <div class="table-responsive">
                                        <table class="table no-margin">
                                            <thead>
                                                <tr>
                                                    <th>Sr No </th>
                                                    <th>Ticket ID</th>
                                                    <th>Subject</th>
                                                    <th>Status</th>
                                                    <th>Generation</th>
                                                    <th>Priority</th>
                                                    <th>Assign By</th>
                                                    <th>Details</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <?php
                                                $sel_in="select * from ts_incidence where 1 and admin_id='".$_SESSION['admin_id']."' and status='cancel' order by added_date desc";
                                                $ptr_in=mysql_query($sel_in);
                                                $i=1;
                                                while($data_in=mysql_fetch_array($ptr_in))
                                                {
                                                    ?>
                                                    <tr>
                                                        <td>
                                                            <?php
                                                            echo $i++;
                                                            ?>
                                                        </td>
                                                        <td>
                                                            <?php
                                                                echo $data_in['inc_id'];
                                                            ?>
                                                        </td>
                                                        <td>
                                                        <?php
                                                            echo ucwords($data_in['subject']);
                                                            ?>
                                                        </td>
                                                        <td>
                                                            <?php
                                                            //  echo ucfirst($data_in['status']);
                                                                ?>
                                                            <?php if($data_in['status']=='solved') 
                                                                { 
                                                                    ?>
                                                                    <p class="label label-success"> <?php echo ucfirst($data_in['status']);?></p>
                                                                    <?php
                                                                } 
                                                                if($data_in['status']=='in_progress') 
                                                                { 
                                                                    ?>
                                                                    <p class="label label-warning"><?php echo ucfirst($data_in['status']);?></p>
                                                                    <?php
                                                                } 
                                                                if($data_in['status']=='cancel') 
                                                                { 
                                                                    ?>
                                                                    <p class="label label-danger"><?php echo ucfirst($data_in['status']);?></p>
                                                                    <?php
                                                                } 
                                                                if($data_in['status']=='halt') 
                                                                { 
                                                                    ?>
                                                                    <p class="label label-primary"><?php echo ucfirst($data_in['status']);?></p>
                                                                    <?php
                                                                } 
                                                                if($data_in['status']=='pending') 
                                                                { 
                                                                    ?>
                                                                    <p class="label label-danger"><?php echo ucfirst($data_in['status']);?></p>
                                                                    <?php
                                                                } 
                                                            ?>
                                                        </td>
                                                        <td>
                                                            <?php
                                                                echo ucwords($data_in['generation']);
                                                                ?>
                                                        </td>
                                                        <td>
                                                            <?php
                                                                echo ucwords($data_in['priority']);
                                                            ?>
                                                        </td>
                                                        <td>
                                                            <?php
                                                                $sel_staff="select name from site_setting where admin_id='".$data_in['admin_id']."'";
                                                                $ptr_staff=mysql_query($sel_staff);
                                                                $data_staff=mysql_fetch_array($ptr_staff);
                                                                echo ucwords($data_staff['name']);
                                                            ?>
                                                        </td>
                                                        <td>
                                                        <strong><a href="ts_ticket_detail.php?id=<?= $data_in['inc_id'] ?>"  value="">Details</a></strong>
                                                        </td>
                                                    </tr>
                                                    <?php
                                                }
                                                ?>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>



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



                    <div class="tab-pane" id="tab_3">
                        <div class="box-header with-border">
                            <h3 class="box-title"><strong> Me Cancel Tickets </strong></h3>
                            <div class="box-body">
                                <div class="table-responsive">
                                    <table class="table no-margin">
                                        <thead>
                                            <tr>
                                                <th>Sr No </th>
                                                <th>Ticket ID</th>
                                                <th>Subject</th>
                                                <th>Status</th>
                                                <th>Generation</th>
                                                <th>Priority</th>
                                                <th>Assign By</th>
                                                <th>Details</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <?php
                                            $sel_in="select * from ts_incidence where 1 and admin_id='".$_SESSION['admin_id']."' and status='halt' order by added_date desc";
                                            $ptr_in=mysql_query($sel_in);
                                            $i=1;
                                            while($data_in=mysql_fetch_array($ptr_in))
                                            {
                                                ?>
                                                <tr>
                                                    <td>
                                                        <?php
                                                        echo $i++;
                                                        ?>
                                                    </td>
                                                    <td>
                                                        <?php
                                                            echo $data_in['inc_id'];
                                                        ?>
                                                    </td>
                                                    <td>
                                                    <?php
                                                        echo ucwords($data_in['subject']);
                                                        ?>
                                                    </td>
                                                    <td>
                                                        <?php
                                                        //  echo ucfirst($data_in['status']);
                                                            ?>
                                                        <?php if($data_in['status']=='solved') 
                                                            { 
                                                                ?>
                                                                <p class="label label-success"> <?php echo ucfirst($data_in['status']);?></p>
                                                                <?php
                                                            } 
                                                            if($data_in['status']=='in_progress') 
                                                            { 
                                                                ?>
                                                                <p class="label label-warning"><?php echo ucfirst($data_in['status']);?></p>
                                                                <?php
                                                            } 
                                                            if($data_in['status']=='cancel') 
                                                            { 
                                                                ?>
                                                                <p class="label label-danger"><?php echo ucfirst($data_in['status']);?></p>
                                                                <?php
                                                            } 
                                                            if($data_in['status']=='halt') 
                                                            { 
                                                                ?>
                                                                <p class="label label-primary"><?php echo ucfirst($data_in['status']);?></p>
                                                                <?php
                                                            } 
                                                            if($data_in['status']=='pending') 
                                                            { 
                                                                ?>
                                                                <p class="label label-danger"><?php echo ucfirst($data_in['status']);?></p>
                                                                <?php
                                                            } 
                                                        ?>
                                                    </td>
                                                    <td>
                                                        <?php
                                                            echo ucwords($data_in['generation']);
                                                            ?>
                                                    </td>
                                                    <td>
                                                        <?php
                                                            echo ucwords($data_in['priority']);
                                                        ?>
                                                    </td>
                                                    <td>
                                                        <?php
                                                            $sel_staff="select name from site_setting where admin_id='".$data_in['admin_id']."'";
                                                            $ptr_staff=mysql_query($sel_staff);
                                                            $data_staff=mysql_fetch_array($ptr_staff);
                                                            echo ucwords($data_staff['name']);
                                                        ?>
                                                    </td>
                                                    <td>
                                                    <strong><a href="ts_ticket_detail.php?id=<?= $data_in['inc_id'] ?>"  value="">Details</a></strong>
                                                    </td>
                                                </tr>
                                                <?php
                                            }
                                            ?>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>

                

        <!-- =================================Me Assign Tickets ====================================== -->
                    <div class="tab-pane" id="tab_4">
                        <div class="box-header with-border">
                            <h3 class="box-title"><strong> My Tickets </strong></h3>
                            <div class="box-body">
                                <div class="table-responsive">
                                    <table class="table no-margin">
                                        <thead>
                                            <tr>
                                                <th>Sr No </th>
                                                <th>Ticket ID</th>
                                                <th>Assign To</th>
                                                <th>Subject</th>
                                                <th>Status</th>
                                                <th>Generation</th>
                                                <th>Priority</th>
                                                <th>Details</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <?php
                                            $sel_in="select * from ts_incidence where 1 and admin_id='".$_SESSION['admin_id']."' and generation='primary' and status='in_progress'  order by added_date desc";
                                            $ptr_in=mysql_query($sel_in);
                                            $i=1;
                                            while($data_in=mysql_fetch_array($ptr_in))
                                            {
                                                ?>
                                                <tr>
                                                    <td>
                                                        <?php
                                                        echo $i++;
                                                        ?>
                                                    </td>
                                                    <td>
                                                        <?php
                                                            echo $data_in['inc_id'];
                                                        ?>
                                                    </td>
                                                    <td>
                                                        <?php
                                                            $sel_staff="select name from site_setting where admin_id='".$data_in['assign_to']."'";
                                                            $ptr_staff=mysql_query($sel_staff);
                                                            $data_staff=mysql_fetch_array($ptr_staff);
                                                            echo ucwords($data_staff['name']);
                                                        ?>
                                                    </td>
                                                    <td>
                                                    <?php
                                                        echo ucwords($data_in['subject']);
                                                        ?>
                                                    </td>
                                                    <td>
                                                        <?php
                                                        //  echo ucfirst($data_in['status']);
                                                            ?>
                                                        <?php if($data_in['status']=='solved') 
                                                            { 
                                                                ?>
                                                                <p class="label label-success"> <?php echo ucfirst($data_in['status']);?></p>
                                                                <?php
                                                            } 
                                                            if($data_in['status']=='in_progress') 
                                                            { 
                                                                ?>
                                                                <p class="label label-warning"><?php echo ucfirst($data_in['status']);?></p>
                                                                <?php
                                                            } 
                                                            if($data_in['status']=='cancel') 
                                                            { 
                                                                ?>
                                                                <p class="label label-danger"><?php echo ucfirst($data_in['status']);?></p>
                                                                <?php
                                                            } 
                                                            if($data_in['status']=='halt') 
                                                            { 
                                                                ?>
                                                                <p class="label label-primary"><?php echo ucfirst($data_in['status']);?></p>
                                                                <?php
                                                            } 
                                                            if($data_in['status']=='pending') 
                                                            { 
                                                                ?>
                                                                <p class="label label-danger"><?php echo ucfirst($data_in['status']);?></p>
                                                                <?php
                                                            } 
                                                        ?>
                                                    </td>
                                                    <td>
                                                        <?php
                                                            echo ucwords($data_in['generation']);
                                                            ?>
                                                    </td>
                                                    <td>
                                                        <?php
                                                            echo ucwords($data_in['priority']);
                                                        ?>
                                                    </td>
                                                    <td>
                                                    <strong><a href="ts_ticket_detail.php?id=<?= $data_in['inc_id'] ?>"  value="">Details</a></strong>
                                                    </td>
                                                </tr>
                                                <?php
                                            }
                                            ?>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>



         <!-- ========================================= Solved Ticket ============================================== -->



                    <div class="tab-pane" id="tab_5">
                        <div class="box-header with-border">
                            <h3 class="box-title"><strong> Me Solved Tickets </strong></h3>
                            <div class="box-body">
                                <div class="table-responsive">
                                    <table class="table no-margin">
                                        <thead>
                                            <tr>
                                                <th>Sr No </th>
                                                <th>Ticket ID</th>
                                                <th>Subject</th>
                                                <th>Status</th>
                                                <th>Generation</th>
                                                <th>Priority</th>
                                                <th>Assign By</th>
                                                <th>Details</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <?php
                                            $sel_in="select * from ts_incidence where 1 and assign_to='".$_SESSION['admin_id']."' and status='solved' order by added_date desc";
                                            $ptr_in=mysql_query($sel_in);
                                            $i=1;
                                            while($data_in=mysql_fetch_array($ptr_in))
                                            {
                                                ?>
                                                <tr>
                                                    <td>
                                                        <?php
                                                        echo $i++;
                                                        ?>
                                                    </td>
                                                    <td>
                                                        <?php
                                                            echo $data_in['inc_id'];
                                                        ?>
                                                    </td>
                                                    <td>
                                                    <?php
                                                        echo ucwords($data_in['subject']);
                                                        ?>
                                                    </td>
                                                    <td>
                                                        <?php
                                                        //  echo ucfirst($data_in['status']);
                                                            ?>
                                                        <?php if($data_in['status']=='solved') 
                                                            { 
                                                                ?>
                                                                <p class="label label-success"> <?php echo ucfirst($data_in['status']);?></p>
                                                                <?php
                                                            } 
                                                            if($data_in['status']=='in_progress') 
                                                            { 
                                                                ?>
                                                                <p class="label label-warning"><?php echo ucfirst($data_in['status']);?></p>
                                                                <?php
                                                            } 
                                                            if($data_in['status']=='cancel') 
                                                            { 
                                                                ?>
                                                                <p class="label label-danger"><?php echo ucfirst($data_in['status']);?></p>
                                                                <?php
                                                            } 
                                                            if($data_in['status']=='halt') 
                                                            { 
                                                                ?>
                                                                <p class="label label-primary"><?php echo ucfirst($data_in['status']);?></p>
                                                                <?php
                                                            } 
                                                            if($data_in['status']=='pending') 
                                                            { 
                                                                ?>
                                                                <p class="label label-danger"><?php echo ucfirst($data_in['status']);?></p>
                                                                <?php
                                                            } 
                                                        ?>
                                                    </td>
                                                    <td>
                                                        <?php
                                                            echo ucwords($data_in['generation']);
                                                            ?>
                                                    </td>
                                                    <td>
                                                        <?php
                                                            echo ucwords($data_in['priority']);
                                                        ?>
                                                    </td>
                                                    <td>
                                                        <?php
                                                            $sel_staff="select name from site_setting where admin_id='".$data_in['admin_id']."'";
                                                            $ptr_staff=mysql_query($sel_staff);
                                                            $data_staff=mysql_fetch_array($ptr_staff);
                                                            echo ucwords($data_staff['name']);
                                                        ?>
                                                    </td>
                                                    <td>
                                                    <strong><a href="ts_ticket_detail.php?id=<?= $data_in['inc_id'] ?>"  value="">Details</a></strong>
                                                    </td>
                                                </tr>
                                                <?php
                                            }
                                            ?>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>

    <!--====================================================== Me assign Solved Tickets ================================================ -->

                    <div class="tab-pane" id="tab_6">
                    <div class="box-header with-border">
                            <h3 class="box-title"><strong> Me assign Solved Tickets </strong></h3>
                            <div class="box-body">
                                <div class="table-responsive">
                                    <table class="table no-margin">
                                        <thead>
                                            <tr>
                                                <th>Sr No </th>
                                                <th>Ticket ID</th>
                                                <th>Assign To</th>
                                                <th>Subject</th>
                                                <th>Status</th>
                                                <th>Generation</th>
                                                <th>Priority</th>
                                                <th>Details</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <?php
                                            $sel_in="select * from ts_incidence where 1 and admin_id='".$_SESSION['admin_id']."' and status='solved' order by added_date desc";
                                            $ptr_in=mysql_query($sel_in);
                                            $i=1;
                                            while($data_in=mysql_fetch_array($ptr_in))
                                            {
                                                ?>
                                                <tr>
                                                    <td>
                                                        <?php
                                                        echo $i++;
                                                        ?>
                                                    </td>
                                                    <td>
                                                        <?php
                                                            echo $data_in['inc_id'];
                                                        ?>
                                                    </td>
                                                    <td>
                                                        <?php
                                                            $sel_staff="select name from site_setting where admin_id='".$data_in['assign_to']."'";
                                                            $ptr_staff=mysql_query($sel_staff);
                                                            $data_staff=mysql_fetch_array($ptr_staff);
                                                            echo ucwords($data_staff['name']);
                                                        ?>
                                                    </td>
                                                    <td>
                                                    <?php
                                                        echo ucwords($data_in['subject']);
                                                        ?>
                                                    </td>
                                                    <td>
                                                        <?php
                                                        //  echo ucfirst($data_in['status']);
                                                            ?>
                                                        <?php if($data_in['status']=='solved') 
                                                            { 
                                                                ?>
                                                                <p class="label label-success"> <?php echo ucfirst($data_in['status']);?></p>
                                                                <?php
                                                            } 
                                                            if($data_in['status']=='in_progress') 
                                                            { 
                                                                ?>
                                                                <p class="label label-warning"><?php echo ucfirst($data_in['status']);?></p>
                                                                <?php
                                                            } 
                                                            if($data_in['status']=='cancel') 
                                                            { 
                                                                ?>
                                                                <p class="label label-danger"><?php echo ucfirst($data_in['status']);?></p>
                                                                <?php
                                                            } 
                                                            if($data_in['status']=='halt') 
                                                            { 
                                                                ?>
                                                                <p class="label label-primary"><?php echo ucfirst($data_in['status']);?></p>
                                                                <?php
                                                            } 
                                                            if($data_in['status']=='pending') 
                                                            { 
                                                                ?>
                                                                <p class="label label-danger"><?php echo ucfirst($data_in['status']);?></p>
                                                                <?php
                                                            } 
                                                        ?>
                                                    </td>
                                                    <td>
                                                        <?php
                                                            echo ucwords($data_in['generation']);
                                                            ?>
                                                    </td>
                                                    <td>
                                                        <?php
                                                            echo ucwords($data_in['priority']);
                                                        ?>
                                                    </td>
                                                    <td>
                                                    <strong><a href="ts_ticket_detail.php?id=<?= $data_in['inc_id'] ?>"  value="">Details</a></strong>
                                                    </td>
                                                </tr>
                                                <?php
                                            }
                                            ?>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>

				<!--============================END====================================-->

	<!--===================================STAFF Assigned Task============================================-->

				<?php

					if($_SESSION['type']=='S' || $edit_access=='yes')

					{

						?>

						<div class="tab-pane" id="tab_8">

                            <div class="box-header with-border">

                                <h3 style="color:blue" class="box-title"><strong> Staff Assigned Task</strong></h3>
                                <div class="direct-chat-messages">
                                <div class="box-body">

                                    <div class="table-responsive">

                                        <?php

                                        $my_staff_assign_task="select * from tk_individual_task where 1 and assign_by!='".$_SESSION['admin_id']."' and (status !='complete' and status !='halt' and status !='cancel' and status !='in_complete') and Validation='valid' and task_type='adhoc_task' order by added_date DESC";

										$ptr_assign_task=mysql_query($my_staff_assign_task);

                                        $no_of_assign_records=mysql_num_rows($ptr_assign_task);

                                        if($no_of_assign_records)

                                        {

                                            ?>

                                            <table class="table no-margin">

                                                <thead>

                                                <tr>

                                                    <th>Task Name</th>

                                                    <th>Assinged To</th>

                                                    <th>Assinged By</th>

                                                    <th>Created Date</th>

                                                    <th>Dead Line</th>

                                                    <th>Details</th>

                                                </tr>

                                                </thead>

                                                <tbody>

                                                <?php
                                                     $bgColorCounter=1;
                                                    while($assign_task=mysql_fetch_array($ptr_assign_task))

                                                    {

                                                        if($assign_task['staff_status']=='complete')
                                                        {
                                                            $bg_color='style="background-color:rgb(172,225,175);"';
                                                        }
                                                        elseif($assign_task['staff_status']=='in_progress')
                                                        {
                                                            $bg_color='style="background-color:rgb(252,255,164);"';
                                                        }
                                                        elseif($bgColorCounter%2==0)
                                                        {
                                                            $bg_color='style="background-color:rgb(244,240,236)"';
                                                        }
                                                        else
                                                        {
                                                        $bg_color='';
                                                        }
                                                        ?>

                                                        <tr <?php echo $bg_color; ?>>

                                                        <td> <b><?php echo ucwords($assign_task['task_name']);?></b><br>

                                                            <?php

                                                            $hours=$assign_task['hours'];

                                                            $time1= convertToHoursMins($hours, '%02d hour %02d min');

                                                            echo $time1.'<br>';

                                                            echo 'Points- '.$assign_task['points'].'<br>';

                                                            echo 'Priority- '.ucfirst($assign_task['priority']);

                                                             ?>

                                                        </td>

                                                            <td>

                                                                <?php

                                                                    $staff_name_c="select name,photo from site_setting where 1 and admin_id='".$assign_task['staff_id']."'";

                                                                    $ptr_data_staff_c=mysql_query($staff_name_c);

                                                                    $fetch_staff_name_c=mysql_fetch_array($ptr_data_staff_c);

                                                                    

                                                                    echo ucfirst($fetch_staff_name_c['name']);

                                                                ?>

                                                            </td>

                                                            <td>

                                                                <?php

                                                                    $staff_names="select name,photo from site_setting where 1 and admin_id='".$assign_task['assign_by']."'";

                                                                    $ptr_staff_names=mysql_query($staff_names);

                                                                    $fetch_staff_names=mysql_fetch_array($ptr_staff_names);

                                                                    

                                                                    echo ucfirst($fetch_staff_names['name']);

                                                                ?>

                                                            </td>

                                                            <td>

                                                                <?php

                                                                    $add_task_Date = date("d-m-Y", strtotime($assign_task['added_date']));

                                                                    echo $add_task_Date ;

                                                                ?>

                                                            </td>

                                                            <td>

                                                                <?php

                                                                    $date=date("d-m-Y");

                                                                    $due_date1=$assign_task['due_date'];

                                                                    $date1=strtotime($date);

                                                                    $due_date=strtotime($due_date1);

                                                                    $due_d_Date = date("d-m-Y", strtotime($assign_task['due_date']));

                                                                    if($date1 > $due_date){

                                                                    ?>

                                                                    <p style="color:red;"><?php

                                                                    echo $due_d_Date ;

                                                                    ?></p><?php

                                                                    }

                                                                    else

                                                                    {?>

                                                                    <p style="color:blue;"><?php

                                                                    echo $due_d_Date ;

                                                                    ?></p><?php

                                                                    }

                                                                ?><br>

                                                                <?php

                                                                ?>

                                                            </td>

                                                            <td>

                                                                <strong><a href="tk_individual_task_detail.php?id=<?= $assign_task['staff_task_id'] ?>" value="">Details</a></strong>

                                                            </td>

                                                        </tr>

                                                        <?php
                                                         $bgColorCounter++;
                                                    }

                                                    ?>

                                                </tbody>

                                            </table>

                                            <?php

                                        }

                                        else

                                        {

                                            ?> 

                                             <div ><h4 style="background-color:;text-align:center"> No Record Avialable According To Your Creteria</h4></div>

                                            <?php

                                        }

                                        ?>

                                    </div>

                                </div>
                            </div>
                            </div>

                        </div>

						<?php

					}

				?>

<!-- ===================================================== Staff Side Complete Task ===================================== -->

                        <?php

                if($_SESSION['type']=='S' || $edit_access=='yes')

					{

						?>

						<div class="tab-pane" id="tab_14">

                            <div class="box-header with-border">

                                <h3 style="color:blue" class="box-title"><strong> Staff Assigned Completed Task</strong></h3>
                                <div class="direct-chat-messages">
                                <div class="box-body">

                                    <div class="table-responsive">

                                        <?php

                                        $staff_cmplt_task="select * from tk_individual_task where 1 and (status !='complete' and status !='halt' and status !='cancel' ) and Validation='valid' and task_type='adhoc_task' and staff_status='complete' and added_date > '2023-06-24' order by added_date DESC";

										$ptr_staff_cmplt_task=mysql_query($staff_cmplt_task);

                                        $no_of_cpmlt_records=mysql_num_rows($ptr_staff_cmplt_task);

                                        if($no_of_cpmlt_records)

                                        {

                                            ?>

                                            <table class="table no-margin">

                                                <thead>

                                                <tr>

                                                    <th>Task Name</th>

                                                    <th>Assinged To</th>

                                                    <th>Assinged By</th>

                                                    <th>Created Date</th>

                                                    <th>Dead Line</th>

                                                    <th>Details</th>

                                                </tr>

                                                </thead>

                                                <tbody>

                                                <?php
                                                     $bgColorCounter=1;
                                                    while($data_staff_task=mysql_fetch_array($ptr_staff_cmplt_task))

                                                    {

                                                        if($data_staff_task['staff_status']=='complete')
                                                        {
                                                            $bg_color='style="background-color:rgb(172,225,175);"';
                                                        }
                                                        elseif($data_staff_task['staff_status']=='in_progress')
                                                        {
                                                            $bg_color='style="background-color:rgb(252,255,164);"';
                                                        }
                                                        elseif($bgColorCounter%2==0)
                                                        {
                                                            $bg_color='style="background-color:rgb(244,240,236)"';
                                                        }
                                                        else
                                                        {
                                                           $bg_color='';
                                                        }
                                                        ?>

                                                        <tr <?php echo $bg_color; ?>>

                                                        <td> <b><?php echo ucwords($data_staff_task['task_name']);?></b><br>

                                                            <?php

                                                            $hours=$data_staff_task['hours'];

                                                            $time1= convertToHoursMins($hours, '%02d hour %02d min');

                                                            echo $time1.'<br>';

                                                            echo 'Points- '.$data_staff_task['points'].'<br>';

                                                            echo 'Priority- '.ucfirst($data_staff_task['priority']);

                                                             ?>

                                                        </td>

                                                            <td>

                                                                <?php

                                                                    $staff_name_c="select name,photo from site_setting where 1 and admin_id='".$data_staff_task['staff_id']."'";

                                                                    $ptr_data_staff_c=mysql_query($staff_name_c);

                                                                    $fetch_staff_name_c=mysql_fetch_array($ptr_data_staff_c);

                                                                    

                                                                    echo ucfirst($fetch_staff_name_c['name']);

                                                                ?>

                                                            </td>

                                                            <td>

                                                                <?php

                                                                    $staff_names="select name,photo from site_setting where 1 and admin_id='".$data_staff_task['assign_by']."'";

                                                                    $ptr_staff_names=mysql_query($staff_names);

                                                                    $fetch_staff_names=mysql_fetch_array($ptr_staff_names);

                                                                    

                                                                    echo ucfirst($fetch_staff_names['name']);

                                                                ?>

                                                            </td>

                                                            <td>

                                                                <?php

                                                                    $add_task_Date = date("d-m-Y", strtotime($data_staff_task['added_date']));

                                                                    echo $add_task_Date ;

                                                                ?>

                                                            </td>

                                                            <td>

                                                                <?php

                                                                    $date=date("d-m-Y");

                                                                    $due_date1=$data_staff_task['due_date'];

                                                                    $date1=strtotime($date);

                                                                    $due_date=strtotime($due_date1);

                                                                    $due_d_Date = date("d-m-Y", strtotime($data_staff_task['due_date']));

                                                                    if($date1 > $due_date){

                                                                    ?>

                                                                    <p style="color:red;"><?php

                                                                    echo $due_d_Date ;

                                                                    ?></p><?php

                                                                    }

                                                                    else

                                                                    {?>

                                                                    <p style="color:blue;"><?php

                                                                    echo $due_d_Date ;

                                                                    ?></p><?php

                                                                    }

                                                                ?><br>

                                                                <?php

                                                                ?>

                                                            </td>

                                                            <td>

                                                                <strong><a href="tk_individual_task_detail.php?id=<?= $data_staff_task['staff_task_id'] ?>" value="">Details</a></strong>

                                                            </td>

                                                        </tr>

                                                        <?php
                                                         $bgColorCounter++;
                                                    }

                                                    ?>

                                                </tbody>

                                            </table>

                                            <?php

                                        }

                                        else

                                        {

                                            ?> 

                                             <div ><h4 style="background-color:;text-align:center"> No Record Avialable According To Your Creteria</h4></div>

                                            <?php

                                        }

                                        ?>

                                    </div>

                                </div>

                            </div>
                                    </div>

                        </div>

						<?php

					}

				?>

<!-- =========================================Validation Pending Task task ============================================== -->

                        <?php                       

                            if(isset($_REQUEST['submit_valiadtion']))

                            {

                                $task_ids=$_POST['task_id1'];

                                $validation=$_POST['validation'];

                                $reason=$_POST['reason'];

                                $admin_id =$_SESSION['admin_id'];

   

                                if($reason!='')

                                {

                                    $insert_project="insert into tk_task_validation(`staff_task_id`,`reasons`,`added_date`,`admin_id`) values('".$task_ids."','".$reason."','".date('Y-m-d : H:i:s')."','".$admin_id."')";

                                    $ptr_ins=mysql_query($insert_project);

                                }

                                if($validation!='')

                                {

                                   $update_status="update tk_individual_task set `Validation`='".$validation."',`validation_admin`='".$_SESSION['admin_id']."'where staff_task_id='".$task_ids."'";

                                    $ptr_update=mysql_query($update_status);

                                }

                                if($ptr_update)

                                {

                                    ?>

                                    <!-- <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_dashboard.php"',200);</script>

                                    <?php

                                }

                            }

                        ?>

                        <div class="tab-pane" id="tab_9">

                            <div class="box-header with-border">

                                <h3 style="color:blue" class="box-title"><strong>Validation Pending Task</strong></h3>&nbsp;&nbsp;&nbsp;&nbsp;

                                <?php

                                //   if($_SESSION['type']=='S' || $edit_access=='yes'){ 

                                ?>

                                <!-- <select class="form-control select2" style="width:300px" id="" name="" >

                                 <option value="">Staff Todays Task Hours</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  $task_hours="select sum(hours)as task_hour from tk_individual_task where 1 and Validation='valid' and staff_id='".$data_c['admin_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'];

                                //     $tot_hours= convertToHoursMins($task_time, '%02d hour %02d min');

                                    //  $tot_hours.'<br>';

                                    // $sel='';

                                    // if($data_c['admin_id']==$_GET['staff_names'])

                                    //   {

                                    //     $sel='selected="selected"';

                                    //   }

                                //     echo  '<option >'.ucfirst($data_c['name']).' [ '.$tot_hours.' ]</option>';

                                //  }

                                 ?>

                              <!-- </select> -->

                              <?php

                                //   }

                                  ?>
                            <div class="direct-chat-messages">
                                <div class="box-body">

                                    <div class="table-responsive">

                                    <?php

                                         if($_SESSION['type']=='S' || $edit_access=='yes'){ 

                                            // $Date12 = date("Y-m-d");

                                            $pending_task1="select * from tk_individual_task where 1 and Validation='pending' and task_type='adhoc_task' and status='in_progress' order by added_date DESC";

                                        }

                                        else{

                                            // $Date12 = date("Y-m-d");

                                            $pending_task1="select * from tk_individual_task where 1 and staff_id='".$_SESSION['admin_id']."'and Validation='pending' and task_type='adhoc_task' and status='in_progress' order by added_date DESC"; 

                                        }

										$ptr_pending_task=mysql_query($pending_task1);

                                        $no_of_records1=mysql_num_rows($ptr_pending_task);

                                        if($no_of_records1)

                                        {

                                            ?>

                                            <table class="table no-margin">

                                                <thead>

                                                    <tr>

                                                        <th>Task Name</th>

                                                        <?php

                                                        if($_SESSION['type']=='S' || $edit_access=='yes')

														{

                                                            ?>

															<th>Assinged To</th>

                                                            <?php  

                                                        }

                                                        ?>

                                                        <th>Assinged BY</th>

                                                        <th>Created Date</th>

                                                        <th>Dead Line</th>

                                                        <th>Validation</th>

                                                        <?php

                                                        if($_SESSION['type']=='S' || $edit_access=='yes'){

                                                            ?>

                                                        <th>Details</th>

                                                            <?php  

                                                        }

                                                        ?>

                                                    </tr>

                                                </thead>

                                                <tbody>

                                                <?php
                                                     $bgColorCounter=1;
                                                    while($data_valid=mysql_fetch_array($ptr_pending_task))

                                                    {
                                                        if($bgColorCounter%2==0)
                                                        {
                                                            $bg_color='style="background-color:rgb(244,240,236)"';
                                                        }
                                                        else
                                                        {
                                                           $bg_color='';
                                                        }
                                                        ?>

                                                        <tr <?php echo $bg_color;?>>

                                                            <td><?php echo ucfirst($data_valid['task_name']);  ?></td>

                                                            <?php

                                                            if($_SESSION['type']=='S' || $edit_access=='yes'){

                                                            ?>

                                                            <td> 

                                                                <?php

                                                                    $staff_name_v="select name,photo from site_setting where 1 and admin_id='".$data_valid['staff_id']."'";

                                                                    $ptr_data_staff_v=mysql_query($staff_name_v);

                                                                    $fetch_staff_name_v=mysql_fetch_array($ptr_data_staff_v);

                                                                    echo ucfirst($fetch_staff_name_v['name']);

                                                                ?>

                                                            </td>

                                                            <?php  

                                                            }

                                                            ?>

                                                            <td> 

                                                                <?php

                                                                    $staff_name_v1="select name,photo from site_setting where 1 and admin_id='".$data_valid['assign_by']."'";

                                                                    $ptr_data_staff_v1=mysql_query($staff_name_v1);

                                                                    $fetch_staff_name_v1=mysql_fetch_array($ptr_data_staff_v1);

                                                                    echo ucfirst($fetch_staff_name_v1['name']);

                                                                ?>

                                                            </td>

                                                            <td>

                                                                <?php

                                                                    $add_task_Date = date("d-m-Y : H:m", strtotime($data_valid['added_date']));

                                                                    echo $add_task_Date ;

                                                                ?>

                                                            </td>

                                                            <!-- <td> -->

                                                            <?php

															$date0=date("d-m-Y");

															$due_date1=$data_valid['due_date'];

															$date1=strtotime($date0);

															$due_date=strtotime($due_date1);

															$due_d_Date = date("d-m-Y", strtotime($data_valid['due_date']));

															if($date1 > $due_date){

																?>

																<td style="color:red;"><?php

																echo $due_d_Date ;

																?></td><?php

															}

															else

															{?>

																<td style="color:blue;"><?php

																echo $due_d_Date ;

																?></td><?php

															}

                                                                ?>

                                                            <!-- </td> -->

                                                            <td>

                                                                <?php

                                                                // if($_SESSION['type']=='S' || $edit_access=='yes' && $_SESSION['admin_id']!=$data_valid['staff_id'])

                                                                // {

                                                                    ?>

                                                                    <!-- <button type="button" class="btn btn-default" data-toggle="modal"

                                                                    data-target="#<?php echo $data_valid['staff_task_id'];?>" style="width:70px;"><?php echo ucfirst($data_valid['Validation']);?></button> -->

                                                                    <!-- <div class="modal fade" id="<?php echo $data_valid['staff_task_id'];?>">

                                                                        <div class="modal-dialog">

                                                                            <div class="modal-content">

                                                                            <div class="modal-header">

                                                                                <button type="button" class="close"

                                                                                    data-dismiss="modal" aria-label="Close">

                                                                                    <span aria-hidden="true">&times;</span>

                                                                                </button>

                                                                                <h4><label>Task Validation </label></h4> 

                                                                            </div>

                                                                                <div class="modal-body">

                                                                                    <div class="box box-default">

                                                                                        <form name="task_form12" method="post">

                                                                                            <div class="box-body">

                                                                                                <div class="row">

                                                                                                    <div class="col-md-8">

                                                                                                        <div class="form-group" style="margin-left:30%;">

                                                                                                            <label>Valid

                                                                                                            <input type="radio" name="validation" value="valid" <?php if($_POST['validation'] == "valid") echo 'checked="checked"'; else if($data_valid['Validation']== "valid") echo 'checked="checked"'; ?> class="minimal" >

                                                                                                            </label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                                                                                                            <label>In-Valid

                                                                                                                <input type="radio" name="validation" value="in_valid"  <?php if($_POST['validation'] == "in_valid") echo 'checked="checked"'; else if($data_valid['Validation']== "in_valid") echo 'checked="checked"'; ?> class="minimal-red">

                                                                                                            </label>

                                                                                                        </div>

                                                                                                        <div class="form-group">

                                                                                                                <input type="hidden" name="task_id1" value="<?php echo $data_valid['staff_task_id'];?>">

                                                                                                                <textarea type="text" class="form-control" name="reason" id="reason"

                                                                                                                    value=""  placeholder="Add Query"></textarea>

                                                                                                        </div>

                                                                                                        <div class="form-group" style="margin-left:10%;">

                                                                                                                <input type="submit" name="submit_valiadtion" value="Submit" class="btn btn-block btn-success">

                                                                                                        </div>

                                                                                                    </div>

                                                                                                </div>

                                                                                            </div>

                                                                                        </form>

                                                                                    </div>

                                                                                </div>

                                                                            </div>

                                                                        </div>

                                                                    </div> -->

                                                                    <?php 

                                                                // }

                                                                // else

                                                                // {

                                                                    echo '<div style="color:red;">'.ucwords($data_valid['Validation']).'</div>';

                                                                // }

                                                                ?>

                                                            </td>

                                                            <?php

                                                                if($_SESSION['type']=='S' || $edit_access=='yes'){

                                                                ?>

                                                            <td>

                                                                <strong><a href="tk_individual_task_detail.php?id=<?= $data_valid['staff_task_id'] ?>" value="">Details</a></strong>&nbsp;&nbsp;&nbsp;&nbsp;

                                                                <a href="tk_add_individual_task.php?id=<?=$data_valid['staff_task_id']?>"><i class="fa fa-edit"></i></a>

                                                            </td>

                                                            <?php 

                                                                }

                                                            ?>

                                                        </tr>

                                                        <?php
                                                         $bgColorCounter++;
                                                    }

                                                    ?>  

                                                    <tr>

                                                </tr> 

                                                </tbody>

                                            </table>

                                            

                                            <?php

                                        }

                                        else

                                        {

                                            ?> 

                                             <div ><h4 style="background-color:;text-align:center"> No Record Avialable According To Your Creteria</h4></div>

                                            <?php

                                        }

                                        ?>

                                    </div>

                                </div>
                                    </div>
                            </div>

                        </div>

    <!-- ==================================In Valid Task ===================================== -->

    <?php

                // if($_SESSION['type']=='S' || $edit_access=='yes')

				// 	{

						?>

						<div class="tab-pane" id="tab_15">

                            <div class="box-header with-border">

                                <h3 style="color:blue" class="box-title"><strong>Invalid Task</strong></h3>
                                <?php if($_SESSION['type']=='S' || $edit_access=='yes'){ ?>
                                <div class="direct-chat-messages">
                                <?php } ?>
                                <div class="box-body">

                                    <div class="table-responsive">

                                        <?php
                                        $dat=date("Y-m-d");
                                        $upto_date=date("Y-m-d",strtotime('-10day'));
                                    if($_SESSION['type']=='S' || $edit_access=='yes'){
                                        $my_upc_tasks="select * from tk_individual_task where 1  and  Validation='in_valid' and task_type='adhoc_task' and DATE(date)>'".$upto_date."'  order by added_date DESC";
                                    }
                                    else{
                                       $my_upc_tasks="select * from tk_individual_task where 1  and  Validation='in_valid' and task_type='adhoc_task' and assign_by='".$_SESSION['admin_id']."' and DATE(date)>'".$upto_date."'  order by added_date DESC";
                                    }
										$ptr_upc_tasks=mysql_query($my_upc_tasks);

                                        $no_of_records12=mysql_num_rows($ptr_upc_tasks);

                                        if($no_of_records12)

                                        {

                                            ?>

                                            <table class="table no-margin">

                                                <thead>

                                                <tr>

                                                    <th>Task Name</th>

                                                    <th>Assinged To</th>

                                                    <th>Assinged By</th>

                                                    <th>Created Date</th>

                                                    <th>Dead Line</th>

                                                    <th>Validation</th>
                                                    <?php if($_SESSION['type']=='S' || $edit_access=='yes'){ ?>
                                                    <th>Details</th>
                                                    <?php }
                                                    else{
                                                        ?>
                                                    <th>Invalid Reason</th>
                                                        <?php
                                                    } ?>
                                                </tr>

                                                </thead>

                                                <tbody>

                                                <?php
                                                 $bgColorCounter=1;
                                                    while($invalid_task=mysql_fetch_array($ptr_upc_tasks))

                                                    {

                                                        if($bgColorCounter%2==0)
                                                        {
                                                            $bg_color='style="background-color:rgb(244,240,236)"';
                                                        }
                                                        else
                                                        {
                                                           $bg_color='';
                                                        }
                                                        ?>

                                                        <tr <?php echo $bg_color;?>>

                                                        <td> <b><?php echo ucwords($invalid_task['task_name']);?></b><br>

                                                            <?php

                                                            $hours=$invalid_task['hours'];

                                                            $time1= convertToHoursMins($hours, '%02d hour %02d min');

                                                            echo $time1.'<br>';

                                                            echo 'Points- '.$invalid_task['points'].'<br>';

                                                            echo 'Priority- '.ucfirst($invalid_task['priority']);

                                                             ?>

                                                        </td>

                                                            <td>

                                                                <?php

                                                                    $staff_name_c="select name,photo from site_setting where 1 and admin_id='".$invalid_task['staff_id']."'";

                                                                    $ptr_data_staff_c=mysql_query($staff_name_c);

                                                                    $fetch_staff_name_c=mysql_fetch_array($ptr_data_staff_c);

                                                                    

                                                                    echo ucfirst($fetch_staff_name_c['name']);

                                                                ?>

                                                            </td>

                                                            <td>

                                                                <?php

                                                                    $staff_names="select name,photo from site_setting where 1 and admin_id='".$invalid_task['assign_by']."'";

                                                                    $ptr_staff_names=mysql_query($staff_names);

                                                                    $fetch_staff_names=mysql_fetch_array($ptr_staff_names);

                                                                    

                                                                    echo ucfirst($fetch_staff_names['name']);

                                                                ?>

                                                            </td>

                                                            <td>

                                                                <?php

                                                                    $add_task_Date = date("d-m-Y : H:m", strtotime($invalid_task['added_date']));

                                                                    echo $add_task_Date ;

                                                                ?>

                                                            </td>

                                                            <td>

                                                                <?php

                                                                    $date=date("d-m-Y");

                                                                    $due_date1=$invalid_task['due_date'];

                                                                    $date1=strtotime($date);

                                                                    $due_date=strtotime($due_date1);

                                                                    $due_d_Date = date("d-m-Y", strtotime($invalid_task['due_date']));

                                                                    if($date1 > $due_date){

                                                                    ?>

                                                                    <p style="color:red;"><?php

                                                                    echo $due_d_Date ;

                                                                    ?></p><?php

                                                                    }

                                                                    else

                                                                    {?>

                                                                    <p style="color:blue;"><?php

                                                                    echo $due_d_Date ;

                                                                    ?></p><?php

                                                                    }

                                                                ?><br>

                                                                <?php

                                                                ?>

                                                            </td>

                                                            <td>

                                                                <?php

                                                                 $sel_valid_name="select name from site_setting where admin_id='".$invalid_task['validation_admin']."'";

                                                                 $pt_name=mysql_query($sel_valid_name);

                                                                 $data_validation=mysql_fetch_array($pt_name);

                                                                

                                                                    echo '<strong>'.ucwords($invalid_task['Validation']).'</strong> By '.Ucwords($data_validation['name']); ;

                                                                ?>

                                                            </td>

                                                            <td>
                                                                <?php
                                                                if($_SESSION['type']=='S' || $edit_access=='yes'){
                                                                ?>
                                                                <strong><a href="tk_individual_task_detail.php?id=<?= $invalid_task['staff_task_id'] ?>" value="">Details</a></strong>
                                                                <?php
                                                                }
                                                                else{
                                                                ?>
                                                                <button type="button" class="btn btn-warning" data-toggle="modal"
                                                                    data-target="#<?php echo $invalid_task['staff_task_id'];?>">
                                                                    Reasons
                                                                </button>
                                                                <?php
                                                                }
                                                                ?>
                                                                <div class="modal fade" id="<?php echo $invalid_task['staff_task_id'];?>">
                                                                    <div class="modal-dialog" style="width:300px;">
                                                                        <div class="modal-content">
                                                                            <div class="modal-header">
                                                                                <h4 class="modal-title">
                                                                                    <span style="color:blue">
                                                                                         Task Invalid Reasons
                                                                                    </span>
                                                                                </h4>
                                                                            </div>
                                                                            <div class="modal-body">
                                                                                <!-- body code -->
                                                                                <div class="box box-warning">
                                                                                    <?php
                                                                                        $sel_reason="select reasons,admin_id from tk_task_validation where staff_task_id='".$invalid_task['staff_task_id']."'";
                                                                                        $ptr_reason=mysql_query($sel_reason);
                                                                                        $no_records=mysql_num_rows($ptr_reason);
                                                                                        if($no_records)
                                                                                        {
                                                                                            ?>
                                                                                            <label>Reasons </label><br>
                                                                                            <?php
                                                                                            while($data_reason=mysql_fetch_array($ptr_reason))
                                                                                            {
                                                                                                $add="select name from site_setting where 1 and admin_id='".$data_reason['admin_id']."'";
                                                                                                $ptr=mysql_query($add);
                                                                                                $data2=mysql_fetch_array($ptr);
                                                                                                if($data_reason['reasons']!='')
                                                                                                {
                                                                                                    echo '<div><b>'.ucfirst($data2['name']).'</b></div>';
                                                                                                    echo '<li>'.ucwords($data_reason['reasons']).'</li>';
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                        else{
                                                                                            echo '<span style="color:green;text-align:center">No Invalid Reason</span>';
                                                                                        }
                                                                                    ?>
                                                                                </div>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </td>

                                                        </tr>

                                                        <?php
                                                         $bgColorCounter++;
                                                    }

                                                    ?>

                                                </tbody>

                                            </table>

                                            <?php

                                        }

                                        else

                                        {

                                            ?> 

                                             <div ><h4 style="background-color:;text-align:center"> No Record Avialable According To Your Creteria</h4></div>

                                            <?php

                                        }

                                        ?>

                                    </div>

                                </div>
                            <?php 
                             if($_SESSION['type']=='S' || $edit_access=='yes'){
                            ?>
                            </div>
                            <?php
                             }
                            ?>
                                    </div>

                        </div>

						<?php

					// }

				?>

					<!--=================END Staff Assigned Task==================-->

                </div>

                <!-- /.tab-content -->

            </div>

            <!-- nav-tabs-custom -->

        </div>

          
        </section>
            <!-- main body code end -->
    </div>

        <?php include "include/footer-main.php"; ?>

    </div>

    <!-- jQuery 3 -->

    <script src="bower_components/jquery/dist/jquery.min.js"></script>

    <!-- Bootstrap 3.3.7 -->

    <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>

    <!-- Select2 -->

    <script src="bower_components/select2/dist/js/select2.full.min.js"></script>

    <!-- InputMask -->

    <script src="plugins/input-mask/jquery.inputmask.js"></script>

    <script src="plugins/input-mask/jquery.inputmask.date.extensions.js"></script>

    <script src="plugins/input-mask/jquery.inputmask.extensions.js"></script>

    <!-- date-range-picker -->

    <script src="bower_components/moment/min/moment.min.js"></script>

    <script src="bower_components/bootstrap-daterangepicker/daterangepicker.js"></script>

    <!-- bootstrap datepicker -->

    <script src="bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js"></script>

    <!-- bootstrap color picker -->

    <script src="bower_components/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.min.js"></script>

    <!-- bootstrap time picker -->

    <script src="plugins/timepicker/bootstrap-timepicker.min.js"></script>

    <!-- SlimScroll -->

    <script src="bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>

    <!-- iCheck 1.0.1 -->

    <script src="plugins/iCheck/icheck.min.js"></script>

    <!-- FastClick -->

    <script src="bower_components/fastclick/lib/fastclick.js"></script>

    <!-- AdminLTE App -->

    <script src="dist/js/adminlte.min.js"></script>

    <!-- AdminLTE for demo purposes -->

    <script src="dist/js/demo.js"></script>



    <!-- Morris.js charts -->

    <script src="../../bower_components/raphael/raphael.min.js"></script>

    <!-- <script src="../../bower_components/morris.js/morris.min.js"></script> -->

    <!-- date-range-picker -->

    <script src="bower_components/moment/min/moment.min.js"></script>

    <script src="bower_components/bootstrap-daterangepicker/daterangepicker.js"></script>

    <!-- bootstrap datepicker -->

    <script src="bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js"></script>

    <!-- bootstrap color picker -->

    <script src="bower_components/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.min.js"></script>

    <!-- bootstrap time picker -->

    <script src="plugins/timepicker/bootstrap-timepicker.min.js"></script>



    <!-- Page script -->

        <script>

        $(function () {

            //Initialize Select2 Elements

            $('.select2').select2()



            //Datemask dd/mm/yyyy

            /*$('#datemask').inputmask('dd/mm/yyyy', { 'placeholder': 'dd/mm/yyyy' })

            //Datemask2 mm/dd/yyyy

            $('#datemask2').inputmask('mm/dd/yyyy', { 'placeholder': 'mm/dd/yyyy' })

            //Money Euro

            $('[data-mask]').inputmask()

        

            //Date range picker

            $('#reservation').daterangepicker()

            //Date range picker with time picker

            $('#reservationtime').daterangepicker({ timePicker: true, timePickerIncrement: 30, format: 'MM/DD/YYYY h:mm A' })

            //Date range as a button

            $('#daterange-btn').daterangepicker(

              {

                ranges   : {

                  'Today'       : [moment(), moment()],

                  'Yesterday'   : [moment().subtract(1, 'days'), moment().subtract(1, 'days')],

                  'Last 7 Days' : [moment().subtract(6, 'days'), moment()],

                  'Last 30 Days': [moment().subtract(29, 'days'), moment()],

                  'This Month'  : [moment().startOf('month'), moment().endOf('month')],

                  'Last Month'  : [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]

                },

                startDate: moment().subtract(29, 'days'),

                endDate  : moment()

              },

              function (start, end) {

                $('#daterange-btn span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'))

              }

            )*/



            //Date picker

            $('#datepicker').datepicker({

                autoclose: true,

                format: 'dd/mm/yyyy',

                startDate: '-0d',

                Default: true,

                todayHighlight: true

            })

            $('#datepicker1').datepicker({

                autoclose: true,

                format: 'dd/mm/yyyy',

                Default: true,

                todayHighlight: true

            })

            //iCheck for checkbox and radio inputs

            $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({

                checkboxClass: 'icheckbox_minimal-blue',

                radioClass: 'iradio_minimal-blue'

            })

            //Red color scheme for iCheck

            $('input[type="checkbox"].minimal-red, input[type="radio"].minimal-red').iCheck({

                checkboxClass: 'icheckbox_minimal-red',

                radioClass: 'iradio_minimal-red'

            })

            //Flat red color scheme for iCheck

            $('input[type="checkbox"].flat-red, input[type="radio"].flat-red').iCheck({

                checkboxClass: 'icheckbox_flat-green',

                radioClass: 'iradio_flat-green'

            })



            //Colorpicker

            $('.my-colorpicker1').colorpicker()

            //color picker with addon

            $('.my-colorpicker2').colorpicker()



            //Timepicker

            $('.timepicker').timepicker({

                showInputs: false

            })

        })

    </script>
</body>
</html>