Commit 455e310e authored by Your Name's avatar Your Name

Improve notification visibility with prominent top-center alerts

- Changed from small bottom-right toast to large top-center alert
- Added gradient backgrounds (green for success, red for error, orange for warning)
- Added large icons (check circle, exclamation circle, warning triangle)
- Centered at top of page with 400-600px width
- Smooth slide-down animation on appear, slide-up on dismiss
- Auto-dismisses after 4 seconds
- Much more noticeable for important actions like saving settings
parent 8e689156
...@@ -825,27 +825,97 @@ async function saveConsolidationConfig() { ...@@ -825,27 +825,97 @@ async function saveConsolidationConfig() {
} }
function showToast(message, type) { function showToast(message, type) {
const toastContainer = document.createElement('div'); // Remove any existing alerts
toastContainer.className = 'position-fixed top-0 end-0 p-3'; const existingAlerts = document.querySelectorAll('.payment-alert');
toastContainer.style.zIndex = '9999'; existingAlerts.forEach(alert => alert.remove());
toastContainer.innerHTML = `
<div class="toast show" role="alert" style="min-width: 300px;"> // Create prominent alert at top of page
<div class="toast-header bg-${type} text-white"> const alertDiv = document.createElement('div');
<strong class="me-auto">Notification</strong> alertDiv.className = 'payment-alert';
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="toast"></button> alertDiv.style.cssText = `
</div> position: fixed;
<div class="toast-body"> top: 20px;
${message} left: 50%;
</div> transform: translateX(-50%);
</div> z-index: 10000;
min-width: 400px;
max-width: 600px;
padding: 20px 30px;
border-radius: 8px;
box-shadow: 0 4px 20px rgba(0,0,0,0.3);
font-size: 16px;
font-weight: 500;
text-align: center;
animation: slideDown 0.3s ease-out;
`; `;
document.body.appendChild(toastContainer);
// Set colors based on type
if (type === 'success') {
alertDiv.style.background = 'linear-gradient(135deg, #27ae60 0%, #2ecc71 100%)';
alertDiv.style.color = 'white';
alertDiv.style.border = '2px solid #27ae60';
alertDiv.innerHTML = `
<i class="fas fa-check-circle" style="font-size: 24px; margin-right: 10px; vertical-align: middle;"></i>
<span style="vertical-align: middle;">${message}</span>
`;
} else if (type === 'danger') {
alertDiv.style.background = 'linear-gradient(135deg, #e74c3c 0%, #c0392b 100%)';
alertDiv.style.color = 'white';
alertDiv.style.border = '2px solid #e74c3c';
alertDiv.innerHTML = `
<i class="fas fa-exclamation-circle" style="font-size: 24px; margin-right: 10px; vertical-align: middle;"></i>
<span style="vertical-align: middle;">${message}</span>
`;
} else if (type === 'warning') {
alertDiv.style.background = 'linear-gradient(135deg, #f39c12 0%, #e67e22 100%)';
alertDiv.style.color = 'white';
alertDiv.style.border = '2px solid #f39c12';
alertDiv.innerHTML = `
<i class="fas fa-exclamation-triangle" style="font-size: 24px; margin-right: 10px; vertical-align: middle;"></i>
<span style="vertical-align: middle;">${message}</span>
`;
}
// Add animation keyframes
if (!document.getElementById('alertAnimations')) {
const style = document.createElement('style');
style.id = 'alertAnimations';
style.textContent = `
@keyframes slideDown {
from {
opacity: 0;
transform: translateX(-50%) translateY(-20px);
}
to {
opacity: 1;
transform: translateX(-50%) translateY(0);
}
}
@keyframes slideUp {
from {
opacity: 1;
transform: translateX(-50%) translateY(0);
}
to {
opacity: 0;
transform: translateX(-50%) translateY(-20px);
}
}
`;
document.head.appendChild(style);
}
document.body.appendChild(alertDiv);
// Auto-remove after 4 seconds with fade out animation
setTimeout(() => { setTimeout(() => {
if (toastContainer.parentNode) { alertDiv.style.animation = 'slideUp 0.3s ease-out';
toastContainer.parentNode.removeChild(toastContainer); setTimeout(() => {
} if (alertDiv.parentNode) {
}, 5000); alertDiv.parentNode.removeChild(alertDiv);
}
}, 300);
}, 4000);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment