-
Notifications
You must be signed in to change notification settings - Fork 0
/
laporan.php
70 lines (64 loc) · 1.83 KB
/
laporan.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
<?php
require './includes/config.php';
if (!isset($_SESSION['admin'])) {
header('Location: login.php');
exit;
}
$req = $dbc->prepare("SELECT * FROM pemilihan a INNER JOIN hasil b ON a.id = b.id_pemilihan");
$req->execute();
$pemilihan = $req->fetchAll();
$page_title = 'Laporan';
include './includes/header.php';
?>
<div class="col-md-12">
<div class="page-header text-center">
<h1>Laporan</h1>
</div>
<?php
if ($pemilihan) {
?>
<table class="table table-bordered bg-primary">
<tr>
<th class="col-md-1">No</th>
<th class="col-md-4">Keterangan</th>
<th class="col-md-3">Alternatif</th>
<th class="col-md-2">Nilai Akhir</th>
<th class="col-md-2">Aksi</th>
</tr>
<?php
for($i = 0; $i < count($pemilihan); $i++) {
echo '<tr>
<td>'.($i+1).'</td>
<td>'.$pemilihan[$i]['keterangan'].'</td>
<td>'.$pemilihan[$i]['alternatif'].'</td>
<td>'.$pemilihan[$i]['v'].'</td>
<td>
<a href="detail-laporan.php?id='.$pemilihan[$i]['id'].'" class="btn btn-success">Detail</a>
<a href="hapus-laporan.php?id='.$pemilihan[$i]['id'].'" class="btn btn-danger">Hapus</a>
</td>
</tr>';
}
?>
</table>
<?php
} else {
echo '<div class="well well-lg text-center">
<strong>Tidak ada data yang disimpan.</strong>
</div>';
}
?>
</div>
<script>
$(function() {
$('.btn.btn-danger').click(function(e) {
e.preventDefault();
var konfirmasi = confirm('Yakin ingin dihapus?');
if (konfirmasi == true) {
window.location = this.href;
}
});
});
</script>
<?php
include './includes/footer.php';
?>