-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.php
More file actions
66 lines (65 loc) · 3.28 KB
/
dashboard.php
File metadata and controls
66 lines (65 loc) · 3.28 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
<?php
require_once 'config.php';
checkAuth();
$stmt = $pdo->query("SELECT * FROM visitor_logs ORDER BY entry_time DESC LIMIT 10");
$logs = $stmt->fetchAll();
?>
<!DOCTYPE html>
<html lang="th">
<head>
<meta charset="UTF-8">
<title>แผงควบคุม - ระบบบันทึกเข้าออก</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-gray-50">
<nav class="bg-blue-800 text-white p-4 flex justify-between">
<div class="font-bold">VisitorMS | สวัสดีคุณ <?php echo htmlspecialchars($_SESSION['fullname']); ?></div>
<div>
<a href="dashboard.php" class="px-2">แดชบอร์ด</a>
<?php if(isGuard()): ?>
<a href="checkin.php" class="px-2">บันทึกเข้า</a>
<a href="checkout.php" class="px-2">บันทึกออก</a>
<?php endif; ?>
<?php if(isAdmin()): ?>
<a href="users_manage.php" class="px-2">จัดการสมาชิก</a>
<?php endif; ?>
<a href="logout.php" class="px-2 text-red-300">ออกจากระบบ</a>
</div>
</nav>
<div class="container mx-auto p-6">
<h1 class="text-3xl font-bold mb-6">รายการล่าสุด</h1>
<div class="overflow-x-auto bg-white rounded shadow">
<table class="w-full text-left">
<thead class="bg-gray-200">
<tr>
<th class="p-3">ชื่อ-นามสกุล</th>
<th class="p-3">บัตรประชาชน</th>
<th class="p-3">เวลาเข้า</th>
<th class="p-3">เวลาออก</th>
<th class="p-3">สถานะ</th>
<th class="p-3">การกระทำ</th>
</tr>
</thead>
<tbody>
<?php foreach($logs as $log): ?>
<tr class="border-b">
<td class="p-3"><?php echo htmlspecialchars($log['fullname']); ?></td>
<td class="p-3"><?php echo htmlspecialchars($log['id_card']); ?></td>
<td class="p-3"><?php echo htmlspecialchars($log['entry_time']); ?></td>
<td class="p-3"><?php echo $log['exit_time'] ? htmlspecialchars($log['exit_time']) : '-'; ?></td>
<td class="p-3">
<span class="px-2 py-1 rounded text-xs <?php echo $log['status'] == 'in' ? 'bg-green-100 text-green-700' : 'bg-gray-100 text-gray-700'; ?>">
<?php echo $log['status'] == 'in' ? 'กำลังอยู่ในบริษัท' : 'ออกแล้ว'; ?>
</span>
</td>
<td class="p-3">
<a href="print_ticket.php?id=<?php echo (int)$log['id']; ?>" target="_blank" class="text-blue-500">พิมพ์ใบเข้า (A5)</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</body>
</html>