-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathadmin_dashboard.php
More file actions
114 lines (108 loc) · 4.07 KB
/
Copy pathadmin_dashboard.php
File metadata and controls
114 lines (108 loc) · 4.07 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
<?php
session_start();
// Memeriksa apakah admin sudah login, jika tidak, redirect ke halaman login
if (!isset($_SESSION['admin_logged_in']) || $_SESSION['admin_logged_in'] !== true) {
header('Location: admin_login.php');
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Admin Dashboard</title>
<!-- Menyertakan Bootstrap CSS -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<!-- Menyertakan GSAP -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.7.1/gsap.min.js"></script>
<style>
body {
background-color: #f8f9fa;
}
.card {
opacity: 0;
}
</style>
</head>
<body>
<div class="container mt-5">
<div class="row">
<div class="col-md-12">
<div class="d-flex justify-content-between align-items-center mb-3">
<!-- Menampilkan pesan selamat datang dengan nama admin -->
<h2 class="card-title">Selamat Datang, <?php echo $_SESSION['admin_username']; ?></h2>
<div>
<!-- Tombol untuk mengganti tema -->
<button id="themeSwitcher" class="btn btn-secondary">Switch Theme</button>
</div>
</div>
<div class="card">
<div class="card-header bg-primary text-white">
<h2 class="card-title">Dashboard</h2>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-6">
<!-- Tombol untuk mengelola unit -->
<a href="admin_unit.php" class="btn btn-primary btn-block">Kelola Unit</a>
</div>
<div class="col-md-6">
<!-- Tombol untuk logout -->
<a href="admin_logout.php" class="btn btn-danger btn-block">Logout</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Menyertakan Bootstrap JS dan dependensi -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.4/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script>
// Animasi GSAP untuk kartu
gsap.to(".card", {duration: 1, opacity: 1, y: -20, ease: "power2.out"});
// Pengaturan tema
const themeSwitcher = document.getElementById('themeSwitcher');
const currentTheme = localStorage.getItem('theme') || 'system';
const applyTheme = (theme) => {
document.body.classList.remove('light', 'dark');
if (theme === 'system') {
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
document.body.classList.add(prefersDark ? 'dark' : 'light');
} else {
document.body.classList.add(theme);
}
};
// Event listener untuk mengganti tema
themeSwitcher.addEventListener('click', () => {
let newTheme;
if (currentTheme === 'light') {
newTheme = 'dark';
} else if (currentTheme === 'dark') {
newTheme = 'system';
} else {
newTheme = 'light';
}
localStorage.setItem('theme', newTheme);
applyTheme(newTheme);
});
// Menerapkan tema saat ini
applyTheme(currentTheme);
</script>
<style>
body.light {
background-color: #f8f9fa;
color: #212529;
}
body.dark {
background-color: #212529;
color: #f8f9fa;
}
.card {
opacity: 0;
}
</style>
</body>
</html>