-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnavAdmin.php
604 lines (534 loc) · 17.4 KB
/
navAdmin.php
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
<?php
$sql = "SELECT first, second FROM settings WHERE id = 2";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
$row = $result->fetch_assoc();
$welcomeText = $row['first'];
$instructionText = $row['second'];
} else {
$welcomeText = "Kementerian Perdagangan";
$instructionText = "Direktorat Bahan Pokok dan Barang Penting";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="fontawesome/css/fontawesome.min.css">
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<link rel="shortcut icon" href="image\kementrian.png">
<link rel="stylesheet" href="css/kita.css">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&family=Roboto:wght@300;400;700&display=swap" rel="stylesheet">
</head>
<style>
body {
background-color: #fafafa;
color: #484b6a;
font-family: 'Roboto', sans-serif;
}
.navbar {
position: fixed;
top: 0;
width: 100%;
z-index: 1001;
background-color: #ffffff;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
padding: 0.5rem 1rem;
transition: all 0.3s ease;
}
.header {
position: fixed;
background-color: #ffffff;
width: 100%;
padding: 0.5rem 1rem;
height: auto;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
z-index: 1002;
}
.kemendag {
position: absolute;
top: 10px;
left: 10px;
z-index: 1003;
color: #484b6a;
font-size: 22px;
font-family: 'Poppins', sans-serif;
font-weight: 600;
}
.sidebar {
position: fixed;
left: 0;
top: 0;
bottom: 0;
width: 80px;
background-color: #ffffff;
border-right: 1px solid rgba(0, 79, 159, 0.1);
z-index: 1000;
box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
padding-top: 60px;
display: flex;
flex-direction: column;
align-items: center;
transition: width 0.2s ease;
padding-bottom: 40px;
overflow-x: hidden;
}
.sidebar.expanded {
width: 200px;
}
.icon-container {
width: 60px;
height: 60px;
border-radius: 15px;
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 20px;
margin-top: 50px;
transition: background-color 0.2s ease, color 0.2s ease;
cursor: pointer;
color: #004F9F;
/* Default icon color */
position: relative;
overflow: hidden;
}
.icon-container.active {
color: #ffffff;
/* Color when active */
background-color: #004F9F;
/* Background color when active */
}
.icon-container:hover {
background-color: rgba(0, 79, 159, 0.1);
color: #004F9F;
}
.container-fluid {
max-width: 1400px;
margin: 0 auto;
padding-right: 15px;
margin-left: 80px;
transition: margin-left 0.3s ease;
}
.container-fluid.expanded {
margin-left: 220px;
}
.foto {
height: 45px;
width: auto;
filter: drop-shadow(1px 1px 20px rgba(0, 255, 238, 0.5));
transition: transform 0.3s ease;
margin-right: 15px;
}
.foto:hover {
transform: scale(1.05);
}
.nama {
color: #333333;
font-size: 16px;
font-weight: 500;
margin: 0;
padding: 0 15px;
font-family: 'Poppins', sans-serif;
}
.logout {
color: #dc3545;
text-decoration: none;
font-size: 14px;
font-weight: 500;
padding: 8px 20px;
border-radius: 5px;
transition: all 0.3s ease;
border: 1px solid #dc3545;
}
.logout:hover {
background-color: #dc3545;
color: #ffffff;
transform: translateY(-2px);
box-shadow: 0 2px 5px rgba(220, 53, 69, 0.2);
}
.separator {
border-left: 1px solid #484b6a;
height: 25px;
margin: 0 15px;
opacity: 0.3;
}
.submenu {
opacity: 0;
display: none;
flex-direction: column;
align-items: flex-start;
padding: 5px;
transition: all 0.3s ease;
max-height: 0;
overflow: hidden;
transform: translateY(-10px);
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.submenu-active {
display: flex;
max-height: 300px;
opacity: 1;
transform: translateY(0);
}
.submenu ul {
list-style-type: none;
padding: 0;
margin: 0;
width: 100%;
}
.submenu li {
width: 100%;
margin: 2px 0;
}
.submenu a {
color: #004F9F;
text-decoration: none;
padding: 10px 15px;
display: block;
border-radius: 8px;
transition: all 0.2s ease;
font-size: 14px;
width: 100%;
position: relative;
background: linear-gradient(90deg, rgba(0, 79, 159, 0) 0%, rgba(0, 79, 159, 0) 100%);
background-size: 200% 100%;
background-position: 100% 0;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.submenu a:hover {
color: #004F9F;
background-color: rgba(0, 79, 159, 0.08);
transform: translateX(5px);
background-position: 0 0;
padding-left: 20px;
}
.sidebar {
display: flex;
flex-direction: column;
padding-bottom: 20px;
/* Nambahin padding di bawah */
}
.spacer {
flex-grow: 1;
}
.sidebar .icon-container:last-child {
margin-bottom: 10px;
/* Kurangin margin bawah */
}
.modal {
display: none;
position: fixed;
z-index: 999999999999999;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.4);
}
.modal-content-p {
background-color: #fefefe;
margin: 15% auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
max-width: 500px;
}
.modal-content-p input,
.modal-content-p textarea {
width: 100%;
margin-bottom: 10px;
padding: 5px;
}
.button-group {
text-align: right;
}
.button-group button {
margin-left: 10px;
}
button {
background-color: #E7E8D8;
padding: 10px;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #9394a5;
}
.container-fluid {
display: flex;
justify-content: space-between;
align-items: center;
}
.foto {
width: 50px;
/* Sesuaiin ukurannya */
height: auto;
margin-right: 10px;
margin-left: 10px;
}
.kemendag-text {
display: flex;
flex-direction: column;
}
.kemendag-text h2 {
color: #004F9F;
font-size: 18px;
margin: 0;
font-family: 'Poppins', sans-serif;
font-weight: 600;
}
.kemendag-text p {
color: #2E8B57;
font-size: 14px;
margin: 0;
font-family: 'Poppins', sans-serif;
font-weight: 400;
}
.navbar-brand {
display: flex;
align-items: center;
}
.navbar-brand img {
margin-right: 10px;
}
.icon-container::after {
content: '';
position: absolute;
width: 100%;
height: 100%;
background: rgba(0, 79, 159, 0.08);
border-radius: 15px;
top: 0;
left: -100%;
transition: all 0.3s ease;
}
.icon-container:hover::after {
left: 0;
}
/* Animasi untuk icon container */
.icon-container {
position: relative;
overflow: hidden;
}
.icon-container::after {
content: '';
position: absolute;
width: 100%;
height: 100%;
background: rgba(0, 79, 159, 0.08);
border-radius: 15px;
top: 0;
left: -100%;
transition: all 0.3s ease;
}
.icon-container:hover::after {
left: 0;
}
</style>
<body>
<header>
<nav class="navbar navbar-expand navbar-grey bg-grey topbar mb-4 static-top shadow header">
<div class="container-fluid">
<div class="d-flex align-items-center">
<img class="foto" src="image\kementrian.png" alt="">
<div class="kemendag-text">
<h2><?php echo htmlspecialchars($welcomeText); ?></h2>
<p><?php echo htmlspecialchars($instructionText); ?></p>
</div>
</div>
<div class="d-flex align-items-center ml-auto">
<h1 class="nama"><?php echo htmlspecialchars($_SESSION['nama']); ?></h1>
<div class="separator"></div>
<a class="logout" href="logout.php">Log Out</a>
</div>
</div>
</nav>
</header>
<div class="sidebar">
<div class="icon-container" onclick="window.location.href='admin.php'">
<i class="fa-solid fa-house"></i>
</div>
<div class="icon-container" onclick="toggleSubmenu('submenu-manage', this)">
<i class="fa-solid fa-pen-to-square"></i>
</div>
<div class="submenu" id="submenu-manage">
<ul>
<li><a href="homeAdmin.php">Data Absen</a></li>
<li><a href="manage-admin.php">Data Siswa</a></li>
<li><a href="manage-guru.php">Persetujuan Magang</a></li>
<li><a href="manage-sekolah.php">Data Sekolah</a></li>
</ul>
</div>
<div class="icon-container" onclick="toggleSubmenu('submenu-auth', this)">
<i class="fa-solid fa-key"></i>
</div>
<div class="submenu" id="submenu-auth">
<ul>
<li><a href="auth-admin.php">Manage Auth</a></li>
</ul>
</div>
<div class="spacer"></div>
<div class="icon-container" onclick="toggleSubmenu('submenu-settings', this)">
<i class="fa-solid fa-gear"></i>
</div>
<div class="submenu" id="submenu-settings">
<ul>
<li><a href="#" onclick="openSettingsModal()">Login Layout</a></li>
<li><a href="#" onclick="openEditAdminLayoutModal()">Admin Layout</a></li>
</ul>
</div>
</div>
<div id="settingsModal" class="modal">
<div class="modal-content-p">
<h2>Settings</h2>
<form id="settingsForm">
<input type="text" id="first" name="first" placeholder="First">
<input type="text" id="second" name="second" placeholder="Second">
<textarea id="description" name="description" placeholder="Description"></textarea>
<div class="button-group">
<button type="submit">Save</button>
<button type="button" onclick="closeSettingsModal()">Cancel</button>
</div>
</form>
</div>
</div>
<div id="editAdminLayoutModal" class="modal">
<div class="modal-content-p">
<h2>Edit Admin Layout</h2>
<form id="editAdminLayoutForm">
<input type="text" id="editAdminWelcome" name="first" placeholder="Welcome Text">
<input type="text" id="editAdminInstruction" name="second" placeholder="Instruction Text">
<textarea id="editAdminDescription" name="description" placeholder="Description"></textarea>
<div class="button-group">
<button type="submit">Simpan</button>
<button type="button" onclick="closeEditAdminLayoutModal()">Batal</button>
</div>
</form>
</div>
</div>
<script src="bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="fontawesome/js/all.min.js"></script>
<script>
function toggleSubmenu(id, clickedIcon) {
const submenu = document.getElementById(id);
const sidebar = document.querySelector('.sidebar');
const allIcons = document.querySelectorAll('.icon-container');
if (submenu.classList.contains('submenu-active')) {
submenu.classList.remove('submenu-active');
sidebar.classList.remove('expanded');
setTimeout(() => {
submenu.style.display = 'none';
}, 500);
clickedIcon.classList.remove('active');
} else {
const activeSubmenus = document.querySelectorAll('.submenu-active');
activeSubmenus.forEach(sub => {
sub.classList.remove('submenu-active');
sub.style.display = 'none';
});
allIcons.forEach(icon => {
icon.classList.remove('active');
});
submenu.style.display = 'flex';
setTimeout(() => {
submenu.classList.add('submenu-active');
sidebar.classList.add('expanded');
}, 10);
clickedIcon.classList.add('active');
}
}
function openSettingsModal() {
document.getElementById('settingsModal').style.display = 'block';
loadSettings();
}
function closeSettingsModal() {
document.getElementById('settingsModal').style.display = 'none';
}
function loadSettings() {
fetch('get_settings.php')
.then(response => response.json())
.then(data => {
document.getElementById('first').value = data.first;
document.getElementById('second').value = data.second;
document.getElementById('description').value = data.description;
});
}
document.getElementById('settingsForm').addEventListener('submit', function(e) {
e.preventDefault();
const formData = new FormData(this);
fetch('update_settings.php', {
method: 'POST',
body: formData
})
.then(response => response.json())
.then(data => {
if (data.success) {
Swal.fire({
icon: 'success',
title: 'Mantap!',
text: 'Pengaturan berhasil diperbarui!'
}).then(() => {
closeSettingsModal();
});
} else {
Swal.fire({
icon: 'error',
title: 'Waduh...',
text: 'Ada masalah nih pas update pengaturan'
});
}
});
});
function openEditAdminLayoutModal() {
document.getElementById('editAdminLayoutModal').style.display = 'block';
loadAdminLayoutData();
}
function closeEditAdminLayoutModal() {
document.getElementById('editAdminLayoutModal').style.display = 'none';
}
function loadAdminLayoutData() {
fetch('get_data.php?id=2')
.then(response => response.json())
.then(data => {
document.getElementById('editAdminWelcome').value = data.first;
document.getElementById('editAdminInstruction').value = data.second;
document.getElementById('editAdminDescription').value = data.description;
});
}
document.getElementById('editAdminLayoutForm').addEventListener('submit', function(e) {
e.preventDefault();
const formData = new FormData(this);
formData.append('id', 2);
fetch('update_data.php', {
method: 'POST',
body: formData
})
.then(response => response.json())
.then(data => {
if (data.success) {
Swal.fire({
icon: 'success',
title: 'Mantap!',
text: 'Layout admin udah diupdate nih!'
}).then(() => {
closeEditAdminLayoutModal();
location.reload();
});
} else {
Swal.fire({
icon: 'error',
title: 'Duh...',
text: 'Gagal update layout admin. Coba lagi deh!'
});
}
});
});
</script>
</body>
</html>
</html>