fix: replace confirm() with proper delete confirmation modal

This commit is contained in:
2026-06-14 10:07:21 -04:00
parent a25ebdcb75
commit 01f1215cef
2 changed files with 52 additions and 7 deletions

View File

@@ -73,9 +73,9 @@ $data = $notifications['data'] ?? [];
style="color:var(--info)">
<i class="fas fa-redo"></i>
</button>
<button class="btn btn-icon btn-xs" title="Delete"
onclick="confirmDelete(<?= $note['id'] ?>, '<?= htmlspecialchars(addslashes($note['title'] ?? '')) ?>')"
style="color:var(--danger)">
<button class="btn btn-icon btn-xs" title="Delete"
onclick="showDeleteModal(<?= $note['id'] ?>, '<?= htmlspecialchars(addslashes($note['title'] ?? '')) ?>')"
style="color:var(--danger)">
<i class="fas fa-trash"></i>
</button>
</div>
@@ -154,4 +154,29 @@ $data = $notifications['data'] ?? [];
</div>
</div>
<!-- Delete Confirmation Modal -->
<div class="modal" id="deleteModal" onclick="if (event.target === this) closeDeleteModal()">
<div class="modal-dialog" style="max-width: 400px;">
<div class="modal-header">
<h3><i class="fas fa-trash" style="color:var(--danger);margin-right:0.5rem"></i>Delete Notification</h3>
<button class="modal-close" onclick="closeDeleteModal()">&times;</button>
</div>
<div class="modal-body">
<p style="margin-bottom:0.5rem;font-size:0.92rem">
Are you sure you want to delete this notification?
</p>
<p id="deleteModalTitle" style="font-size:0.88rem;color:var(--text-muted);background:var(--bg-tertiary);padding:0.5rem 0.75rem;border-radius:var(--radius-sm)"></p>
<p style="margin-top:0.75rem;font-size:0.82rem;color:var(--text-muted)">
This action cannot be undone. The notification will be removed for all users.
</p>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" onclick="closeDeleteModal()">Cancel</button>
<button class="btn btn-danger" id="deleteConfirmBtn" onclick="executeDelete()">
<i class="fas fa-trash"></i> Delete
</button>
</div>
</div>
</div>
<script src="/assets/js/admin-notifications.js?v=<?= asset_version() ?>"></script>