-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dosen.php
115 lines (106 loc) · 5.7 KB
/
Dosen.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
<?php
require_once './App.php';
mustLogin();
mustFullAuthorizedInRoles("admin");
?>
<?php include('./Layouts/Header.php'); ?>
<div class="w-full flex flex-col sm:flex-row flex-grow overflow-hidden">
<?php include('./Layouts/Navigation.php'); ?>
<main role="main" class="w-full h-full flex-grow p-3 overflow-auto mt-4">
<h1 class="text-3xl md:text-5xl font-extrabold mb-5" id="home">Data Dosen</h1>
<?php $dataDosen = $dosenService->findAll() ?>
<div class="container">
<?php if (isset($_COOKIE['error']) && $_COOKIE['error'] != 'empty') : ?>
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative mb-5" id="div-error" role="alert">
<strong class="font-bold">Error!</strong>
<span class="block sm:inline"><?= $_COOKIE['error'] ?></span>
<span class="absolute top-0 bottom-0 right-0 px-4 py-3">
<script>
setTimeout(function() {
document.querySelector('#div-error').remove();
}, 2000);
</script>
</span>
</div>
<?php endif; ?>
<?php if (isset($_COOKIE['success']) && $_COOKIE['success'] != 'empty') : ?>
<div class="bg-red-100 border border-green-500 text-green-700 px-4 py-3 rounded relative mb-5" role="alert">
<strong class="font-bold">Sukses!</strong>
<span class="block sm:inline"><?= $_COOKIE['success'] ?></span>
<span class="absolute top-0 bottom-0 right-0 px-4 py-3">
<script>
setTimeout(function() {
document.querySelector('.bg-red-100').remove();
}, 2000);
</script>
</span>
</div>
<?php endif; ?>
<script>
document.cookie = 'error=empty';
document.cookie = 'success=empty';
</script>
<div class="flex mb-5">
<a href="./DosenPageTambahData.php" class="bg-blue-500 hover:bg-blue-700 text-slate-50 font-bold py-2 px-3 rounded">
Tambah Data
</a>
</div>
<?php if (count($dataDosen) == 0) { ?>
<div class="bg-green-200 text-slate-900 px-4 py-3 rounded relative mb-5 w-2/3" id="div-error" role="alert">
<span class="block sm:inline">Ups! Data Kosong</span>
</div>
<?php } else { ?>
<div class="table-responsive">
<table class="table-auto">
<thead>
<tr>
<th class="px-4 py-2">No</th>
<th class="px-4 py-2">NIP</th>
<th class="px-4 py-2">Nama Depan</th>
<th class="px-4 py-2">Nama Belakang</th>
<th class="px-4 py-2">Email</th>
<th class="px-4 py-2">Jenis Kelamin</th>
<th class="px-4 py-2">No Telp</th>
<th class="px-4 py-2">No HP</th>
<th class="px-4 py-2">Golongan</th>
<th class="px-4 py-2">Status</th>
<th class="px-4 py-2">Alamat</th>
<th class="px-4 py-2">Aksi</th>
</tr>
</thead>
<tbody>
<?php
$no = 1;
foreach ($dataDosen as $dosen) : ?>
<tr>
<td class="border px-4 py-2"><?= $no++ ?></td>
<td class="border px-4 py-2"><?= $dosen->nip ?></td>
<td class="border px-4 py-2"><?= $dosen->namaDepan ?></td>
<td class="border px-4 py-2"><?= $dosen->namaBelakang ?></td>
<td class="border px-4 py-2"><?= $dosen->email ?></td>
<td class="border px-4 py-2"><?= $dosen->jenisKelamin ?></td>
<td class="border px-4 py-2"><?= $dosen->noTelp ?></td>
<td class="border px-4 py-2"><?= $dosen->noHP ?></td>
<td class="border px-4 py-2"><?= $dosen->golonganPNS ?></td>
<td class="border px-4 py-2"><?= $dosen->status ?></td>
<td class="border px-4 py-2"><?= $dosen->alamat ?></td>
<td class="border px-4 py-2">
<div class="flex">
<a href="./DosenPageEditData.php?id=<?= $dosen->id ?>" class="bg-green-500 hover:bg-green-700 text-slate-50 font-bold py-2 px-3 rounded mr-2">
Edit
</a>
<a href="./DosenProsesData.php?act=delete&id=<?= $dosen->id ?>" class="bg-red-500 hover:bg-red-700 text-slate-50 font-bold py-2 px-3 rounded">
Hapus
</a>
</div>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php } ?>
</div>
</main>
</div>
<?php include('./Layouts/Footer.php'); ?>