-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist_emp.php
More file actions
143 lines (120 loc) · 5.45 KB
/
list_emp.php
File metadata and controls
143 lines (120 loc) · 5.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
require_once("DBConnection.php");
session_start();
if(!isset($_SESSION["sess_user"])){
header("Location: index.php");
}
else{
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@300&display=swap" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.21.1/axios.min.js"></script>
<link rel="stylesheet" href="css/style.css">
<title>Admin Panel</title>
<style>
h1 {
text-align: center;
font-size: 2.5em;
font-weight: bold;
padding-top: 1em;
}
.mycontainer {
width: 90%;
margin: 1.5rem auto;
min-height: 60vh;
}
.mycontainer table {
margin: 1.5rem auto;
}
</style>
</head>
<body>
<nav class="navbar header-nav navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="admin.php">Online Leave Application</a>
<!-- <button class="btn-default" onclick="window.location.href='leavehist.php';">Leave History</button> </div> -->
<!-- <nav class="nav navbar-right">
<a class="nav-link active" href="#">Active</a>
</nav>
<button id="logout" onclick="window.location.href='logout.php';">Logout</button> </div> -->
<ul class="nav justify-content-end">
<li class="nav-item">
<a class="nav-link" href="list_emp.php" style="color:white;">View Employees <span class="badge badge-pill" style="background-color:#2196f3;"><?php include('count_emp.php');?></span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="leave_history.php" style="color:white;">View Leave History</a>
</li>
<li class="nav-item">
<button id="logout" onclick="window.location.href='logout.php';">Logout</button> </div>
</li>
</ul>
</nav>
<h1>Admin Panel - Registered Employees</h1>
<div class="mycontainer">
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped">
<thead>
<th>#</th>
<th>Username</th>
<th>Fullname</th>
<th>Email</th>
<th>Department</th>
<th>Gender</th>
<th>City</th>
<th>Contact</th>
<th>Action</th>
</thead>
<tbody>
<!-- loading all leave applications of the user -->
<?php
$leaves = mysqli_query($conn,"SELECT * FROM users WHERE type = 'Employee'");
if($leaves){
$numrow = mysqli_num_rows($leaves);
if($numrow!=0){
$cnt=1;
while($row1 = mysqli_fetch_array($leaves)){
echo "<tr>
<td>$cnt</td>
<td>{$row1['name']}</td>
<td>{$row1['fullname']}</td>
<td>{$row1['email']}</td>
<td>{$row1['department']}</td>
<td>{$row1['gender']}</td>
<td>{$row1['city']}</td>
<td>{$row1['phone']}</td>
<td><a href=\"delete_emp.php?id={$row1['id']}\"><button class='btn-danger btn-sm' >Delete</button></a></td>
</tr>";
$cnt++; }
} else {
echo"<tr class='text-center'><td colspan='12'>YOU DON'T HAVE ANY LEAVE HISTORY! PLEASE APPLY TO VIEW YOUR STATUS HERE!</td></tr>";
}
}
else{
echo "Query Error : " . "SELECT descr,status FROM leaves WHERE eid='".$_SESSION['sess_eid']."'" . "<br>" . mysqli_error($conn);;
}
?>
</tbody>
</table>
</div>
</div>
<footer class="footer navbar navbar-expand-lg navbar-light bg-light" style="color:white;">
<div>
<p class="text-center">© <?php echo date("Y"); ?> - Online Leave Application</p>
<p class="text-center">Developed By Issa Oderinde</p>
</div>
</footer>
</body>
</html>
<?php
}
ini_set('display_errors', true);
error_reporting(E_ALL);
?>