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>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.card-body -->
|
||||
</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>
|
||||
Reference in New Issue
Block a user