<?php 
    include'include/session.php';
    
    $result=mysql_query("SELECT * FROM school_staff_leave ORDER BY applied DESC");
    $rows = mysql_num_rows($result)
?>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Staff Leave Request | Principal | WAKA CMEC</title>
    <link rel="shortcut icon" href="../../../assets/img/logo.png" />
    <link rel="stylesheet" href="../../../assets/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,700">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Slab:300,400|Roboto:300,400,700">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Slab:300,400">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Romanesco">
    <link rel="stylesheet" href="../../../assets/fonts/font-awesome.min.css">
    <link rel="stylesheet" href="../../../assets/fonts/material-icons.css">
    <link rel="stylesheet" href="../../../assets/css/ebs-simple-login-form1.css">
    <link rel="stylesheet" href="../../../assets/css/ebs-simple-login-form2.css">
    <link rel="stylesheet" href="../../../assets/css/Data-Table.css">
    <link rel="stylesheet" href="../../../assets/css/Data-Table1.css">
    <link rel="stylesheet" href="../../../assets/css/ebs-simple-login-form.css">
    <link rel="stylesheet" href="../../../assets/css/FPE-Gentella-form-elements.css">
    <link rel="stylesheet" href="../../../assets/css/FPE-Gentella-form-elements1.css">
    <link rel="stylesheet" href="https://cdn.datatables.net/1.10.15/css/dataTables.bootstrap.min.css">
    <link rel="stylesheet" href="../../../assets/css/MUSA_no-more-tables.css">
    <link rel="stylesheet" href="../../../assets/css/MUSA_no-more-tables1.css">
    <link rel="stylesheet" href="../../../assets/css/MUSA_panel-table.css">
    <link rel="stylesheet" href="../../../assets/css/MUSA_panel-table1.css">
    <link rel="stylesheet" href="../../../assets/css/nav.css">
    <link rel="stylesheet" href="../../../assets/css/Navbar---App-Toolbar--LG--MD---Mobile-Nav--SM--XS.css">
    <link rel="stylesheet" href="../../../assets/css/JLX-Fixed-Nav-on-Scroll.css">
    <link rel="stylesheet" href="../../../assets/css/Navbar---App-Toolbar--LG--MD---Mobile-Nav--SM--XS1.css">
    <link rel="stylesheet" href="../../../assets/css/Navbar-Fixed-Side1.css">
    <link rel="stylesheet" href="../../../assets/css/Pretty-Table.css">
    <link rel="stylesheet" href="../../../assets/css/Pretty-Table1.css">
    <link rel="stylesheet" href="../../../assets/css/Profile-Edit.css">
    <link rel="stylesheet" href="../../../assets/css/Profile-Edit1.css">
    <link rel="stylesheet" href="../../../assets/css/Responsive-Form.css">
    <link rel="stylesheet" href="../../../assets/css/Responsive-Form1.css">
    <link rel="stylesheet" href="../../../assets/css/Sidebar-Menu.css">
    <link rel="stylesheet" href="../../../assets/css/Sidebar-Menu1.css">
    <link rel="stylesheet" href="../../../assets/css/styles.css">
    <link rel="stylesheet" href="../../../assets/css/tabela-mloureiro1973.css">
    <link rel="stylesheet" href="../../../assets/css/Team-Clean.css">
    
    <script>
        function PrintElem(elem)
        {
            Popup($(elem).html());
        }

        function Popup(data) 
        {

            var mywindow = window.open('', 'printReport', 'height=500,width=700');
            mywindow.document.write('<html><head><title></title>');
            mywindow.document.write('<link rel="stylesheet" href="../../../assets/bootstrap/css/bootstrap.min.css"  media="print">');
            mywindow.document.write('<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,700"  media="print">');
            mywindow.document.write('<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Slab:300,400|Roboto:300,400,700"  media="print">');
            mywindow.document.write('<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Slab:300,400"  media="print">');
            mywindow.document.write('<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Romanesco"  media="print">');
            mywindow.document.write('<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Slab:300,400"  media="print">');
            mywindow.document.write('<link rel="stylesheet" href="../../../assets/fonts/font-awesome.min.css"  media="print">');
            mywindow.document.write('<link rel="stylesheet" href="../../../assets/css/FPE-Gentella-form-elements.css"  media="print">');
            mywindow.document.write('<link rel="stylesheet" href="../../../assets/css/FPE-Gentella-form-elements1.css"  media="print">');
            mywindow.document.write('<link rel="stylesheet" href="../../../assets/css/FPE-Gentella-form-elements1.css"  media="print">');
            
            mywindow.document.write('<link rel="stylesheet" href="../../../assets/css/Data-Table.css" media="print">');
            mywindow.document.write('<link rel="stylesheet" href="../../../assets/css/Data-Table1.css" media="print">');
            
            mywindow.document.write('</head><body >');
            mywindow.document.write(data);
            mywindow.document.write('</body></html>');

            mywindow.document.close(); // necessary for IE >= 10
            mywindow.focus(); // necessary for IE >= 10

            mywindow.print();
            mywindow.close();

            return true;
        }
    </script>
</head>

<body style="background-color:rgba(42,63,84,0);">
    <nav class="navbar navbar-default" style="background-color:rgb(62,140,228);">
        <div class="container-fluid">
            <div class="navbar-header">
                <a class="navbar-brand navbar-link" href="#" style="font-weight:bold;background-color:rgb(62,140,228);">
                   Principal | WAKA CMEC Training Institute
                </a>
                <button class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navcol-2" style="background-color:rgb(62,140,228);color:rgb(255,255,255);"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>
            </div>
            <div class="collapse navbar-collapse" id="navcol-2">
                <ul class="nav navbar-nav hidden-xs hidden-sm navbar-right" id="desktop-toolbar">
                    <li class="dropdown">
                        <a class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false" href="#"> <i class="fa fa-user"></i> &nbsp; <?php echo $pro;?>  <i class="fa fa-chevron-down fa-fw"></i></a>
                        <ul class="dropdown-menu" role="menu" style="background-color:rgb(249,249,249);">
                            <li role="presentation"><a href="settings.php"><i class="fa fa-user fa-fw"></i> Profile </a></li>
                            <li role="presentation"><a href="password.php"><i class="fa fa-lock fa-fw"></i> Password</a></li>
                            <li role="presentation"><a href="../validate/logout.php"><i class="fa fa-power-off fa-fw"></i>Logout </a></li>
                        </ul>
                    </li>
                </ul>
                <ul class="nav navbar-nav visible-xs-block visible-sm-block" id="mobile-nav">
                    
                    <li class="dropdown">
                        <a class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false" href="#"> <i class="fa fa-user"></i> &nbsp; <?php echo $pro;?> </i> <i class="fa fa-chevron-down fa-fw"></i></a>
                        <ul class="dropdown-menu" role="menu" style="background-color:rgb(249,249,249);">
                            <li role="presentation"><a href="settings.php"><i class="fa fa-user fa-fw"></i> Profile </a></li>
                            <li role="presentation"><a href="password.php"><i class="fa fa-lock fa-fw"></i> Password</a></li>
                            <li role="presentation"><a href="../validate/logout.php"><i class="fa fa-power-off fa-fw"></i>Logout </a></li>
                        </ul>
                    </li>
                    <li role="presentation"><a>&nbsp;</a></li>
                    <li role="presentation"><a>&nbsp;</a></li>
                    
                </ul>
            </div>
        </div>
    </nav>
    <div class="top">
        <nav class="navbar navbar-default" id="navbar-main">
            <div class="container-fluid">
                <div class="navbar-header">
                    <a class="navbar-brand hidden navbar-link" href="#" style="padding:0px;"> </a>
                    <button class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navcol-1"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>
                </div>
                <div class="collapse navbar-collapse" id="navcol-1">
                    <ul class="nav navbar-nav">
                        <li role="presentation">
                            <a href="index.php">
                                <i class="fa fa-table" style="margin-right:5px;"></i>
                                Dashboard
                            </a>
                        </li>
                        <li class="dropdown">
                            <a class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                                <i class="fa fa-users" style="margin-right:5px;"></i>
                                    Students 
                                <span class="caret"></span>
                            </a>
                            <ul class="dropdown-menu" role="menu" style="background-color:rgb(249,249,249);">
                                <li role="presentation"><a href="view-preadmitted.php">Pre-Admitted </a></li>
                                <li role="presentation"><a href="view-admitted.php">Admitted </a></li>
                                <li role="presentation"><a href="view-completed.php">Alumni </a></li>
                            </ul>
                        </li>
                        <li role="presentation">
                            <a href="class.php">Class</a>
                        </li>
                        
                        <li role="presentation">
                            <a href="view-fee.php">
                                <i class="fa fa-money" style="margin-right:5px;"></i>
                                Fee 
                            </a>
                        </li>
                        <li class="dropdown">
                            <a class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                                <i class="fa fa-book" style="margin-right:5px;"></i>
                                    Library
                                <span class="caret"></span>
                            </a>
                            <ul class="dropdown-menu" role="menu" style="background-color:rgb(249,249,249);">
                                <li role="presentation"><a href="view-book.php">View Books</a></li>
                                <li role="presentation"><a href="items.php">View Items</a></li>
                                <li role="presentation"><a href="student-due.php">Student Due Books </a></li>
                                <li role="presentation"><a href="staff-due.php">Staff Due Books</a></li>
                                <li role="presentation"><a href="items-due.php">Staff Due Items</a></li>
                            </ul>
                        </li>
                        <li role="presentation">
                            <a href="staff.php">Staff</a>
                        </li>
                        <li role="presentation">
                            <a href="assignments.php">Assignments</a>
                        </li>
                        <li role="presentation">
                            <a href="exams.php">Exam</a>
                        </li>
                        <li role="presentation">
                            <a href="lecture-room.php">Lecture Room</a>
                        </li>
                        <li class="dropdown active">
                            <a class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false" href="#">
                                Others <span class="badge bg-red" id="notificationCounter"></span>
                                <span class="caret"></span>
                            </a>
                            <ul class="dropdown-menu" role="menu">
                                <li role="presentation"><a href="pass-request.php">Gate Pass Request <span class="badge bg-red" id="requestCounter"></span></a></li>
                                <li role="presentation"><a href="expired-pass.php">Expired Gate Pass &nbsp;<span class="badge bg-red" id="expiredCounter"></span></a></li>
                                <li class="active" role="presentation"><a href="leave-request.php">Staff Leave Request <span class="badge bg-red" id="requestLeaveCounter"></span></a></li>
                                <li role="presentation"><a href="expired-leave.php">Expired Staff Leave &nbsp;<span class="badge bg-red" id="expiredLeaveCounter"></span></a></li>
                                <li role="presentation"><a href="pass.php">Gate Pass</a></li>
                                <li role="presentation"><a href="leave.php">Leave Type</a></li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </div>
        </nav>
    </div>
    <div class="row" style="width:98%;margin-right:auto;margin-left:auto;-webkit-box-shadow:0px 4px 4px 0px rgba(0,0,0,1);-moz-box-shadow:0px 4px 4px 0px rgba(0,0,0,1);box-shadow:0px 4px 4px 0px rgba(0,0,0,1);margin-bottom:5%;overflow:hidden;">
        <form method="POST">
            <div class="col-md-12" style="margin-bottom:1%;padding-top:2px;padding-bottom:2px;background-color:rgb(239,239,239);">
                <h2 style="margin-left:1%;font-size:16px;color:rgb(1,1,1);font-weight:bold;">Gate Pass Requests</h2>
            </div>
            <?php 
                if(empty($result)){
                    echo'<div class="col-md-12 alert alert-danger absolue center text-center" role="alert">
                            <span class="text-danger">No records found</span>
                        </div>';
                }else{                    
            ?>
                <div class="col-md-12" style="width:100%;">
                    <div class="table-responsive" style="margin-right:auto;margin-left:auto;">
                        <table class="table table-striped" id="myTable">
                            <thead style="background-color:rgb(42,63,84);color:rgb(254,255,255);">
                                <tr>
                                    <th style="width:7%;text-align:center;"># </th>
                                    <th>Staff</th>
                                    <th>Gender</th>
                                    <th>Staff No</th>
                                    <th>Phone</th>
                                    <th>Category</th>
                                    <th>Leave</th>
                                    <th>Applied</th>
                                    <th>From</th>
                                    <th>To</th>
                                    <th>Leave Days</th>
                                    <th style="width:100px;"><i class="fa fa-cog ml-3x"></i> Status </th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php 
                                if($rows < 1){
                                    echo'<div class="col-md-12 alert alert-danger absolue center text-center" role="alert">
                                            <span class="text-danger">No leave requests found</span>
                                        </div>';
                                }else{
                                    $i=$p=$s=$q=$r=$a=$b=$t=$x=$m=$n=$y=$c=$d=$z=1;
                                    while($row = mysql_fetch_array($result)) { 
                                        $sql = "SELECT COUNT(*) as num FROM school_leave WHERE staffID = '".$row['staffID']."'"; 
                                        $pages = mysql_fetch_array(mysql_query($sql));
                                        $totalRequest = $pages['num'];
                                        
                                        $sql1 = "SELECT COUNT(*) as num FROM school_leave WHERE status ='0' AND staffID = '".$row['staffID']."'"; 
                                        $pages1 = mysql_fetch_array(mysql_query($sql1));
                                        $totalPending = $pages1['num'];
                                        
                                        $sql2 = "SELECT COUNT(*) as num FROM school_leave WHERE status ='1' AND staffID = '".$row['staffID']."'"; 
                                        $pages2 = mysql_fetch_array(mysql_query($sql2));
                                        $totalApproved = $pages2['num'];
                                        
                                        $sql3 = "SELECT COUNT(*) as num FROM school_leave WHERE status ='-1' AND staffID = '".$row['staffID']."'"; 
                                        $pages3 = mysql_fetch_array(mysql_query($sql3));
                                        $totalDenied = $pages3['num'];
                                        
                                        $sql4 = "SELECT COUNT(*) as num FROM school_leave WHERE status ='2' AND staffID = '".$row['staffID']."'"; 
                                        $pages4 = mysql_fetch_array(mysql_query($sql3));
                                        $totalReported = $pages4['num'];
                                        
                                        $days = round((strtotime($row['to'])-strtotime($row['from'])) / (60 * 60 * 24))+1;
                                ?>
                                    <tr>
                                        <td style="text-align:center;font-size:12px;font-weight:normal;color:rgb(3,3,3);"> <?php echo $i++;?> </td>
                                        <td style="text-align:center;font-size:12px;font-weight:normal;color:rgb(3,3,3);"> <?php echo $row['staff'];?> </td>
                                        <td style="text-align:center;font-size:12px;font-weight:normal;color:rgb(3,3,3);"> <?php echo $row['gender'];?> </td>
                                        <td style="text-align:center;font-size:12px;font-weight:normal;color:rgb(3,3,3);"> <?php echo $row['staffNo'];?> </td>
                                        <td style="text-align:center;font-size:12px;font-weight:normal;color:rgb(3,3,3);"> <?php echo $row['phone'];?> </td>
                                        <td style="text-align:center;font-size:12px;font-weight:normal;color:rgb(3,3,3);"> <?php echo $row['category'];?> </td>
                                        <td style="text-align:center;font-size:12px;font-weight:normal;color:rgb(3,3,3);"> <?php echo $row['leave'];?> </td>
                                        <td style="font-weight:normal;font-size:12px;color:rgb(6,6,6);"> <?php echo date_format(date_create($row['applied']),"D d M, Y.").date(" g:i A", strtotime($row['applied']));?> </td>
                                        <td style="font-weight:normal;font-size:12px;color:rgb(6,6,6);"> <?php echo date_format(date_create($row['from']),"D d M, Y");?> </td>
                                        <td style="font-weight:normal;font-size:12px;<?php if(($currentTime > $row['to'] && $row['reported']== '' && $row['status']==1) || ($row['to'] < $row['reported'] && $row['status']==1)){echo'color:red;';}else{echo'color:rgb(6,6,6);';}?>"> 
                                            <?php echo date_format(date_create($row['to']),"D d M, Y");?>
                                        </td>
                                        <td style="font-weight:normal;font-size:12px;color:rgb(6,6,6);"> <?php if($days==1){echo $days." day";}else{echo $days." days";}?> </td>
                                        <td style="font-size:12px;font-weight:normal;color:black;"> 
                                            <?php if($row['status']==0){?>
                                            <a href="#myModalX<?php echo $x++;?>" data-toggle="modal" class="text-info" role="button" title="Pending Approval" style="font-weight:bold;display:block;">
                                                <em class="fa fa-circle-o-notch fa-spin text-info"></em> Pending
                                            </a>
                                                <div role="dialog" tabindex="-1" class="modal fade" id="myModalX<?php echo $t++;?>">
                                                    <div class="modal-dialog modal-lg" role="document">
                                                        <div class="modal-content">
                                                            <div class="modal-header">
                                                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                                    <span aria-hidden="true">×</span>
                                                                </button>
                                                                <h4 class="modal-title">Staff Leave Request Details</h4>
                                                            </div>
                                                            <div class="modal-body">
                                                                <div class="row">
                                                                    <div class="col-md-12">
                                                                        <div class="col-md-4">
                                                                            <p><b>Staff Name:</b>&nbsp; <?php echo $row['staff'];?></p>
                                                                        </div>
                                                                        <div class="col-md-3">
                                                                            <p><b>Staff No.</b>&nbsp; <?php echo $row['staffNo'];?></p>
                                                                        </div>
                                                                        <div class="col-md-2">
                                                                            <p><b>Gender:</b>&nbsp; <?php echo $row['gender'];?></p>
                                                                        </div>
                                                                        <div class="col-md-3">
                                                                            <p><b>Status:</b>&nbsp; <i class="fa fa-fa-circle-o-notch fa-spin text-info"></i> <label style="color:green;font-weight:normal;">Approved</label></p>
                                                                        </div>
                                                                    </div>
                                                                    <div class="col-md-12"><hr></div>
                                                                    <div class="col-md-12">
                                                                        <div class="col-md-4">
                                                                            <p><b>Category:</b> <?php echo $row['category'];?></p>
                                                                        </div>
                                                                        <div class="col-md-4">
                                                                            <p><b>E-mail:</b> <?php echo $row['mail'];?></p>
                                                                        </div>
                                                                        <div class="col-md-4">
                                                                            <p><b>Phone No:</b><?php echo $row['phone'];?></p>
                                                                        </div>
                                                                    </div>
                                                                    <div class="col-md-12"><hr></div>
                                                                    <div class="col-md-12">
                                                                        <div class="col-md-4">
                                                                            <p><b>Leave Type:</b></p> 
                                                                            <p><?php echo $row['leave'];?></p>
                                                                        </div>
                                                                        <div class="col-md-3">
                                                                            <p><b>Applied:</b></p>
                                                                            <p> <?php echo date_format(date_create($row['applied']),"D d M, Y")." ".date(" g:i A", strtotime($row['applied']));?></p>
                                                                        </div>
                                                                        <div class="col-md-2">
                                                                            <p><b>From:</b></p>
                                                                            <p><?php echo date_format(date_create($row['from']),"D d M, Y");?></p>
                                                                        </div>
                                                                        <div class="col-md-2">
                                                                            <p><b>To:</b></p>
                                                                            <p><?php echo date_format(date_create($row['to']),"D d M, Y");?></p>
                                                                        </div>
                                                                        <div class="col-md-1">
                                                                            <p><b>Days</b></p>
                                                                            <p><?php if($days==1){echo $days." day";}else{echo $days." days";}?></p>
                                                                        </div>
                                                                    </div>
                                                                    <div class="col-md-12"><hr></div>
                                                                    <div class="col-md-12">
                                                                        <div class="col-md-12" title="Total Leave Requests" style="cursor:pointer;">
                                                                            <p style="font-weight:bold;">Staff Description</p>
                                                                            <p><?php echo $row['description'];?></p>
                                                                        </div>
                                                                    </div>    
                                                                    <div class="col-md-12"><hr></div>
                                                                    <div class="col-md-12 text-center">
                                                                        <div class="col-md-3" title="Total Leave Requests" style="cursor:pointer;">
                                                                            <p style="font-weight:bold;"><i class="fa fa-anchor"></i></p>
                                                                            <p><?php echo $totalRequest;?></p>
                                                                        </div>
                                                                        <div class="col-md-3" title="Total Pending Leave Requests" style="cursor:pointer;">
                                                                            <p style="font-weight:bold;"><i class="fa fa-circle-o-notch fa-spin text-info"></i></p>
                                                                            <p><?php echo $totalPending;?></p>
                                                                        </div>
                                                                        <div class="col-md-3" title="Total Approved Leave Requests" style="cursor:pointer;">
                                                                            <p style="font-weight:bold;"><i class="fa fa-check text-success"></i></p>
                                                                            <p><?php echo $totalApproved;?></p>
                                                                        </div>
                                                                        <div class="col-md-3" title="Total Denied Leave Requests" style="cursor:pointer;">
                                                                            <p style="font-weight:bold;"><i class="fa fa-times text-danger"></i></p>
                                                                            <p><?php echo $totalDenied;?></p>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="modal-footer">
                                                                <button type="button" data-dismiss="modal" style="padding:5px 20px;color:rgb(1,1,1);">Close</button>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            <?php 
                                                }else
                                                if($row['status']==1){
                                                    if($row['reported'] ==''){ ?>
                                                        <a href="#myModalA<?php echo $a++;?>" data-toggle="modal" class="text-success" role="button" title="Approved" style="display:block;font-weight:bold;">
                                                            <em class="fa fa-check text-success"></em>    Approved
                                                        </a>
                                                    <?php }else{ ?>
                                                        <a href="#myModalA<?php echo $z++;?>" data-toggle="modal" class="text-primary" role="button" title="Approved" style="display:block;font-weight:bold;">
                                                            <em class="fa fa-check text-primary"></em>    Reported
                                                        </a>
                                                    <?php } ?>
                                                <div role="dialog" tabindex="-1" class="modal fade" id="myModalA<?php echo $c++;?>">
                                                    <div class="modal-dialog modal-lg" role="document">
                                                        <div class="modal-content">
                                                            <div class="modal-header">
                                                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                                    <span aria-hidden="true">×</span>
                                                                </button>
                                                                <h4 class="modal-title">Staff Leave Request Details</h4>
                                                            </div>
                                                            <div class="modal-body">
                                                                <div class="row" style="color:black;">
                                                                    <div class="col-md-12">
                                                                        <div class="col-md-4">
                                                                            <p><b>Staff Name:</b>&nbsp; <?php echo $row['staff'];?></p>
                                                                        </div>
                                                                        <div class="col-md-3">
                                                                            <p><b>Staff No.</b>&nbsp; <?php echo $row['staffNo'];?></p>
                                                                        </div>
                                                                        <div class="col-md-2">
                                                                            <p><b>Gender:</b>&nbsp; <?php echo $row['gender'];?></p>
                                                                        </div>
                                                                        <div class="col-md-3">
                                                                            <p><b>Status:</b>&nbsp; <i class="fa fa-check text-success"></i> <label style="color:green;font-weight:normal;">Approved</label></p>
                                                                        </div>
                                                                    </div>
                                                                    <div class="col-md-12"><hr></div>
                                                                    <div class="col-md-12">
                                                                        <div class="col-md-4">
                                                                            <p><b>Category:</b> <?php echo $row['category'];?></p>
                                                                        </div>
                                                                        <div class="col-md-4">
                                                                            <p><b>E-mail:</b> <?php echo $row['mail'];?></p>
                                                                        </div>
                                                                        <div class="col-md-4">
                                                                            <p><b>Phone No:</b><?php echo $row['phone'];?></p>
                                                                        </div>
                                                                    </div>
                                                                    <div class="col-md-12"><hr></div>
                                                                    <div class="col-md-12">
                                                                        <div class="col-md-4">
                                                                            <p><b>Leave Type:</b></p> 
                                                                            <p><?php echo $row['leave'];?></p>
                                                                        </div>
                                                                        <div class="col-md-3">
                                                                            <p><b>Applied:</b></p>
                                                                            <p> <?php echo date_format(date_create($row['applied']),"D d M, Y")." ".date(" g:i A", strtotime($row['applied']));?></p>
                                                                        </div>
                                                                        <div class="col-md-2">
                                                                            <p><b>From:</b></p>
                                                                            <p><?php echo date_format(date_create($row['from']),"D d M, Y");?></p>
                                                                        </div>
                                                                        <div class="col-md-2">
                                                                            <p><b>To:</b></p>
                                                                            <p><?php echo date_format(date_create($row['to']),"D d M, Y");?></p>
                                                                        </div>
                                                                        <div class="col-md-1">
                                                                            <p><b>Days</b></p>
                                                                            <p><?php if($days==1){echo $days." day";}else{echo $days." days";}?></p>
                                                                        </div>
                                                                    </div>
                                                                    <div class="col-md-12"><hr></div>
                                                                    <div class="col-md-12">
                                                                        <div class="col-md-12" title="Total Leave Requests" style="cursor:pointer;">
                                                                            <p style="font-weight:bold;">Staff Description</p>
                                                                            <p><?php echo $row['description'];?></p>
                                                                        </div>
                                                                    </div>    
                                                                    <div class="col-md-12"><hr></div>
                                                                    <div class="col-md-12 text-center">
                                                                        <div class="col-md-3" title="Total Leave Requests" style="cursor:pointer;">
                                                                            <p style="font-weight:bold;"><i class="fa fa-anchor"></i></p>
                                                                            <p><?php echo $totalRequest;?></p>
                                                                        </div>
                                                                        <div class="col-md-3" title="Total Pending Leave Requests" style="cursor:pointer;">
                                                                            <p style="font-weight:bold;"><i class="fa fa-circle-o-notch fa-spin text-info"></i></p>
                                                                            <p><?php echo $totalPending;?></p>
                                                                        </div>
                                                                        <div class="col-md-3" title="Total Approved Leave Requests" style="cursor:pointer;">
                                                                            <p style="font-weight:bold;"><i class="fa fa-check text-success"></i></p>
                                                                            <p><?php echo $totalApproved;?></p>
                                                                        </div>
                                                                        <div class="col-md-3" title="Total Denied Leave Requests" style="cursor:pointer;">
                                                                            <p style="font-weight:bold;"><i class="fa fa-times text-danger"></i></p>
                                                                            <p><?php echo $totalDenied;?></p>
                                                                        </div>
                                                                    </div>
                                                                    <div class="col-md-12"><hr></div>
                                                                    <div class="col-md-12">
                                                                        <label>Admin Remarks</label>
                                                                        <p><?php if($row['remarks']==''){echo '<em>N/A</em>';}else{echo $row['remarks'];}?></p>
                                                                    </div>
                                                                    <div class="col-md-12"><hr></div>
                                                                    <div class="col-md-12">
                                                                        <p><b>Reported on:</b> <?php if($row['reported'] !=''){echo date_format(date_create($row['reported']),"D d M, Y")." ".date(" g:i A", strtotime($row['reported']));}else{echo '<em>N/A</em>';}?></p>
                                                                        <input type="hidden" id="staffID" value="<?php echo $staffID;?>">
                                                                        <input type="hidden" id="request" value="<?php echo $row['school_leave_id'];?>">
                                                                        <input type="hidden" id="modalNo" value="<?php echo $n++;?>">
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="modal-footer">
                                                                <button type="button" data-dismiss="modal" style="padding:5px 20px;color:rgb(1,1,1);">Close</button>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            <?php 
                                                }else
                                                if($row['status']== -1){
                                            ?> 
                                                <a href="#myModalD<?php echo $b++;?>" data-toggle="modal" class="text-danger" role="button" title="Disapproved" style="display:block;font-weight:bold;">
                                                    <em class="fa fa-times text-danger"></em> Denied
                                                </a>
                                                <div role="dialog" tabindex="-1" class="modal fade" id="myModalD<?php echo $y++;?>">
                                                    <div class="modal-dialog modal-lg" role="document">
                                                        <div class="modal-content">
                                                            <div class="modal-header">
                                                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                                    <span aria-hidden="true">×</span>
                                                                </button>
                                                                <h4 class="modal-title">Staff Leave Request Details</h4>
                                                            </div>
                                                            <div class="modal-body">
                                                                <div class="row">
                                                                    <div class="col-md-12">
                                                                        <div class="col-md-4">
                                                                            <p><b>Staff Name:</b>&nbsp; <?php echo $row['staff'];?></p>
                                                                        </div>
                                                                        <div class="col-md-3">
                                                                            <p><b>Staff No.</b>&nbsp; <?php echo $row['staffNo'];?></p>
                                                                        </div>
                                                                        <div class="col-md-2">
                                                                            <p><b>Gender:</b>&nbsp; <?php echo $row['gender'];?></p>
                                                                        </div>
                                                                        <div class="col-md-3">
                                                                            <p><b>Status:</b>&nbsp; <i class="fa fa-times text-danger"></i>  <label style="color:red;font-weight:normal;">Denied</label></p>
                                                                        </div>
                                                                    </div>
                                                                    <div class="col-md-12"><hr></div>
                                                                    <div class="col-md-12">
                                                                        <div class="col-md-4">
                                                                            <p><b>Category:</b> <?php echo $row['category'];?></p>
                                                                        </div>
                                                                        <div class="col-md-4">
                                                                            <p><b>E-mail:</b> <?php echo $row['mail'];?></p>
                                                                        </div>
                                                                        <div class="col-md-4">
                                                                            <p><b>Phone No:</b><?php echo $row['phone'];?></p>
                                                                        </div>
                                                                    </div>
                                                                    <div class="col-md-12"><hr></div>
                                                                    <div class="col-md-12">
                                                                        <div class="col-md-4">
                                                                            <p><b>Leave Type:</b></p> 
                                                                            <p><?php echo $row['leave'];?></p>
                                                                        </div>
                                                                        <div class="col-md-3">
                                                                            <p><b>Applied:</b></p>
                                                                            <p> <?php echo date_format(date_create($row['applied']),"D d M, Y")." ".date(" g:i A", strtotime($row['applied']));?></p>
                                                                        </div>
                                                                        <div class="col-md-2">
                                                                            <p><b>From:</b></p>
                                                                            <p><?php echo date_format(date_create($row['from']),"D d M, Y");?></p>
                                                                        </div>
                                                                        <div class="col-md-2">
                                                                            <p><b>To:</b></p>
                                                                            <p><?php echo date_format(date_create($row['to']),"D d M, Y");?></p>
                                                                        </div>
                                                                        <div class="col-md-1">
                                                                            <p><b>Days</b></p>
                                                                            <p><?php if($days==1){echo $days." day";}else{echo $days." days";}?></p>
                                                                        </div>
                                                                    </div>
                                                                    <div class="col-md-12"><hr></div>
                                                                    <div class="col-md-12">
                                                                        <div class="col-md-12" title="Total Leave Requests" style="cursor:pointer;">
                                                                            <p style="font-weight:bold;">Staff Description</p>
                                                                            <p><?php echo $row['description'];?></p>
                                                                        </div>
                                                                    </div>    
                                                                    <div class="col-md-12"><hr></div>
                                                                    <div class="col-md-12 text-center">
                                                                        <div class="col-md-3" title="Total Leave Requests" style="cursor:pointer;">
                                                                            <p style="font-weight:bold;"><i class="fa fa-anchor"></i></p>
                                                                            <p><?php echo $totalRequest;?></p>
                                                                        </div>
                                                                        <div class="col-md-3" title="Total Pending Leave Requests" style="cursor:pointer;">
                                                                            <p style="font-weight:bold;"><i class="fa fa-circle-o-notch fa-spin text-info"></i></p>
                                                                            <p><?php echo $totalPending;?></p>
                                                                        </div>
                                                                        <div class="col-md-3" title="Total Approved Leave Requests" style="cursor:pointer;">
                                                                            <p style="font-weight:bold;"><i class="fa fa-check text-success"></i></p>
                                                                            <p><?php echo $totalApproved;?></p>
                                                                        </div>
                                                                        <div class="col-md-3" title="Total Denied Leave Requests" style="cursor:pointer;">
                                                                            <p style="font-weight:bold;"><i class="fa fa-times text-danger"></i></p>
                                                                            <p><?php echo $totalDenied;?></p>
                                                                        </div>
                                                                    </div>
                                                                    <div class="col-md-12"><hr></div>
                                                                    <div class="col-md-12">
                                                                        <label>Admin Remarks</label>
                                                                        <p><?php if($row['remarks']==''){echo '<em>N/A</em>';}else{echo $row['remarks'];}?></p>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="modal-footer">
                                                                <button type="button" data-dismiss="modal" style="padding:5px 20px;color:rgb(1,1,1);">Close</button>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            <?php } ?>     
                                            
                                        </td>
                                    </tr>
                                <?php }} ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            <?php } ?>
        </form>    
    </div>
    <script src="../../../assets/js/jquery.min.js"></script>
    <script src="../../../assets/bootstrap/js/bootstrap.min.js"></script>
    <script src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
    <script src="https://cdn.datatables.net/1.10.15/js/dataTables.bootstrap.min.js"></script>
    <script src="../../../assets/js/ebs-simple-login-form.js"></script>
    <script src="../../../assets/js/JLX-Fixed-Nav-on-Scroll.js"></script>
    <script src="../../../assets/js/Profile-Edit.js"></script>
    <script src="../../../assets/js/Sidebar-Menu.js"></script>
    <script src="requests.js"></script>
    
    <script type="text/javascript">
            $(document).ready(function(){
            setInterval(function(){
                $("#notificationCounter").load("include/counter_3.php");
                $("#requestCounter").load("include/counter.php");
                $("#expiredCounter").load("include/counter_2.php");
                $("#expiredLeaveCounter").load("include/counter_2_1.php");
                $("#requestLeaveCounter").load("include/counter_4.php");
            }, 500); /* time in milliseconds (ie 2 seconds)*/
        });
    </script>
</body>
    <script>
        $(document).ready(function(){
            $('#myTable').dataTable();
        });
    </script>
</html>