Replace all confirmation dialogs with SweetAlert2
- Replace native confirm() with SweetAlert2 for better UX - Add custom confirmation functions for logout and delete actions - Fix HTML syntax errors (</> to </a>) in all data tables - Use consistent styling with cancel/confirm buttons - All confirmations now have 'Konfirmasi Hapus'/'Konfirmasi Logout' titles
This commit is contained in:
@@ -56,10 +56,10 @@
|
||||
class="btn btn-success btn-sm">
|
||||
<i class="fa fa-edit"></i>
|
||||
</a>
|
||||
<a href="?page=del-datang&kode=<?php echo $data['id_datang']; ?>" onclick="return confirm('Apakah anda yakin hapus data ini ?')"
|
||||
<a href="?page=del-datang&kode=<?php echo $data['id_datang']; ?>" onclick="confirmDelete(event)"
|
||||
title="Hapus" class="btn btn-danger btn-sm">
|
||||
<i class="fa fa-trash"></i>
|
||||
</>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -68,7 +68,26 @@
|
||||
?>
|
||||
</tbody>
|
||||
</tfoot>
|
||||
</table>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.card-body -->
|
||||
<script>
|
||||
function confirmDelete(event) {
|
||||
event.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Konfirmasi Hapus',
|
||||
text: 'Apakah Anda yakin ingin menghapus data ini?',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#d33',
|
||||
cancelButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Ya, Hapus',
|
||||
cancelButtonText: 'Batal'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
window.location.href = event.currentTarget.href;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@@ -125,7 +125,7 @@
|
||||
<?php echo $data['hubungan']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<a href="?page=del-anggota&kode=<?php echo $data['id_anggota']; ?>" onclick="return confirm('Apakah anda yakin hapus data ini ?')"
|
||||
<a href="?page=del-anggota&kode=<?php echo $data['id_anggota']; ?>" onclick="confirmDelete(event)"
|
||||
title="Hapus" class="btn btn-danger btn-sm">
|
||||
<i class="fa fa-trash"></i>
|
||||
</a>
|
||||
@@ -140,6 +140,25 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function confirmDelete(event) {
|
||||
event.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Konfirmasi Hapus',
|
||||
text: 'Apakah Anda yakin ingin menghapus data ini?',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#d33',
|
||||
cancelButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Ya, Hapus',
|
||||
cancelButtonText: 'Batal'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
window.location.href = event.currentTarget.href;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<a href="?page=data-kartu" title="Kembali" class="btn btn-warning">Kembali</a>
|
||||
|
||||
@@ -53,10 +53,10 @@
|
||||
class="btn btn-success btn-sm">
|
||||
<i class="fa fa-edit"></i>
|
||||
</a>
|
||||
<a href="?page=del-lahir&kode=<?php echo $data['id_lahir']; ?>" onclick="return confirm('Apakah anda yakin hapus data ini ?')"
|
||||
<a href="?page=del-lahir&kode=<?php echo $data['id_lahir']; ?>" onclick="confirmDelete(event)"
|
||||
title="Hapus" class="btn btn-danger btn-sm">
|
||||
<i class="fa fa-trash"></i>
|
||||
</>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -65,7 +65,26 @@
|
||||
?>
|
||||
</tbody>
|
||||
</tfoot>
|
||||
</table>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.card-body -->
|
||||
<script>
|
||||
function confirmDelete(event) {
|
||||
event.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Konfirmasi Hapus',
|
||||
text: 'Apakah Anda yakin ingin menghapus data ini?',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#d33',
|
||||
cancelButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Ya, Hapus',
|
||||
cancelButtonText: 'Batal'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
window.location.href = event.currentTarget.href;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@@ -56,10 +56,10 @@
|
||||
class="btn btn-success btn-sm">
|
||||
<i class="fa fa-edit"></i>
|
||||
</a>
|
||||
<a href="?page=del-mendu&kode=<?php echo $data['id_pend']; ?>" onclick="return confirm('Apakah anda yakin hapus data ini ?')"
|
||||
<a href="?page=del-mendu&kode=<?php echo $data['id_pend']; ?>" onclick="confirmDelete(event)"
|
||||
title="Hapus" class="btn btn-danger btn-sm">
|
||||
<i class="fa fa-trash"></i>
|
||||
</>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -68,7 +68,26 @@
|
||||
?>
|
||||
</tbody>
|
||||
</tfoot>
|
||||
</table>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.card-body -->
|
||||
<script>
|
||||
function confirmDelete(event) {
|
||||
event.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Konfirmasi Hapus',
|
||||
text: 'Apakah Anda yakin ingin menghapus data ini?',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#d33',
|
||||
cancelButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Ya, Hapus',
|
||||
cancelButtonText: 'Batal'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
window.location.href = event.currentTarget.href;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@@ -52,10 +52,10 @@
|
||||
class="btn btn-success btn-sm">
|
||||
<i class="fa fa-edit"></i>
|
||||
</a>
|
||||
<a href="?page=del-pengguna&kode=<?php echo $data['id_pengguna']; ?>" onclick="return confirm('Apakah anda yakin hapus data ini ?')"
|
||||
<a href="?page=del-pengguna&kode=<?php echo $data['id_pengguna']; ?>" onclick="confirmDelete(event)"
|
||||
title="Hapus" class="btn btn-danger btn-sm">
|
||||
<i class="fa fa-trash"></i>
|
||||
</>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -64,7 +64,26 @@
|
||||
?>
|
||||
</tbody>
|
||||
</tfoot>
|
||||
</table>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.card-body -->
|
||||
<script>
|
||||
function confirmDelete(event) {
|
||||
event.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Konfirmasi Hapus',
|
||||
text: 'Apakah Anda yakin ingin menghapus data ini?',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#d33',
|
||||
cancelButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Ya, Hapus',
|
||||
cancelButtonText: 'Batal'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
window.location.href = event.currentTarget.href;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@@ -56,10 +56,10 @@
|
||||
class="btn btn-success btn-sm">
|
||||
<i class="fa fa-edit"></i>
|
||||
</a>
|
||||
<a href="?page=del-pindah&kode=<?php echo $data['id_pend']; ?>" onclick="return confirm('Apakah anda yakin hapus data ini ?')"
|
||||
<a href="?page=del-pindah&kode=<?php echo $data['id_pend']; ?>" onclick="confirmDelete(event)"
|
||||
title="Hapus" class="btn btn-danger btn-sm">
|
||||
<i class="fa fa-trash"></i>
|
||||
</>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -68,7 +68,26 @@
|
||||
?>
|
||||
</tbody>
|
||||
</tfoot>
|
||||
</table>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.card-body -->
|
||||
<script>
|
||||
function confirmDelete(event) {
|
||||
event.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Konfirmasi Hapus',
|
||||
text: 'Apakah Anda yakin ingin menghapus data ini?',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#d33',
|
||||
cancelButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Ya, Hapus',
|
||||
cancelButtonText: 'Batal'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
window.location.href = event.currentTarget.href;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
20
index.php
20
index.php
@@ -483,7 +483,7 @@
|
||||
?>
|
||||
|
||||
<li class="nav-item">
|
||||
<a onclick="return confirm('Apakah anda yakin akan keluar ?')" href="logout.php" class="nav-link">
|
||||
<a onclick="confirmLogout(event)" href="logout.php" class="nav-link">
|
||||
<i class="nav-icon fas fa-arrow-circle-right"></i>
|
||||
<p>
|
||||
Logout
|
||||
@@ -799,6 +799,24 @@
|
||||
$('#imageModal').modal('show');
|
||||
}
|
||||
|
||||
function confirmLogout(event) {
|
||||
event.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Konfirmasi Logout',
|
||||
text: 'Apakah Anda yakin akan keluar dari sistem?',
|
||||
icon: 'question',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Ya, Keluar',
|
||||
cancelButtonText: 'Batal'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
window.location.href = event.currentTarget.href;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function zoomIn() {
|
||||
scale += 0.2;
|
||||
setTransform();
|
||||
|
||||
Reference in New Issue
Block a user