// Show an alert function showAlert(id, message) { const alertElement = document.getElementById(id); if (alertElement) { const alertText = alertElement.querySelector("span"); // Update the alert message if provided if (message) { alertText.textContent = message; } // Show the alert alertElement.style.display = "flex"; // Use flex for proper alignment alertElement.classList.add("show"); // Add Bootstrap's fade-in class // Auto-hide after 5 seconds setTimeout(() => { closeAlert(id); }, 5000); } } // Close an alert function closeAlert(id) { const alertElement = document.getElementById(id); if (alertElement) { alertElement.style.display = "none"; // Hide the alert alertElement.classList.remove("show"); // Remove Bootstrap's fade-in class } }