911 lines
42 KiB
HTML
911 lines
42 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="de" class="scroll-smooth">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, minimum-scale=1.0">
|
|
<meta name="description" content="MYP Platform - Mercedes-Benz 3D Druck Management System">
|
|
<meta name="robots" content="noindex, nofollow">
|
|
<!-- Dynamic theme-color meta tags for browser UI -->
|
|
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#ffffff">
|
|
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#000000">
|
|
<meta name="theme-color" id="metaThemeColor" content="#000000">
|
|
<!-- CSRF-Token für Formulare -->
|
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
|
|
|
<!-- Title -->
|
|
<title>{% block title %}MYP Platform - Mercedes-Benz{% endblock %}</title>
|
|
|
|
<!-- PWA Manifest -->
|
|
<link rel="manifest" href="{{ url_for('static', filename='manifest.json') }}">
|
|
|
|
<!-- Favicon -->
|
|
<link rel="icon" type="image/svg+xml" href="{{ url_for('static', filename='favicon.svg') }}">
|
|
<link rel="icon" type="image/png" sizes="32x32" href="{{ url_for('static', filename='icons/favicon-32x32.png') }}">
|
|
<link rel="icon" type="image/png" sizes="16x16" href="{{ url_for('static', filename='icons/favicon-16x16.png') }}">
|
|
<link rel="apple-touch-icon" sizes="180x180" href="{{ url_for('static', filename='icons/apple-touch-icon.png') }}">
|
|
<link rel="mask-icon" href="{{ url_for('static', filename='favicon.svg') }}" color="#000000">
|
|
|
|
<!-- CSS - Performance Optimized -->
|
|
<link href="{{ url_for('static', filename='css/tailwind.min.css') }}" rel="stylesheet">
|
|
<!-- Moderne Navbar CSS -->
|
|
<link href="{{ url_for('static', filename='css/navbar.css') }}" rel="stylesheet">
|
|
<link href="{{ url_for('static', filename='css/performance-optimized.min.css') }}" rel="stylesheet">
|
|
<link href="{{ url_for('static', filename='css/components.min.css') }}" rel="stylesheet">
|
|
<link href="{{ url_for('static', filename='css/professional-theme.min.css') }}" rel="stylesheet">
|
|
|
|
<!-- Core Utilities CSS -->
|
|
<link href="{{ url_for('static', filename='css/core-utilities.min.css') }}" rel="stylesheet">
|
|
<link href="{{ url_for('static', filename='css/ui-refinements.min.css') }}" rel="stylesheet">
|
|
|
|
<!-- Preload critical resources -->
|
|
<link rel="preload" href="{{ url_for('static', filename='js/core-utilities.min.js') }}" as="script">
|
|
<link rel="preload" href="{{ url_for('static', filename='fontawesome/css/all.min.css') }}" as="style">
|
|
|
|
<!-- FontAwesome -->
|
|
<link href="{{ url_for('static', filename='fontawesome/css/all.min.css') }}" rel="stylesheet">
|
|
|
|
<!-- Additional CSS -->
|
|
{% block extra_css %}{% endblock %}
|
|
|
|
<!-- Dark Mode Script (must be in head to prevent flash) -->
|
|
<script>
|
|
// Temporär für sofortige Anwendung ohne Flackern
|
|
document.documentElement.classList.add('disable-transitions');
|
|
|
|
const STORAGE_KEY = 'myp-dark-mode';
|
|
const savedMode = localStorage.getItem(STORAGE_KEY);
|
|
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
const isDark = savedMode === 'true' || (savedMode === null && prefersDark);
|
|
|
|
// Dark Mode sofort anwenden
|
|
if (isDark) {
|
|
document.documentElement.classList.add('dark');
|
|
document.documentElement.setAttribute('data-theme', 'dark');
|
|
document.documentElement.style.colorScheme = 'dark';
|
|
} else {
|
|
document.documentElement.classList.remove('dark');
|
|
document.documentElement.setAttribute('data-theme', 'light');
|
|
document.documentElement.style.colorScheme = 'light';
|
|
}
|
|
|
|
// ThemeColor Meta-Tag aktualisieren
|
|
const metaThemeColor = document.getElementById('metaThemeColor');
|
|
if (metaThemeColor) {
|
|
metaThemeColor.setAttribute('content', isDark ? '#000000' : '#ffffff');
|
|
}
|
|
|
|
// Übergänge nach kurzer Verzögerung wieder aktivieren
|
|
setTimeout(function() {
|
|
document.documentElement.classList.remove('disable-transitions');
|
|
}, 10);
|
|
|
|
// Diese Funktion wird nach dem DOM-Laden ausgeführt
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Dark Mode Toggle Button Icons aktualisieren
|
|
const darkModeToggle = document.querySelector('.darkModeToggle');
|
|
if (darkModeToggle) {
|
|
const sunIcon = darkModeToggle.querySelector('.sun-icon');
|
|
const moonIcon = darkModeToggle.querySelector('.moon-icon');
|
|
|
|
if (isDark) {
|
|
darkModeToggle.setAttribute('aria-pressed', 'true');
|
|
darkModeToggle.setAttribute('title', 'Light Mode aktivieren');
|
|
if (sunIcon) sunIcon.classList.add('hidden');
|
|
if (moonIcon) moonIcon.classList.remove('hidden');
|
|
} else {
|
|
darkModeToggle.setAttribute('aria-pressed', 'false');
|
|
darkModeToggle.setAttribute('title', 'Dark Mode aktivieren');
|
|
if (sunIcon) sunIcon.classList.remove('hidden');
|
|
if (moonIcon) moonIcon.classList.add('hidden');
|
|
}
|
|
}
|
|
|
|
// MYP App für Offline-Funktionalität initialisieren
|
|
if (typeof MYPApp !== 'undefined') {
|
|
window.mypApp = new MYPApp();
|
|
}
|
|
|
|
// User-Dropdown-Funktionalität initialisieren
|
|
initUserDropdown();
|
|
|
|
// Flask Flash Messages über das Glassmorphism-System anzeigen
|
|
const flashContainer = document.getElementById('flask-flash-messages');
|
|
if (flashContainer) {
|
|
const flashCount = parseInt(flashContainer.getAttribute('data-flash-count')) || 0;
|
|
|
|
for (let i = 1; i <= flashCount; i++) {
|
|
const flashData = flashContainer.getAttribute('data-flash-' + i);
|
|
if (flashData) {
|
|
const [category, message] = flashData.split('|', 2);
|
|
let messageType = category;
|
|
|
|
// Flask-Kategorien zu JavaScript-Kategorien mappen
|
|
if (messageType === 'danger') messageType = 'error';
|
|
|
|
// Nachricht über das moderne Glassmorphism-System anzeigen
|
|
if (typeof showToast === 'function') {
|
|
// Kleine Verzögerung für bessere UX und schöne Glassmorphism-Animationen
|
|
setTimeout(() => {
|
|
showToast(message, messageType, 6000, {
|
|
title: messageType === 'success' ? 'Erfolgreich' :
|
|
messageType === 'error' ? 'Fehler' :
|
|
messageType === 'warning' ? 'Warnung' : 'Information',
|
|
playSound: true
|
|
});
|
|
}, i * 250); // Nachrichten gestaffelt anzeigen
|
|
}
|
|
}
|
|
}
|
|
|
|
// Container nach Verarbeitung entfernen
|
|
flashContainer.remove();
|
|
}
|
|
|
|
console.log('🚀 MYP Platform UI erfolgreich initialisiert');
|
|
});
|
|
</script>
|
|
|
|
<!-- Disable Transitions Styling -->
|
|
<style>
|
|
.disable-transitions,
|
|
.disable-transitions * {
|
|
transition: none !important;
|
|
}
|
|
|
|
/* ===== ULTRA-DEZENTE SCROLLBALKEN ===== */
|
|
|
|
/* Webkit-Browser (Chrome, Safari, Edge) */
|
|
::-webkit-scrollbar {
|
|
width: 6px;
|
|
height: 6px;
|
|
}
|
|
|
|
::-webkit-scrollbar-track {
|
|
background: transparent;
|
|
}
|
|
|
|
::-webkit-scrollbar-thumb {
|
|
background: transparent;
|
|
border-radius: 3px;
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
/* Nur bei Hover über scrollbaren Container sichtbar */
|
|
*:hover::-webkit-scrollbar-thumb {
|
|
background: rgba(0, 0, 0, 0.05);
|
|
}
|
|
|
|
*:hover::-webkit-scrollbar-thumb:hover {
|
|
background: rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
/* Dark Mode - noch dezenter */
|
|
.dark *:hover::-webkit-scrollbar-thumb {
|
|
background: rgba(255, 255, 255, 0.03);
|
|
}
|
|
|
|
.dark *:hover::-webkit-scrollbar-thumb:hover {
|
|
background: rgba(255, 255, 255, 0.08);
|
|
}
|
|
|
|
/* Firefox - ultra-thin */
|
|
* {
|
|
scrollbar-width: none; /* Komplett versteckt in Firefox */
|
|
}
|
|
|
|
/* Nur bei Hover sichtbar in Firefox */
|
|
*:hover {
|
|
scrollbar-width: thin;
|
|
scrollbar-color: rgba(0, 0, 0, 0.05) transparent;
|
|
}
|
|
|
|
.dark *:hover {
|
|
scrollbar-color: rgba(255, 255, 255, 0.03) transparent;
|
|
}
|
|
|
|
/* Spezielle Container die scrollbar brauchen */
|
|
.modal-content::-webkit-scrollbar,
|
|
.dropdown-menu::-webkit-scrollbar {
|
|
width: 4px;
|
|
}
|
|
|
|
.modal-content::-webkit-scrollbar-thumb,
|
|
.dropdown-menu::-webkit-scrollbar-thumb {
|
|
background: rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.dark .modal-content::-webkit-scrollbar-thumb,
|
|
.dark .dropdown-menu::-webkit-scrollbar-thumb {
|
|
background: rgba(255, 255, 255, 0.1);
|
|
}
|
|
|
|
/* ===== DO NOT DISTURB BUTTON STYLES ===== */
|
|
.dnd-toggle-button {
|
|
/* Inaktiv (Standard) */
|
|
background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(59, 130, 246, 0.1));
|
|
color: rgb(99, 102, 241);
|
|
border: 1px solid rgba(99, 102, 241, 0.2);
|
|
}
|
|
|
|
.dnd-toggle-button:hover {
|
|
background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(59, 130, 246, 0.15));
|
|
border-color: rgba(99, 102, 241, 0.3);
|
|
transform: translateY(-1px);
|
|
box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
|
|
}
|
|
|
|
/* Aktiv (DND eingeschaltet) */
|
|
.dnd-toggle-button.active {
|
|
background: linear-gradient(135deg, rgba(249, 115, 22, 0.9), rgba(234, 88, 12, 0.9));
|
|
color: white;
|
|
border: 1px solid rgba(249, 115, 22, 0.8);
|
|
box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3);
|
|
}
|
|
|
|
.dnd-toggle-button.active:hover {
|
|
background: linear-gradient(135deg, rgba(249, 115, 22, 1), rgba(234, 88, 12, 1));
|
|
transform: translateY(-1px);
|
|
box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
|
|
}
|
|
|
|
/* Dark Mode Anpassungen */
|
|
.dark .dnd-toggle-button {
|
|
background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(59, 130, 246, 0.15));
|
|
color: rgb(147, 197, 253);
|
|
border: 1px solid rgba(99, 102, 241, 0.3);
|
|
}
|
|
|
|
.dark .dnd-toggle-button:hover {
|
|
background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(59, 130, 246, 0.2));
|
|
border-color: rgba(99, 102, 241, 0.4);
|
|
}
|
|
|
|
.dark .dnd-toggle-button.active {
|
|
background: linear-gradient(135deg, rgba(249, 115, 22, 0.9), rgba(234, 88, 12, 0.9));
|
|
color: white;
|
|
border: 1px solid rgba(249, 115, 22, 0.8);
|
|
}
|
|
</style>
|
|
|
|
{% block head %}{% endblock %}
|
|
</head>
|
|
|
|
<body class="min-h-screen flex flex-col bg-white text-slate-900 dark:bg-black dark:text-white transition-colors duration-300 text-base mercedes-background">
|
|
|
|
<!-- Moderne MYP Platform Navbar -->
|
|
{% include 'includes/navbar.html' %}
|
|
|
|
<!-- Main Content -->
|
|
<main id="main-content" class="flex-grow max-w-7xl w-full mx-auto px-3 sm:px-6 lg:px-8 py-4 sm:py-8">
|
|
<div class="container mx-auto px-4 py-8">
|
|
<!-- Flash Messages - Modernisiert für Glassmorphism-Kompatibilität -->
|
|
{% with messages = get_flashed_messages(with_categories=true) %}
|
|
{% if messages %}
|
|
<!-- Flask Flash Messages als Datenattribute für JavaScript -->
|
|
<div id="flask-flash-messages" style="display: none;"
|
|
{% for category, message in messages %}
|
|
data-flash-{{ loop.index }}="{{ category }}|{{ message | e }}"
|
|
{% endfor %}
|
|
data-flash-count="{{ messages|length }}">
|
|
</div>
|
|
{% endif %}
|
|
{% endwith %}
|
|
|
|
{% block content %}{% endblock %}
|
|
</div>
|
|
</main>
|
|
|
|
<!-- Mercedes-Benz Footer -->
|
|
<footer class="bg-white dark:bg-black border-t border-gray-200 dark:border-slate-700 mt-auto transition-colors duration-300">
|
|
<div class="max-w-screen-xl w-full mx-auto px-3 sm:px-6 lg:px-8">
|
|
<div class="py-4 sm:py-8 border-t border-gray-200 dark:border-slate-700 mt-8 sm:mt-12 pt-4 sm:pt-8">
|
|
<div class="grid grid-cols-1 sm:grid-cols-3 gap-6 sm:gap-8">
|
|
<!-- Brand Section - Stack on mobile -->
|
|
<div class="flex flex-col space-y-4">
|
|
<div class="flex items-center gap-3">
|
|
<div class="w-6 h-6">
|
|
<svg class="w-full h-full text-slate-900 dark:text-white transition-colors duration-300" fill="currentColor" viewBox="0 0 80 80">
|
|
<path d="M58.6,4.5C53,1.6,46.7,0,40,0c-6.7,0-13,1.6-18.6,4.5v0C8.7,11.2,0,24.6,0,40c0,15.4,8.7,28.8,21.5,35.5
|
|
C27,78.3,33.3,80,40,80c6.7,0,12.9-1.7,18.5-4.6C71.3,68.8,80,55.4,80,40C80,24.6,71.3,11.2,58.6,4.5z M4,40
|
|
c0-13.1,7-24.5,17.5-30.9v0C26.6,6,32.5,4.2,39,4l-4.5,32.7L21.5,46.8v0L8.3,57.1C5.6,52,4,46.2,4,40z M58.6,70.8
|
|
C53.1,74.1,46.8,76,40,76c-6.8,0-13.2-1.9-18.6-5.2c-4.9-2.9-8.9-6.9-11.9-11.7l11.9-4.9v0L40,46.6l18.6,7.5v0l12,4.9
|
|
C67.6,63.9,63.4,67.9,58.6,70.8z M58.6,46.8L58.6,46.8l-12.9-10L41.1,4c6.3,0.2,12.3,2,17.4,5.1v0C69,15.4,76,26.9,76,40
|
|
c0,6.2-1.5,12-4.3,17.1L58.6,46.8z"/>
|
|
</svg>
|
|
</div>
|
|
<div>
|
|
<div class="text-base font-bold text-slate-900 dark:text-white transition-colors duration-300">Mercedes-Benz</div>
|
|
<div class="text-xs text-slate-600 dark:text-slate-400 transition-colors duration-300">TBA Marienfelde - Steckdosen-Steuerung</div>
|
|
</div>
|
|
</div>
|
|
<p class="text-xs text-slate-600 dark:text-slate-400 leading-relaxed transition-colors duration-300">
|
|
Das Beste oder nichts - Professionelles 3D-Druck Management für Mercedes-Benz.
|
|
</p>
|
|
</div>
|
|
|
|
<!-- System Info -->
|
|
<div class="flex flex-col space-y-4">
|
|
<h3 class="text-lg font-semibold text-slate-900 dark:text-white transition-colors duration-300">System</h3>
|
|
<div class="space-y-2 text-xs text-slate-600 dark:text-slate-400 leading-relaxed transition-colors duration-300">
|
|
<div class="flex justify-between">
|
|
<span>Version:</span>
|
|
<span class="text-slate-900 dark:text-white font-medium transition-colors duration-300">3.0.0</span>
|
|
</div>
|
|
<div class="flex justify-between">
|
|
<span>Status:</span>
|
|
<div id="connection-status" class="flex items-center space-x-1">
|
|
<div class="w-2 h-2 bg-green-400 rounded-full"></div>
|
|
<span class="text-green-500 dark:text-green-400 font-medium transition-colors duration-300">Online</span>
|
|
</div>
|
|
</div>
|
|
{% if current_user.is_authenticated and current_user.is_admin %}
|
|
<div class="pt-2 border-t border-slate-200 dark:border-slate-600 space-y-1">
|
|
<a href="{{ url_for('admin.admin_dashboard') }}"
|
|
class="flex items-center space-x-2 text-slate-600 dark:text-slate-400 hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200">
|
|
<span class="text-sm">⚙️</span>
|
|
<span class="text-xs">Admin-Dashboard</span>
|
|
</a>
|
|
<a href="{{ url_for('calendar.calendar_view') }}"
|
|
class="flex items-center space-x-2 text-slate-500 dark:text-slate-500 hover:text-green-600 dark:hover:text-green-400 transition-colors duration-200"
|
|
title="Steckdosen-Status Historie">
|
|
<span class="text-sm">🔌</span>
|
|
<span class="text-xs">Status-Kalender</span>
|
|
</a>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
<!-- Do Not Disturb Controls -->
|
|
<div class="flex flex-col space-y-4">
|
|
<h3 class="text-lg font-semibold text-slate-900 dark:text-white transition-colors duration-300">Benachrichtigungen</h3>
|
|
<div class="space-y-3">
|
|
<!-- Do Not Disturb Toggle - Vereinfacht -->
|
|
<div class="flex items-center justify-between">
|
|
<span class="text-xs text-slate-600 dark:text-slate-400">Nicht stören:</span>
|
|
<button
|
|
id="dndToggle"
|
|
class="dnd-toggle-button px-3 py-1.5 rounded-lg text-xs font-medium transition-all duration-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
|
|
aria-label="Do Not Disturb umschalten"
|
|
data-dnd-toggle
|
|
title="Benachrichtigungen stumm schalten"
|
|
>
|
|
<span class="dnd-text">Inaktiv</span>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- DND Status -->
|
|
<div id="dndStatus" class="text-xs text-slate-500 dark:text-slate-400">
|
|
<span class="dnd-status-text">Alle Benachrichtigungen aktiv</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Copyright -->
|
|
<div class="flex flex-col space-y-4">
|
|
<h3 class="text-lg font-semibold text-slate-900 dark:text-white transition-colors duration-300">Rechtliches</h3>
|
|
<div class="space-y-2 text-xs text-slate-600 dark:text-slate-400 leading-relaxed transition-colors duration-300">
|
|
<p>© 2024 Mercedes-Benz Group AG</p>
|
|
<p>Alle Rechte vorbehalten.</p>
|
|
<p class="text-xs text-slate-500 dark:text-slate-500 transition-colors duration-300">
|
|
Entwickelt für interne Mercedes-Benz Anwendungen
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
|
|
<!-- JavaScript - Core Utilities First -->
|
|
<script src="{{ url_for('static', filename='js/core-utilities.min.js') }}"></script>
|
|
|
|
<!-- Essential Scripts -->
|
|
<script src="{{ url_for('static', filename='js/ui-components.min.js') }}"></script>
|
|
<script src="{{ url_for('static', filename='js/dark-mode-fix.min.js') }}"></script>
|
|
<script src="{{ url_for('static', filename='js/user-dropdown.min.js') }}"></script>
|
|
|
|
<!-- Deferred Scripts -->
|
|
<script defer src="{{ url_for('static', filename='js/job-manager.min.js') }}"></script>
|
|
<script defer src="{{ url_for('static', filename='js/optimization-features.min.js') }}"></script>
|
|
<script defer src="{{ url_for('static', filename='js/global-refresh-functions.min.js') }}"></script>
|
|
<script defer src="{{ url_for('static', filename='js/event-handlers.min.js') }}"></script>
|
|
<script defer src="{{ url_for('static', filename='js/printer_monitor.min.js') }}"></script>
|
|
{% if current_user.is_authenticated %}
|
|
<script defer src="{{ url_for('static', filename='js/notifications.min.js') }}"></script>
|
|
<script defer src="{{ url_for('static', filename='js/session-manager.min.js') }}"></script>
|
|
<script defer src="{{ url_for('static', filename='js/auto-logout.min.js') }}"></script>
|
|
{% endif %}
|
|
|
|
<!-- Glassmorphism Notification System - Modernisiert -->
|
|
<script src="{{ url_for('static', filename='js/glassmorphism-notifications.min.js') }}"></script>
|
|
|
|
<!-- Modern Navbar Controller -->
|
|
<script src="{{ url_for('static', filename='js/navbar.js') }}"></script>
|
|
|
|
<!-- Additional JavaScript Functions -->
|
|
<script>
|
|
/**
|
|
* Logout-Handler für sicheres Abmelden
|
|
* Unterstützt sowohl das moderne Glassmorphism-System als auch Fallback-Bestätigung
|
|
*/
|
|
function handleLogout() {
|
|
console.log('🚪 Abmeldung angefordert');
|
|
|
|
// Funktion für die tatsächliche Abmeldung
|
|
function performLogout() {
|
|
try {
|
|
console.log('🔄 Abmeldung wird durchgeführt...');
|
|
|
|
// Loading-Animation anzeigen
|
|
document.body.style.opacity = '0.7';
|
|
document.body.style.pointerEvents = 'none';
|
|
|
|
// Status-Feedback anzeigen
|
|
const loadingMessage = document.createElement('div');
|
|
loadingMessage.id = 'logout-loading';
|
|
loadingMessage.style.cssText = `
|
|
position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
|
|
background: rgba(0, 0, 0, 0.8); color: white; padding: 20px 40px;
|
|
border-radius: 8px; z-index: 9999; font-family: sans-serif;
|
|
backdrop-filter: blur(10px);
|
|
`;
|
|
loadingMessage.textContent = 'Abmeldung wird durchgeführt...';
|
|
document.body.appendChild(loadingMessage);
|
|
|
|
// CSRF-Token aus Meta-Tag holen
|
|
const csrfToken = document.querySelector('meta[name="csrf-token"]');
|
|
|
|
// Logout-Formular erstellen und absenden
|
|
const form = document.createElement('form');
|
|
form.method = 'POST';
|
|
form.action = '{{ url_for("auth.logout") }}';
|
|
form.style.display = 'none';
|
|
|
|
// CSRF-Token hinzufügen falls verfügbar
|
|
if (csrfToken) {
|
|
const input = document.createElement('input');
|
|
input.type = 'hidden';
|
|
input.name = 'csrf_token';
|
|
input.value = csrfToken.getAttribute('content');
|
|
form.appendChild(input);
|
|
}
|
|
|
|
// Formular absenden
|
|
document.body.appendChild(form);
|
|
form.submit();
|
|
|
|
} catch (error) {
|
|
console.error('❌ Fehler bei der Abmeldung:', error);
|
|
// Bei Fehler direkt zur Login-Seite weiterleiten
|
|
window.location.href = '/auth/login';
|
|
}
|
|
}
|
|
|
|
// Abbruch-Funktion
|
|
function cancelLogout() {
|
|
console.log('❌ Abmeldung abgebrochen');
|
|
// Nichts zu tun - Toast wird automatisch geschlossen
|
|
}
|
|
|
|
// Prüfen ob das moderne Glassmorphism-System verfügbar ist
|
|
if (typeof showConfirmationToast === 'function' && window.glassNotificationSystem) {
|
|
console.log('✨ Verwende modernes Glassmorphism-Bestätigungssystem');
|
|
|
|
try {
|
|
showConfirmationToast(
|
|
'Möchten Sie sich wirklich abmelden?',
|
|
performLogout,
|
|
cancelLogout,
|
|
{
|
|
title: 'Abmeldung bestätigen',
|
|
confirmText: 'Abmelden',
|
|
cancelText: 'Abbrechen'
|
|
}
|
|
);
|
|
} catch (error) {
|
|
console.warn('⚠️ Glassmorphism-System Fehler, verwende Fallback:', error);
|
|
// Bei Fehler mit Glassmorphism-System zum Standard-Fallback wechseln
|
|
useStandardConfirmation();
|
|
}
|
|
} else {
|
|
console.log('📋 Verwende Standard-Bestätigungsdialog');
|
|
useStandardConfirmation();
|
|
}
|
|
|
|
// Standard-Bestätigungslogik
|
|
function useStandardConfirmation() {
|
|
// Verbesserte Standard-Bestätigung mit besserer UX
|
|
const confirmation = confirm('Möchten Sie sich wirklich abmelden?\n\nSie werden zur Anmeldeseite weitergeleitet.');
|
|
|
|
if (confirmation) {
|
|
performLogout();
|
|
} else {
|
|
console.log('❌ Abmeldung abgebrochen (Standard-Dialog)');
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Initialisierung aller UI-Komponenten nach DOM-Load
|
|
*/
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// MYP App für Offline-Funktionalität initialisieren
|
|
if (typeof MYPApp !== 'undefined') {
|
|
window.mypApp = new MYPApp();
|
|
}
|
|
|
|
// User-Dropdown-Funktionalität initialisieren
|
|
initUserDropdown();
|
|
|
|
// Flask Flash Messages über das Glassmorphism-System anzeigen
|
|
const flashContainer = document.getElementById('flask-flash-messages');
|
|
if (flashContainer) {
|
|
const flashCount = parseInt(flashContainer.getAttribute('data-flash-count')) || 0;
|
|
|
|
for (let i = 1; i <= flashCount; i++) {
|
|
const flashData = flashContainer.getAttribute('data-flash-' + i);
|
|
if (flashData) {
|
|
const [category, message] = flashData.split('|', 2);
|
|
let messageType = category;
|
|
|
|
// Flask-Kategorien zu JavaScript-Kategorien mappen
|
|
if (messageType === 'danger') messageType = 'error';
|
|
|
|
// Nachricht über das moderne Glassmorphism-System anzeigen
|
|
if (typeof showToast === 'function') {
|
|
// Kleine Verzögerung für bessere UX und schöne Glassmorphism-Animationen
|
|
setTimeout(() => {
|
|
showToast(message, messageType, 6000, {
|
|
title: messageType === 'success' ? 'Erfolgreich' :
|
|
messageType === 'error' ? 'Fehler' :
|
|
messageType === 'warning' ? 'Warnung' : 'Information',
|
|
playSound: true
|
|
});
|
|
}, i * 250); // Nachrichten gestaffelt anzeigen
|
|
}
|
|
}
|
|
}
|
|
|
|
// Container nach Verarbeitung entfernen
|
|
flashContainer.remove();
|
|
}
|
|
|
|
console.log('🚀 MYP Platform UI erfolgreich initialisiert');
|
|
});
|
|
|
|
/**
|
|
* User-Dropdown-Funktionalität
|
|
*/
|
|
function initUserDropdown() {
|
|
const userMenuButton = document.getElementById('user-menu-button');
|
|
const userDropdown = document.getElementById('user-dropdown');
|
|
|
|
console.log('🔍 User-Dropdown Init:', { userMenuButton, userDropdown });
|
|
|
|
if (!userMenuButton || !userDropdown) {
|
|
console.warn('⚠️ User-Dropdown-Elemente nicht gefunden:', {
|
|
button: !!userMenuButton,
|
|
dropdown: !!userDropdown
|
|
});
|
|
return; // Nicht angemeldet oder Elemente nicht gefunden
|
|
}
|
|
|
|
let isDropdownOpen = false;
|
|
|
|
// Toggle-Funktion
|
|
function toggleDropdown(event) {
|
|
if (event) {
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
}
|
|
|
|
isDropdownOpen = !isDropdownOpen;
|
|
console.log('🔄 Toggle Dropdown:', isDropdownOpen);
|
|
|
|
if (isDropdownOpen) {
|
|
openDropdown();
|
|
} else {
|
|
closeDropdown();
|
|
}
|
|
}
|
|
|
|
function openDropdown() {
|
|
userDropdown.classList.remove('hidden');
|
|
userMenuButton.setAttribute('aria-expanded', 'true');
|
|
|
|
// Reset any existing styles
|
|
userDropdown.style.transition = '';
|
|
userDropdown.style.opacity = '0';
|
|
userDropdown.style.transform = 'translateY(-10px) scale(0.95)';
|
|
|
|
// Force reflow
|
|
userDropdown.offsetHeight;
|
|
|
|
// Apply opening animation
|
|
requestAnimationFrame(() => {
|
|
userDropdown.style.transition = 'all 0.2s ease-out';
|
|
userDropdown.style.opacity = '1';
|
|
userDropdown.style.transform = 'translateY(0) scale(1)';
|
|
});
|
|
|
|
console.log('✅ Dropdown geöffnet');
|
|
}
|
|
|
|
function closeDropdown() {
|
|
userDropdown.style.transition = 'all 0.15s ease-in';
|
|
userDropdown.style.opacity = '0';
|
|
userDropdown.style.transform = 'translateY(-10px) scale(0.95)';
|
|
|
|
setTimeout(() => {
|
|
userDropdown.classList.add('hidden');
|
|
userMenuButton.setAttribute('aria-expanded', 'false');
|
|
// Reset inline styles
|
|
userDropdown.style.transition = '';
|
|
userDropdown.style.opacity = '';
|
|
userDropdown.style.transform = '';
|
|
}, 150);
|
|
|
|
isDropdownOpen = false;
|
|
console.log('❌ Dropdown geschlossen');
|
|
}
|
|
|
|
// Event-Listener für Button-Click
|
|
userMenuButton.addEventListener('click', toggleDropdown);
|
|
|
|
// Alternative: Auch auf touchstart für mobile Geräte
|
|
userMenuButton.addEventListener('touchstart', function(e) {
|
|
e.preventDefault();
|
|
toggleDropdown(e);
|
|
}, { passive: false });
|
|
|
|
// Event-Listener für Klicks außerhalb des Dropdowns
|
|
document.addEventListener('click', function(e) {
|
|
if (!userMenuButton.contains(e.target) && !userDropdown.contains(e.target)) {
|
|
if (isDropdownOpen) {
|
|
closeDropdown();
|
|
}
|
|
}
|
|
});
|
|
|
|
// Touch-Events für mobile Geräte
|
|
document.addEventListener('touchstart', function(e) {
|
|
if (!userMenuButton.contains(e.target) && !userDropdown.contains(e.target)) {
|
|
if (isDropdownOpen) {
|
|
closeDropdown();
|
|
}
|
|
}
|
|
});
|
|
|
|
// Escape-Taste zum Schließen
|
|
document.addEventListener('keydown', function(e) {
|
|
if (e.key === 'Escape' && isDropdownOpen) {
|
|
closeDropdown();
|
|
userMenuButton.focus();
|
|
}
|
|
});
|
|
|
|
// Fokus-Management für bessere Accessibility
|
|
userDropdown.addEventListener('keydown', function(e) {
|
|
if (e.key === 'Tab') {
|
|
const focusableElements = userDropdown.querySelectorAll('a, button');
|
|
const firstElement = focusableElements[0];
|
|
const lastElement = focusableElements[focusableElements.length - 1];
|
|
|
|
if (e.shiftKey && document.activeElement === firstElement) {
|
|
e.preventDefault();
|
|
lastElement.focus();
|
|
} else if (!e.shiftKey && document.activeElement === lastElement) {
|
|
e.preventDefault();
|
|
firstElement.focus();
|
|
}
|
|
}
|
|
});
|
|
|
|
// Window resize handler
|
|
window.addEventListener('resize', function() {
|
|
if (isDropdownOpen) {
|
|
closeDropdown();
|
|
}
|
|
});
|
|
|
|
console.log('✅ User-Dropdown erfolgreich initialisiert');
|
|
}
|
|
|
|
/**
|
|
* Do Not Disturb (DND) Funktionalität
|
|
*/
|
|
class DoNotDisturbManager {
|
|
constructor() {
|
|
this.storageKey = 'myp-dnd-mode';
|
|
this.counterKey = 'myp-dnd-counter';
|
|
this.suppressedMessages = [];
|
|
this.isEnabled = this.loadDNDState();
|
|
this.suppressedCount = this.loadSuppressedCount();
|
|
|
|
this.init();
|
|
}
|
|
|
|
init() {
|
|
const dndToggle = document.getElementById('dndToggle');
|
|
const dndStatus = document.getElementById('dndStatus');
|
|
|
|
if (dndToggle) {
|
|
dndToggle.addEventListener('click', () => this.toggle());
|
|
this.updateUI();
|
|
}
|
|
|
|
// Integration mit dem bestehenden Benachrichtigungssystem
|
|
this.integrateWithNotificationSystem();
|
|
}
|
|
|
|
toggle() {
|
|
this.isEnabled = !this.isEnabled;
|
|
this.saveDNDState();
|
|
this.updateUI();
|
|
|
|
if (!this.isEnabled) {
|
|
// Beim Deaktivieren alle unterdrückten Nachrichten anzeigen
|
|
this.showSuppressedMessages();
|
|
this.resetSuppressedCount();
|
|
}
|
|
|
|
// Feedback für den Benutzer
|
|
const message = this.isEnabled
|
|
? 'Nicht stören aktiviert - Benachrichtigungen werden unterdrückt'
|
|
: 'Nicht stören deaktiviert - Benachrichtigungen sind wieder aktiv';
|
|
|
|
if (typeof showToast === 'function') {
|
|
showToast(message, 'info', 3000, {
|
|
title: 'Information',
|
|
playSound: true
|
|
});
|
|
}
|
|
|
|
console.log(`🔕 DND ${this.isEnabled ? 'aktiviert' : 'deaktiviert'}`);
|
|
}
|
|
|
|
updateUI() {
|
|
const dndToggle = document.getElementById('dndToggle');
|
|
const dndText = dndToggle?.querySelector('.dnd-text');
|
|
const dndStatusText = document.querySelector('.dnd-status-text');
|
|
|
|
if (this.isEnabled) {
|
|
dndToggle?.classList.add('active');
|
|
if (dndText) dndText.textContent = 'Aktiv';
|
|
if (dndStatusText) dndStatusText.textContent = 'Benachrichtigungen unterdrückt';
|
|
dndToggle?.setAttribute('title', 'Nicht stören deaktivieren');
|
|
} else {
|
|
dndToggle?.classList.remove('active');
|
|
if (dndText) dndText.textContent = 'Inaktiv';
|
|
if (dndStatusText) dndStatusText.textContent = 'Alle Benachrichtigungen aktiv';
|
|
dndToggle?.setAttribute('title', 'Nicht stören aktivieren');
|
|
}
|
|
}
|
|
|
|
suppressNotification(message, type) {
|
|
if (!this.isEnabled) return false;
|
|
|
|
// Wichtige Nachrichten (Fehler) nicht unterdrücken
|
|
if (type === 'error' || type === 'danger') return false;
|
|
|
|
// Nachricht zur Liste der unterdrückten hinzufügen
|
|
this.suppressedMessages.push({
|
|
message,
|
|
type,
|
|
timestamp: new Date().toISOString()
|
|
});
|
|
|
|
this.incrementSuppressedCount();
|
|
console.log(`🔕 Benachrichtigung unterdrückt: ${message}`);
|
|
return true;
|
|
}
|
|
|
|
shouldSuppressNotification(message, type) {
|
|
if (!this.isEnabled) return false;
|
|
|
|
// Wichtige Nachrichten (Fehler) nicht unterdrücken
|
|
if (type === 'error' || type === 'danger') return false;
|
|
|
|
// Nachricht zur Liste der unterdrückten hinzufügen
|
|
this.suppressedMessages.push({
|
|
message,
|
|
type,
|
|
timestamp: new Date().toISOString()
|
|
});
|
|
|
|
this.incrementSuppressedCount();
|
|
return true;
|
|
}
|
|
|
|
showSuppressedMessages() {
|
|
if (this.suppressedMessages.length === 0) return;
|
|
|
|
// Sammelnachricht über unterdrückte Benachrichtigungen
|
|
const count = this.suppressedMessages.length;
|
|
const summaryMessage = `${count} Benachrichtigung${count > 1 ? 'en' : ''} während "Nicht stören" erhalten`;
|
|
|
|
if (typeof showToast === 'function') {
|
|
showToast(summaryMessage, 'info', 4000, {
|
|
title: 'Information',
|
|
playSound: true
|
|
});
|
|
}
|
|
|
|
// Optional: Alle einzelnen Nachrichten anzeigen (mit Verzögerung)
|
|
this.suppressedMessages.forEach((item, index) => {
|
|
setTimeout(() => {
|
|
if (typeof showToast === 'function') {
|
|
showToast(item.message, item.type, 3000, {
|
|
title: item.type === 'success' ? 'Erfolgreich' :
|
|
item.type === 'error' ? 'Fehler' :
|
|
item.type === 'warning' ? 'Warnung' : 'Information',
|
|
playSound: true
|
|
});
|
|
}
|
|
}, (index + 1) * 500);
|
|
});
|
|
|
|
this.suppressedMessages = [];
|
|
}
|
|
|
|
incrementSuppressedCount() {
|
|
this.suppressedCount++;
|
|
this.saveSuppressedCount();
|
|
this.updateUI();
|
|
}
|
|
|
|
resetSuppressedCount() {
|
|
this.suppressedCount = 0;
|
|
this.saveSuppressedCount();
|
|
this.updateUI();
|
|
}
|
|
|
|
integrateWithNotificationSystem() {
|
|
// Überschreibe showToast wenn verfügbar
|
|
if (typeof window.showToast === 'function') {
|
|
const originalShowToast = window.showToast;
|
|
window.showToast = (message, type, duration, options) => {
|
|
if (this.shouldSuppressNotification(message, type)) {
|
|
console.log(`🔕 Benachrichtigung unterdrückt: ${message}`);
|
|
return;
|
|
}
|
|
return originalShowToast(message, type, duration, options);
|
|
};
|
|
}
|
|
}
|
|
|
|
loadDNDState() {
|
|
const saved = localStorage.getItem(this.storageKey);
|
|
return saved === 'true';
|
|
}
|
|
|
|
saveDNDState() {
|
|
localStorage.setItem(this.storageKey, this.isEnabled.toString());
|
|
}
|
|
|
|
loadSuppressedCount() {
|
|
const saved = localStorage.getItem(this.counterKey);
|
|
return saved ? parseInt(saved, 10) : 0;
|
|
}
|
|
|
|
saveSuppressedCount() {
|
|
localStorage.setItem(this.counterKey, this.suppressedCount.toString());
|
|
}
|
|
|
|
// Public API
|
|
getState() {
|
|
return {
|
|
enabled: this.isEnabled,
|
|
suppressedCount: this.suppressedCount,
|
|
suppressedMessages: this.suppressedMessages
|
|
};
|
|
}
|
|
}
|
|
|
|
// DND Manager global verfügbar machen
|
|
window.dndManager = new DoNotDisturbManager();
|
|
</script>
|
|
|
|
{% block scripts %}{% endblock %}
|
|
</body>
|
|
</html> |