-
Notifications
You must be signed in to change notification settings - Fork 0
/
tabeladmin.php
159 lines (146 loc) · 6.9 KB
/
tabeladmin.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
<?php
// Memanggil atau membutuhkan file function.php
require 'koneksi.php';
// Menampilkan semua data dari table mahasiswa berdasarkan nim secara Descending
$siswa = query("SELECT * FROM mahasiswa ORDER BY nim DESC");
?>
<!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">
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Data Tables -->
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.23/css/dataTables.bootstrap5.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<title>FTI UNMER</title>
</head>
<body>
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark ">
<div class="container">
<a class="navbar-brand" href="halaman_admin.php">Navbar</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link" aria-current="page" href="halaman_admin.php">Home</a>
<li class="nav-item">
<a class="nav-link" href="tabeladmin.php">Tabel Absensi</a>
</li>
<li class="nav-item">
<a class="nav-link" href="logout.php" tabindex="-1" aria-disabled="true">Log out</a>
</li>
</ul>
<form class="d-flex">
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success" type="submit">Search</button>
</form>
</div>
</div>
</nav>
<!-- Close Navbar -->
<!-- Container -->
<div class="container">
<div class="row my-2">
<div class="col-md">
<h3 class="text-center fw-bold text-uppercase">Data Mahasiswa FTI</h3>
<hr>
</div>
</div>
<div class="row my-2">
<div class="col-md">
<a href="addDataadmin.php" class="btn btn-primary"><i class="bi bi-person-plus-fill"></i> Tambah Data</a>
<a href="export.php" target="_blank" class="btn btn-success ms-1"><i class="bi bi-file-earmark-spreadsheet-fill"></i> Ekspor ke Excel</a>
</div>
</div>
<div class="row my-3">
<div class="col-md">
<table id="data" class="table table-striped table-responsive table-hover text-center" style="width:100%">
<thead class="table-dark">
<tr>
<th>No.</th>
<th>Nama</th>
<th>NIM</th>
<th>Kelas</th>
<th>Jurusan</th>
<th>Jenis Kelamin</th>
<th>Keterangan</th>
</tr>
</thead>
<tbody>
<?php $no = 1; ?>
<?php foreach ($siswa as $row) : ?>
<tr>
<td><?= $no++; ?></td>
<td><?= $row['nama']; ?></td>
<td><?= $row['nim']; ?></td>
<td><?= $row['kelas']; ?></td>
<td><?= $row['jurusan']; ?></td>
<td><?= $row['jk']; ?></td>
<td>
<button class="btn btn-success btn-sm text-white detail" data-id="<?= $row['nim']; ?>" style="font-weight: 600;"><i class="bi bi-info-circle-fill"></i> Detail</button> |
<a href="ubah.php?nim=<?= $row['nim']; ?>" class="btn btn-warning btn-sm" style="font-weight: 600;"><i class="bi bi-pencil-square"></i> Ubah</a> |
<a href="hapus.php?nim=<?= $row['nim']; ?>" class="btn btn-danger btn-sm" style="font-weight: 600;" onclick="return confirm('Apakah anda yakin ingin menghapus data <?= $row['nama']; ?> ?');"><i class="bi bi-trash-fill"></i> Hapus</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
<!-- Close Container -->
<!-- Modal Detail Data -->
<div class="modal fade" id="detail" tabindex="-1" aria-labelledby="detail" aria-hidden="true">
<div class="modal-dialog modal-dialog-scrollable modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title fw-bold text-uppercase" id="detail">Detail Data Mahasiswa</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body text-center" id="detail-siswa">
</div>
</div>
</div>
</div>
<!-- Close Modal Detail Data -->
<!-- Bootstrap -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0" crossorigin="anonymous"></script>
<!-- Data Tables -->
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script src="https://cdn.datatables.net/1.10.23/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.23/js/dataTables.bootstrap5.min.js"></script>
<script>
$(document).ready(function() {
// Fungsi Table
$('#data').DataTable();
// Fungsi Table
// Fungsi Detail
$('.detail').click(function() {
var dataSiswa = $(this).attr("data-id");
$.ajax({
url: "detail.php",
method: "post",
data: {
dataSiswa,
dataSiswa
},
success: function(data) {
$('#detail-siswa').html(data);
$('#detail').modal("show");
}
});
});
// Fungsi Detail
});
</script>
</body>
</html>