<?php 
include 'db_con_splitrow_users.php';

/* start the session */
session_start();

if(!isset($_SESSION['username'])){ // Jika session username ada berarti dia sudah login   
  echo "<script>  window.location.href='../E-Leave/login.php';</script>"; // Kita Redirect ke halaman welcome.php
}

if (isset($_SESSION['username'])) {       
    $data = mysqli_query($conn,"SELECT * FROM usr_profile WHERE status IN ('I','D') AND user_id ='".$_SESSION['username']."'");
    $cek_usrBaned = mysqli_num_rows($data);

    if($cek_usrBaned > 0){ // found the banned user
       session_destroy(); 
       echo "<script>  window.location.href='../E-Leave/login.php';</script>";
    }

} else {    
//echo "You need to login!";
}

//cek year changed
$getCurrentYear = date("Y");

//get next year
$getNextYear = "SELECT next_year FROM year_date";
$qr_NextYear = $conn->query($getNextYear);

while($row_NextYear = $qr_NextYear->fetch_assoc()) {						
    $rs_NextYear = $row_NextYear['next_year'];                        		
}
//echo "<script type='text/javascript'>alert('{$rs_NextYear}');</script>"; 
//get annual_leave parameter (leave_carried_forward)
$getLCF = "SELECT leave_carried_forward FROM leave_parameter WHERE leave_code='00000' AND status=0";
$qr_LCF = $conn->query($getLCF);

while($row_LCF = $qr_LCF->fetch_assoc()) {						
    $rs_LCF = $row_LCF['leave_carried_forward'];                        		
}

if($getCurrentYear == $rs_NextYear && $rs_LCF == 'No'){
    // Clear Table employee_leave_remain
    $sql  = ("TRUNCATE TABLE employee_leave_remain");
    $query = mysqli_query($conn, $sql);

    // Update table year_date
    $Next_Year = $getCurrentYear + 1;
    $Last_Year = $getCurrentYear - 1;
    $sql1  = ("UPDATE year_date SET last_year = '$Last_Year', current_year = '$getCurrentYear', next_year = '$Next_Year'");
    $query1 = mysqli_query($conn, $sql1);

    //Move Table leave_request to table history_leave_Request
     $sql2  = ("INSERT INTO `history_leave_request` (`req_number`, `leave_code`, `employee_id`, `from_date`, `to_date`, `period`, `description`, `status`, `response`, `approval_employee_id`, `user_id_created`, `date_created`, `user_id_updated`, `date_updated`) 
                SELECT `req_number`, `leave_code`, `employee_id`, `from_date`, `to_date`, `period`, `description`, `status`, `response`, `approval_employee_id`, `user_id_created`, `date_created`, `user_id_updated`, `date_updated` FROM leave_request;");
     $query2 = mysqli_query($conn, $sql2); 
    
    //Clear Table Leave_Request
     $sql3  = ("TRUNCATE TABLE leave_request");
     $query3 = mysqli_query($conn, $sql3); 
     
    //Clear Table Leave_accumulation
     $sql4  = ("TRUNCATE TABLE leave_accumulation");
     $query4 = mysqli_query($conn, $sql4); 
}else if($getCurrentYear == $rs_NextYear && $rs_LCF == 'Yes'){
    // get leave_peryear from leave_parameter
    $sql1  = ("SELECT leave_peryear FROM `leave_parameter` where leave_code = '00000' AND status = 0");
    $query1 = mysqli_query($conn, $sql1);
    while($row1 = mysqli_fetch_assoc($query1)) {
        $leave_peryear = $row1['leave_peryear'];                
    }
    
    // get all leave remain by employee_id
    $sql  = ("SELECT employee.employee_id, leave_remain FROM `employee` LEFT JOIN employee_leave_remain ON employee.employee_id = employee_leave_remain.employee_id where status = 0");
    $query = mysqli_query($conn, $sql);
    while($row = mysqli_fetch_assoc($query)) {
        $employeeID = $row['employee_id'];        
        $leaveRemain = $row['leave_remain'];
        
    // get accumulation from leave_accumulation
    $sql5  = ("SELECT accumulation FROM `leave_accumulation` where employee_id = '$employeeID'");
    $query5 = mysqli_query($conn, $sql5);
    while($row5 = mysqli_fetch_assoc($query5)) {
        $Accumulation = $row5['accumulation'];                
    }    
        
        $total_accumulate = $Accumulation + $leave_peryear;
        //$first_accumulate = $leaveRemain;
        //$first_accumulate = $leaveRemain + $leave_peryear;
        //echo "<script type='text/javascript'>alert('{$total_accumulate}');</script>";
        
    if(is_null($leaveRemain)){$leaveRemain = $leave_peryear;}    
    //if(is_null($leaveRemain)){$leaveRemain = 0;}
    if(is_null($leave_peryear)){$leaveRemain = 0;}        
    
    //Insert or update table leave accumulation
    $sql2  = ("INSERT INTO leave_accumulation (employee_id, accumulation) VALUES('$employeeID', $leaveRemain) ON DUPLICATE KEY UPDATE accumulation = $total_accumulate");
    $query2 = mysqli_query($conn, $sql2); 
    }
     // Clear Table employee_leave_remain
    $sql3  = ("TRUNCATE TABLE employee_leave_remain");
    $query3 = mysqli_query($conn, $sql3);
    
    // Update table year_date
    $Next_Year = $getCurrentYear + 1;
    $Last_Year = $getCurrentYear - 1;
    $sql4  = ("UPDATE year_date SET last_year = '$Last_Year', current_year = '$getCurrentYear', next_year = '$Next_Year'");
    $query4 = mysqli_query($conn, $sql4);
    
    //Move Table leave_request to table history_leave_Request
     $sql6  = ("INSERT INTO `history_leave_request` (`req_number`, `leave_code`, `employee_id`, `from_date`, `to_date`, `period`, `description`, `status`, `response`, `approval_employee_id`, `user_id_created`, `date_created`, `user_id_updated`, `date_updated`) 
                SELECT `req_number`, `leave_code`, `employee_id`, `from_date`, `to_date`, `period`, `description`, `status`, `response`, `approval_employee_id`, `user_id_created`, `date_created`, `user_id_updated`, `date_updated` FROM leave_request;");
     $query6 = mysqli_query($conn, $sql6); 
    
    //Clear Table Leave_Request
     $sql7  = ("TRUNCATE TABLE leave_request");
     $query7 = mysqli_query($conn, $sql7);       
    }       
            
    //echo "<script type='text/javascript'>alert('statis');</script>";
    //echo "<script type='text/javascript'>alert('{$leaveRemain}');</script>";
    //echo "<script type='text/javascript'>alert('{$leave_peryear}');</script>";                  
//end cek year change

$list = "SELECT employee_id FROM usr_profile WHERE user_id ='".$_SESSION['username']."'";
$rs_list = $conn->query($list);

while($row_list = $rs_list->fetch_assoc()) {						
    $list_empID = $row_list['employee_id'];                        		
}
$getname = "SELECT name FROM employee WHERE employee_id ='".$list_empID."'";
$rs_getname = $conn->query($getname);

while($row_getname = $rs_getname->fetch_assoc()) {						
    $list_empName = $row_getname['name'];                        		
}     
?>

<html lang="en">    
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta name="description" content="">
  <meta name="author" content="">
  
  <link rel="stylesheet" href="iconfont/material-icons.css">
  <link rel="stylesheet" href="css/bootstrap.min.css">  
  <link rel="stylesheet" href="iconfont/material-icons.css">
  <!-- Custom styles material-icons-param -->
  <link rel="stylesheet" href="iconfont/material-icons-param.css">  
  
  <!--CSS for mainmenu -->
  <!-- Bootstrap core CSS -->
  <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  <!-- Custom styles for this template -->
  <link href="css/simple-sidebar.css" rel="stylesheet">
  <!-- Custom styles material-icons -->

  <title>Halaman Utama</title>
 
  <style type="text/css">
    body {
        color: #566787;
		background: #f5f5f5;
		font-family: 'Varela Round', sans-serif;
		font-size: 13px;
	}
	.table-wrapper {
        background: #fff;
        padding: 20px 25px;
        margin: 30px 0;
		border-radius: 3px;
        box-shadow: 0 1px 1px rgba(0,0,0,.05);        
    }
	.table-title {        
		padding-bottom: 15px;
		background: #435d7d;
		color: #fff;
		padding: 16px 30px;
		margin: -20px -25px 10px;
		border-radius: 3px 3px 0 0;
    }
    .table-title h2 {
		margin: 5px 0 0;
		font-size: 24px;
	}
	.table-title .btn-group {
		float: right;
	}
	.table-title .btn {
		color: #fff;
		float: right;
		font-size: 13px;
		border: none;
		min-width: 50px;
		border-radius: 2px;
		border: none;
		outline: none !important;
		margin-left: 10px;
	}
	.table-title .btn i {
		float: left;
		font-size: 21px;
		margin-right: 5px;
	}
	.table-title .btn span {
		float: left;
		margin-top: 2px;
	}
    table.table tr th, table.table tr td {
        border-color: #e9e9e9;
		padding: 12px 15px;
		vertical-align: middle;
    }
	table.table tr th:first-child {
		width: 60px;
	}
	table.table tr th:last-child {
		width: 100px;
	}
    table.table-striped tbody tr:nth-of-type(odd) {
    	background-color: #fcfcfc;
	}
	table.table-striped.table-hover tbody tr:hover {
		background: #f5f5f5;
	}
    table.table th i {
        font-size: 13px;
        margin: 0 5px;
        cursor: pointer;
    }	
    table.table td:last-child i {
		opacity: 0.9;
		font-size: 22px;
        margin: 0 5px;
    }
	table.table td a {
		font-weight: bold;
		color: #566787;
		display: inline-block;
		text-decoration: none;
		outline: none !important;
	}
	table.table td a:hover {
		color: #2196F3;
	}
	table.table td a.edit {
        color: #FFC107;       
    }
        
    table.table td a.delete {
        color: #F44336;
    }
    table.table td i {
        font-size: 19px;
    }
	table.table .avatar {
		border-radius: 50%;
		vertical-align: middle;
		margin-right: 10px;
	}
    .pagination {
        float: right;
        margin: 0 0 5px;
    }
    .pagination li a {
        border: none;
        font-size: 13px;
        min-width: 30px;
        min-height: 30px;
        color: #999;
        margin: 0 2px;
        line-height: 30px;
        border-radius: 2px !important;
        text-align: center;
        padding: 0 6px;
    }
    .pagination li a:hover {
        color: #666;
    }	
    .pagination li.active a, .pagination li.active a.page-link {
        background: #03A9F4;
    }
    .pagination li.active a:hover {        
        background: #0397d6;
    }
	.pagination li.disabled i {
        color: #ccc;
    }
    .pagination li i {
        font-size: 16px;
        padding-top: 6px
    }
    .hint-text {
        float: left;
        margin-top: 10px;
        font-size: 13px;
    }    
	/* Custom checkbox */
	.custom-checkbox {
		position: relative;
	}
	.custom-checkbox input[type="checkbox"] {    
		opacity: 0;
		position: absolute;
		margin: 5px 0 0 3px;
		z-index: 9;
	}
	.custom-checkbox label:before{
		width: 18px;
		height: 18px;
	}
	.custom-checkbox label:before {
		content: '';
		margin-right: 10px;
		display: inline-block;
		vertical-align: text-top;
		background: white;
		border: 1px solid #bbb;
		border-radius: 2px;
		box-sizing: border-box;
		z-index: 2;
	}
	.custom-checkbox input[type="checkbox"]:checked + label:after {
		content: '';
		position: absolute;
		left: 6px;
		top: 3px;
		width: 6px;
		height: 11px;
		border: solid #000;
		border-width: 0 3px 3px 0;
		transform: inherit;
		z-index: 3;
		transform: rotateZ(45deg);
	}
	.custom-checkbox input[type="checkbox"]:checked + label:before {
		border-color: #03A9F4;
		background: #03A9F4;
	}
	.custom-checkbox input[type="checkbox"]:checked + label:after {
		border-color: #fff;
	}
	.custom-checkbox input[type="checkbox"]:disabled + label:before {
		color: #b8b8b8;
		cursor: auto;
		box-shadow: none;
		background: #ddd;
	}
	/* Modal styles */
	.modal .modal-dialog {
		max-width: 400px;
	}
	.modal .modal-header, .modal .modal-body, .modal .modal-footer {
		padding: 20px 30px;
	}
	.modal .modal-content {
		border-radius: 3px;
	}
	.modal .modal-footer {
		background: #ecf0f1;
		border-radius: 0 0 3px 3px;
	}
    .modal .modal-title {
        display: inline-block;
    }
	.modal .form-control {
		border-radius: 2px;
		box-shadow: none;
		border-color: #dddddd;
	}
	.modal textarea.form-control {
		resize: vertical;
	}
	.modal .btn {
		border-radius: 2px;
		min-width: 100px;
	}	
	.modal form label {
		font-weight: normal;
	}
        
        div.posisi {
            position: relative;
            left: 152px;
            width: 90%;
            }
</style>

  <script src="../E-Leave/jquery/jquery.min.js"></script>
  <script src="../E-Leave/jquery/bootstrap.min.js"></script>
  <script src="../E-Leave/jquery/jquery-3.4.1.min.js"></script>
    
<script type="text/javascript">
/*    
$(document).ready(function(){
	// Activate tooltip
	$('[data-toggle="tooltip"]').tooltip();	
});
*/    
</script>

<script type="text/javascript">
//alert("myEdit");
$(function(){ //jQuery shortcut for .ready (ensures DOM ready)
 $('.edit').click(function(){  
  var serviceID = this.id;
  //alert(serviceID);
  var dept = $('#dept_'+serviceID).text();
  //alert(dept);
  var desc = $('#desc_'+serviceID).text();
  //alert(desc);
  var levl = $('#levl_'+serviceID).text();
  //alert(levl);
  
  $('#modaldept').val(dept);
  $('#modaldesc').val(desc);
  $('#Id_val').val(serviceID);
 
  if(levl==0){
	$("#editUsersID").prop("checked", true);
  }else{
	$("#editApprovalID").prop("checked", true);
  }

 });
});
</script>

<script type="text/javascript">
//alert("myEdit");
$(function(){ //jQuery shortcut for .ready (ensures DOM ready)
 $('.delete').click(function(){  
  var serviceID = this.id;    
  $('#Id_del').val(serviceID);
 
 });
});
</script>  

<script>
//cek idle user on client side (5 menit)
var timeoutID; 
function setup() {
    this.addEventListener("mousemove", resetTimer, false);
    this.addEventListener("mousedown", resetTimer, false);
    this.addEventListener("keypress", resetTimer, false);
    this.addEventListener("DOMMouseScroll", resetTimer, false);
    this.addEventListener("mousewheel", resetTimer, false);
    this.addEventListener("touchmove", resetTimer, false);
    this.addEventListener("MSPointerMove", resetTimer, false);
 
    startTimer();
}
setup();
 
function startTimer() {
    // wait 5 minutes before calling goInactive
    timeoutID = window.setTimeout(goInactive, 300000);
}
 
function resetTimer(e) {
    window.clearTimeout(timeoutID);
    goActive();
}
 
function goInactive() {
    // do something
    //alert('Idle');
    window.location.href='../E-Leave/logout.php';    
}
 
function goActive() {
    // do something
         
    startTimer();
}    
</script>    


<script type="text/javascript">
    //cek interval setiap 10 menit
         jQuery(document).ready(function(){
             setInterval(function(){
                 jQuery.ajax({
                     type: 'POST',
                     url: '..//E-Leave/activity_upd.php',                     
                     success:function(){
                         //alert("Update Timestamp");
                         //window.location.href='..//E-Leave/index.php';
                         //return true;
                     }
                 });
             }, 600000);
         });
</script>

</head>

<body>

  <div class="d-flex" id="wrapper">

    <!-- Sidebar -->
    <div class="border-right" id="sidebar-wrapper">     
        <div class="list-group list-group-flush">
            <div style=" padding: 0.875rem 1.25rem; font-size: 1.2rem; width: 200px; height: 60px;">
                <h1>Start</h1> 
            </div>
        <button class="dropdown-btn list-group-item list-group-item-action">
                Manage <i class="nav-drop-icon material-icons">keyboard_arrow_down</i>
        </button>
        <div class="dropdown-container" style="display: none;">
            <a href="group.php" class="list-group-item list-group-item-action">Group</a>
            <a href="employee.php" class="list-group-item list-group-item-action">Employee</a>
            <a href="users.php" class="list-group-item list-group-item-action">Users</a>
            <a href="leave_types.php" class="list-group-item list-group-item-action">Leave Types</a>
        </div>
        <button class="dropdown-btn list-group-item list-group-item-action">
                Setting <i class="nav-drop-icon material-icons">keyboard_arrow_down</i>
            </button>
        <div class="dropdown-container" style="display: none;">
            <a href="holiday_date.php" class="list-group-item list-group-item-action">Holiday Date</a>
            <a href="users_permission.php" class="list-group-item list-group-item-action">Users Permission</a>
            <a href="leaves_parameter.php" class="list-group-item list-group-item-action">Leaves Parameter</a>
        </div>
                   
        <a href="leave_request.php" class="list-group-item list-group-item-action bg-light">Leave Request</a>                  
        <a href="leave_approval.php" class="list-group-item list-group-item-action bg-light">Leave Approval</a>
        <a href="audittrail.php" class="list-group-item list-group-item-action bg-light">Audit Trail</a>
        <a href="#" class="list-group-item list-group-item-action bg-light">Report</a>        
      </div>
    </div>
    
<script>
/* Loop through all dropdown buttons to toggle between hiding and showing its dropdown content - This allows the user to have multiple dropdowns without any conflict */
var dropdown = document.getElementsByClassName("dropdown-btn");
var i;

for (i = 0; i < dropdown.length; i++) {
  dropdown[i].addEventListener("click", function() {
  this.classList.toggle("active");
  var dropdownContent = this.nextElementSibling;
  if (dropdownContent.style.display === "block") {
  dropdownContent.style.display = "none";
  } else {
  dropdownContent.style.display = "block";
  }
  });
}
</script>            
    <!-- /#sidebar-wrapper -->

    <!-- Page Content -->
    <div class="posisi">

      <nav class="navbar navbar-expand-lg bg-light border-bottom">
        <button class="btn btn-primary" id="menu-toggle" style="display:none;">Toggle Menu</button>

        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
          <span class="navbar-toggler-icon"></span>
        </button>

        <div class="collapse navbar-collapse" id="navbarSupportedContent">
          <ul class="navbar-nav ml-auto mt-2 mt-lg-0">
            <li class="nav-item active">
              <a class="nav-link">Welcome 
              <?php
                //echo("{$_SESSION['username']}"."<br />");                
                echo $list_empName;
              ?>    
              <span class="sr-only">(current)</span></a>
            </li>            
            <li class="nav-item dropdown">
              <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                <i class="nav-drop-icon material-icons">person_pin</i>
              </a>
              <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
                <a class="dropdown-item" href="#">Profile</a>
                <a class="dropdown-item" href="change_password.php">Change Password</a>
                <div class="dropdown-divider"></div>
                <a class="dropdown-item" href="logout.php">Logout</a>
              </div>
            </li>
          </ul>
        </div>
      </nav>
        
    <!-- /#page-content-wrapper -->    
    <div class="container">
        <div class="table-wrapper" style="display: none;">
            <div class="table-title">
                <div class="row">
                    <div class="col-sm-6">
						<h2>Manage <b>Group</b></h2>
					</div>
					<div class="col-sm-6">
						<a href="#addEmployeeModal" class="btn btn-success" data-toggle="modal"><i class="material-icons">&#xE147;</i> <span>Add New Group</span></a>												
					</div>
                </div>
            </div> 
            <table class="table table-striped table-hover">
                <thead>
                    <tr>			
                        <th>Group Name</th>
                        <th>Description</th>
                        <th>Level</th>
                        <th>Actions</th>
                    </tr>
                </thead>
                <tbody> 
                    <?php 
                            while($row = $rs_result->fetch_assoc()) {						
                            echo '<tr>
                                    <td id="dept_'.$row['ID'].'"  width="30%">'.$row['Department_G'].'</td>
                                    <td id="desc_'.$row['ID'].'" >'.$row['Description'].'</td>
                                    <td id="levl_'.$row['ID'].'"  width="10%">'.$row['Auth_level'].'</td>    
                                    <td>
                                        <a href="#editEmployeeModal" name="editR" class="edit" data-toggle="modal" id="'.$row['ID'].'" onclick="editClick()"><i class="material-icons" data-toggle="tooltip" title="Edit">&#xE254;</i></a>
                                        <a href="#deleteEmployeeModal" class="delete" data-toggle="modal" id="'.$row['ID'].'"><i class="material-icons" data-toggle="tooltip" title="Delete">&#xE872;</i></a>
                                    </td>
                                 </tr>';			
                        }
                    ?>
                </tbody>
            </table>
                <div class="clearfix">
                <div class="hint-text">Showing <b>5</b> out of <b>25</b> entries</div>
                <ul class="pagination">
                <li class="page-item">    
                   <?php 
                        $sql = "SELECT COUNT(ID) AS total FROM ".$datatable;
                        $result = $conn->query($sql);
                        $row = $result->fetch_assoc();
                        $total_pages = ceil($row["total"] / $results_per_page); // calculate total pages with results
  
                    for ($i=1; $i<=$total_pages; $i++) {  // print links for all pages
                        echo "<a href='group.php?page=".$i."'";
                         if ($i==$page)  echo " class='curPage'";
                            echo ">".$i."</a> "; 
                     }; 
                    ?>
                </li>    
                </ul>
            </div>
        </div>
    </div>
	<!-- Add Modal HTML -->
	<div id="addEmployeeModal" class="modal fade">
		<div class="modal-dialog">
			<div class="modal-content">
                            <form method="POST">
					<div class="modal-header">						
						<h4 class="modal-title">Add Group</h4>
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
					</div>
					<div class="modal-body">					
						<div class="form-group">
							<label>Group Name</label>
							<input type="text" class="form-control" name="group_name" required>
						</div>						
						<div class="form-group">
							<label>Description</label>
							<textarea  class="form-control" required name="group_desc"></textarea>
						</div>
						<div class="form-group">
						<fieldset>
                                                    <legend>Authority</legend>
                                                    <label><b>Level</b></label>
                                                    <p>
                                                        <input type = "radio" name = "group_level" id = "UsersID" value = "0" checked = "checked" /> 
                                                        <label for = "sizeSmall">Users</label>
                                                        <input type = "radio" name = "group_level" id = "ApprovalID" value = "1" />
                                                        <label for = "sizeMed">Approval</label>
                                                    </p>
                                                </fieldset>
						</div>					
					</div>
					<div class="modal-footer">
						<input type="button" class="btn btn-default" data-dismiss="modal" value="Cancel">
						<input type="submit" class="btn btn-success" value="Add" name="add_group">
					</div>
				</form>
			</div>
		</div>
	</div>
	<!-- Edit Modal HTML -->
	<div id="editEmployeeModal" class="modal fade">
		<div class="modal-dialog">
			<div class="modal-content">
				<form method="POST">
					<div class="modal-header">						
						<h4 class="modal-title">Edit Group</h4>
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
					</div>
					<div class="modal-body">					
						<div class="form-group">
							<label>Group Name</label>
							<input id="modaldept" type="text" class="form-control" name="group_name_edit" required>
						</div>						
						<div class="form-group">
							<label>Description</label>
							<textarea id="modaldesc" class="form-control" name="group_desc_edit" required></textarea>
						</div>
						<div class="form-group">
                                                    <fieldset>
                                                    <legend>Authority</legend>
                                                        <label><b>Level</b></label>
                                                        <p>
                                                        <input type = "radio" name = "group_level_edit" id = "editUsersID" value = "0"  /> 
                                                        <label for = "sizeSmall">Users</label>
                                                        <input type = "radio" name = "group_level_edit" id = "editApprovalID" value = "1" />
                                                        <label for = "sizeMed">Approval</label>
                                                        </p>
                                                    </fieldset>
						</div>					
					</div>
					<div class="modal-footer">
						<input type="button" class="btn btn-default" data-dismiss="modal" value="Cancel">
						<input type="submit" class="btn btn-info" value="Save" name="group_update">
                                                <input type="hidden" id="Id_val" name="group_id_edit" />
					</div>
				</form>
			</div>
		</div>
	</div>
	<!-- Delete Modal HTML -->
	<div id="deleteEmployeeModal" class="modal fade">
		<div class="modal-dialog">
			<div class="modal-content">
				<form method="POST">
					<div class="modal-header">						
						<h4 class="modal-title">Delete Employee</h4>
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
					</div>
					<div class="modal-body">					
						<p>Are you sure you want to delete these Records?</p>
						<p class="text-warning"><small>This action cannot be undone.</small></p>
					</div>
					<div class="modal-footer">
						<input type="button" class="btn btn-default" data-dismiss="modal" value="Cancel">
						<input type="submit" class="btn btn-danger" value="Delete" name="group_delete">
                                                <input type="hidden" id="Id_del" name="group_id_del" />
					</div>
				</form>
			</div>
		</div>
	</div>        
    </div>

  </div>
  <!-- /#wrapper -->

  <!-- Bootstrap core JavaScript -->
  <script src="vendor/jquery/jquery.min.js"></script>
  <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>

  <!-- Menu Toggle Script -->
  <script>
    $("#menu-toggle").click(function(e) {
      e.preventDefault();
      $("#wrapper").toggleClass("toggled");
    });
  </script>

</body>

</html>
