Add missing showNotification function to settings.php
- Function was being called but never defined - Added showNotification that uses showToast from app.js when available - Includes fallback toast implementation for robustness Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -883,6 +883,23 @@ require_once __DIR__ . '/includes/header.php';
|
|||||||
<?php
|
<?php
|
||||||
// Set additional scripts to be loaded AFTER app.js
|
// Set additional scripts to be loaded AFTER app.js
|
||||||
$additionalScripts = '<script>
|
$additionalScripts = '<script>
|
||||||
|
// Notification helper - uses showToast from app.js if available, otherwise creates simple alert
|
||||||
|
function showNotification(message, type = "success") {
|
||||||
|
if (typeof showToast === "function") {
|
||||||
|
showToast(message, type);
|
||||||
|
} else {
|
||||||
|
// Fallback toast implementation
|
||||||
|
const container = document.getElementById("toastContainer") || document.body;
|
||||||
|
const toast = document.createElement("div");
|
||||||
|
toast.className = `toast ${type}`;
|
||||||
|
toast.style.cssText = "position: fixed; bottom: 20px; right: 20px; padding: 12px 20px; border-radius: 8px; color: white; z-index: 10000; animation: slideIn 0.3s ease;";
|
||||||
|
toast.style.background = type === "error" ? "#dc3545" : type === "info" ? "#17a2b8" : "#28a745";
|
||||||
|
toast.textContent = message;
|
||||||
|
container.appendChild(toast);
|
||||||
|
setTimeout(() => toast.remove(), 4000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize settings page
|
// Initialize settings page
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
const currentTab = "' . $currentTab . '";
|
const currentTab = "' . $currentTab . '";
|
||||||
|
|||||||
Reference in New Issue
Block a user