-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdataset.php
More file actions
136 lines (121 loc) 路 4.33 KB
/
Copy pathdataset.php
File metadata and controls
136 lines (121 loc) 路 4.33 KB
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
<!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">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.2/css/bootstrap.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.12.1/css/dataTables.bootstrap4.min.css">
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script src="https://cdn.datatables.net/1.12.1/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.12.1/js/dataTables.bootstrap4.min.js"></script>
<!-- Sweetalert -->
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10.15.7/dist/sweetalert2.all.min.js"></script>
<title>Dataset | List Kata</title>
<style>
@import url('https://cdn-uicons.flaticon.com/uicons-bold-rounded/css/uicons-bold-rounded.css');
@import url('https://cdn-uicons.flaticon.com/uicons-bold-straight/css/uicons-bold-straight.css');
body{
background-color: #F0F0F0;
}
.table-wrapper{
padding: 20px;
}
.back{
background-color: #289cfc;
color: #fff;
border-radius: 50%;
border: none;
cursor: pointer;
padding: 11px 14px;
margin-bottom: 20px;
}
.back:focus{
outline: none;
}
</style>
</head>
<!-- Menampilkan list kata pada tabel -->
<body>
<section class="py-2 my-3">
<div class="container">
<div class="bg-white" style="border-radius: 10px;">
<div class="container-xl">
<div class="table-responsive">
<div class="table-wrapper">
<div><h2>Dataset <b>List Kata</b></h2></div>
<br>
<table id="example" class="table table-striped table-bordered">
<thead>
<tr>
<th>Indonesia</th>
<th>Sumbawa</th>
<th>Keterangan</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
include 'connection.php';
$translate = mysqli_query($con, "SELECT * FROM translate");
while($row = mysqli_fetch_array($translate))
{ ?>
<tr>
<td><?php echo $row['indonesia'] ?></td>
<td><?php echo $row['sumbawa'] ?></td>
<td><?php echo $row['keterangan'] ?></td>
<td><a href="delete.php?id=<?php echo $row['id']; ?>" class="btn btn-sm btn-danger alert_notif">Delete <i class="fi fi-bs-trash"></i></a></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Pesan sukses sweetalert -->
<?php if(@$_SESSION['sukses']){ ?>
<script>
Swal.fire({
icon: 'success',
title: 'Sukses',
text: 'data berhasil dihapus',
timer: 3000,
showConfirmButton: false
})
</script>
<?php unset($_SESSION['sukses']); } ?>
<!-- Script konfirmasi hapus data dengan sweetalert -->
<script>
$('.alert_notif').on('click',function(){
var getLink = $(this).attr('href');
Swal.fire({
title: "Yakin hapus data?",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#d33',
confirmButtonText: 'Ya',
cancelButtonColor: '#3085d6',
cancelButtonText: "Batal"
}).then(result => {
//Jika klik ya maka arahkan ke delete.php
if(result.isConfirmed){
window.location.href = getLink
}
})
return false;
});
</script>
<!-- Script untuk datatable -->
<script>
$(document).ready(function () {
$('#example').DataTable();
});
</script>
<center>
<a href="home.php"><button class="back"><i class="fi fi-br-arrow-left"></i></button></a>
</center>
</body>
</html>