bagas89/edusync-dashboard-student-faculty-manager
0
1```php2<?php3require_once 'config.php';4 5// Get all students6$students = [];7$query = "SELECT * FROM mahasiswa ORDER BY nama";8$result = $conn->query($query);9if ($result) {10 $students = $result->fetch_all(MYSQLI_ASSOC);11}12?>13 14<!DOCTYPE html>15<html lang="en" class="h-full bg-gray-100">16<head>17 <meta charset="UTF-8">18 <meta name="viewport" content="width=device-width, initial-scale=1.0">19 <title>Student Management | EduSync</title>20 <link rel="stylesheet" href="style.css">21 <script src="https://cdn.tailwindcss.com"></script>22 <script src="https://unpkg.com/feather-icons"></script>23 <script src="components/sidebar.js"></script>24 <script src="components/header.js"></script>25</head>26<body class="h-full">27 <div class="min-h-full">28 <custom-sidebar></custom-sidebar>29 30 <div class="lg:pl-64 flex flex-col">31 <custom-header></custom-header>32 33 <main class="flex-1">34 <div class="py-6">35 <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">36 <div class="flex justify-between items-center mb-6">37 <h1 class="text-2xl font-semibold text-gray-900">Student Management</h1>38 <a href="add_student.php" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700">39 Add New Student40 </a>41 </div>42 43 <div class="bg-white shadow rounded-lg overflow-hidden">44 <div class="overflow-x-auto">45 <table class="min-w-full divide-y divide-gray-200">46 <thead class="bg-gray-50">47 <tr>48 <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">NIM</th>49 <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Name</th>50 <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Gender</th>51 <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Major</th>52 <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>53 <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>54 </tr>55 </thead>56 <tbody class="bg-white divide-y divide-gray-200">57 <?php foreach ($students as $student): ?>58 <tr>59 <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900"><?= htmlspecialchars($student['nim']) ?></td>60 <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500"><?= htmlspecialchars($student['nama']) ?></td>61 <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500"><?= htmlspecialchars($student['jenis_kelamin']) ?></td>62 <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500"><?= htmlspecialchars($student['jurusan']) ?></td>63 <td class="px-6 py-4 whitespace-nowrap">64 <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full 65 <?= $student['status'] === 'Aktif' ? 'bg-green-100 text-green-800' : 66 ($student['status'] === 'Lulus' ? 'bg-blue-100 text-blue-800' : 67 ($student['status'] === 'Cuti' ? 'bg-yellow-100 text-yellow-800' : 'bg-red-100 text-red-800')) ?>">68 <?= htmlspecialchars($student['status']) ?>69 </span>70 </td>71 <td class="px-6 py-4 whitespace-nowrap text-sm font-medium">72 <a href="edit_student.php?id=<?= $student['id_mahasiswa'] ?>" class="text-indigo-600 hover:text-indigo-900 mr-3">Edit</a>73 <a href="delete_student.php?id=<?= $student['id_mahasiswa'] ?>" class="text-red-600 hover:text-red-900" onclick="return confirm('Are you sure?')">Delete</a>74 </td>75 </tr>76 <?php endforeach; ?>77 </tbody>78 </table>79 </div>80 </div>81 </div>82 </div>83 </main>84 </div>85 </div>86 <script>87 feather.replace();88 </script>89</body>90</html>91```