05/22 Enhance codes and fix bugs

This commit is contained in:
2026-05-22 11:53:41 -04:00
parent d6d9b5e9dc
commit 3511ac2b56
13 changed files with 891 additions and 47 deletions
+5 -6
View File
@@ -369,12 +369,10 @@ function loadExistingAtts() {
}
function deleteAtt(attId, deleteUrl, filename) {
if (!confirm('Delete "' + filename + '"?')) return;
const row = document.getElementById('att-row-' + attId);
if (row) { row.style.opacity = '0.4'; row.style.pointerEvents = 'none'; }
fetch(deleteUrl, { method: 'POST', credentials: 'same-origin', headers: { 'X-CSRFToken': document.querySelector('meta[name="csrf-token"]').content } })
confirmModal('Delete Attachment', 'Delete "' + filename + '"? This cannot be undone.', 'Delete', 'btn-danger', () => {
const row = document.getElementById('att-row-' + attId);
if (row) { row.style.opacity = '0.4'; row.style.pointerEvents = 'none'; }
fetch(deleteUrl, { method: 'POST', credentials: 'same-origin', headers: { 'X-CSRFToken': document.querySelector('meta[name="csrf-token"]').content } })
.then(r => r.json())
.then(data => {
if (data.ok) {
@@ -395,6 +393,7 @@ function deleteAtt(attId, deleteUrl, filename) {
if (row) { row.style.opacity = ''; row.style.pointerEvents = ''; }
alert('Network error. Please try again.');
});
});
}
// Load existing attachments on page load (only for edit mode)