"Refactor template files for improved consistency"

This commit is contained in:
2025-05-29 16:23:19 +02:00
parent 97538039c1
commit 4cf89c1220
3 changed files with 580 additions and 396 deletions

View File

@@ -317,6 +317,93 @@
<div class="text-xs font-medium text-slate-900 dark:text-white transition-colors duration-300">{{ current_user.email.split('@')[0] if current_user.email else 'Benutzer' }}</div>
</div>
</button>
<!-- User Menu Dropdown -->
<div id="user-menu-dropdown" class="absolute right-0 mt-2 w-64 bg-white dark:bg-slate-800 rounded-lg shadow-lg border border-slate-200 dark:border-slate-600 z-50 hidden origin-top-right">
<!-- User Info Header -->
<div class="px-4 py-3 border-b border-slate-200 dark:border-slate-600">
<div class="flex items-center space-x-3">
<div class="w-10 h-10 rounded-full bg-blue-500 flex items-center justify-center text-white font-medium">
{{ current_user.email[0].upper() if current_user.email else 'U' }}
</div>
<div class="flex-1 min-w-0">
<p class="text-sm font-medium text-slate-900 dark:text-white truncate">
{{ current_user.full_name if current_user.full_name else current_user.email.split('@')[0] if current_user.email else 'Benutzer' }}
</p>
<p class="text-xs text-slate-500 dark:text-slate-400 truncate">
{{ current_user.email if current_user.email else 'Keine E-Mail' }}
</p>
{% if current_user.is_admin %}
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200 mt-1">
Administrator
</span>
{% endif %}
</div>
</div>
</div>
<!-- Menu Items -->
<div class="py-1">
<a href="{{ url_for('profile_page') }}"
class="flex items-center px-4 py-2 text-sm text-slate-700 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-slate-700 transition-colors duration-200">
<svg class="w-4 h-4 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/>
</svg>
Mein Profil
</a>
<a href="{{ url_for('settings_page') }}"
class="flex items-center px-4 py-2 text-sm text-slate-700 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-slate-700 transition-colors duration-200">
<svg class="w-4 h-4 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"/>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/>
</svg>
Einstellungen
</a>
<a href="{{ url_for('new_job_page') }}"
class="flex items-center px-4 py-2 text-sm text-slate-700 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-slate-700 transition-colors duration-200">
<svg class="w-4 h-4 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"/>
</svg>
Neuer Auftrag
</a>
<a href="{{ url_for('analytics_page') }}"
class="flex items-center px-4 py-2 text-sm text-slate-700 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-slate-700 transition-colors duration-200">
<svg class="w-4 h-4 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"/>
</svg>
Analytik
</a>
</div>
<div class="border-t border-slate-200 dark:border-slate-600">
<a href="{{ url_for('privacy_page') }}"
class="flex items-center px-4 py-2 text-sm text-slate-500 dark:text-slate-400 hover:bg-slate-100 dark:hover:bg-slate-700 transition-colors duration-200">
<svg class="w-4 h-4 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"/>
</svg>
Datenschutz
</a>
<a href="{{ url_for('terms_page') }}"
class="flex items-center px-4 py-2 text-sm text-slate-500 dark:text-slate-400 hover:bg-slate-100 dark:hover:bg-slate-700 transition-colors duration-200">
<svg class="w-4 h-4 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
</svg>
Nutzungsbedingungen
</a>
<button onclick="handleLogout()"
class="flex items-center w-full px-4 py-2 text-sm text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors duration-200">
<svg class="w-4 h-4 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"/>
</svg>
Abmelden
</button>
</div>
</div>
</div>
{% else %}
<!-- Login Button - kompakteres Design -->

View File

@@ -1,46 +1,275 @@
{% extends "base.html" %}
{% block title %}Mercedes-Benz MYP Platform - 3D-Druck Management{% endblock %}
{% block content %}
<div class="space-y-6">
<header class="mb-6">
<h1 class="text-3xl font-bold text-white mb-2">MYP Platform</h1>
<p class="text-gray-300">3D-Drucker Reservierungssystem für Mercedes-Benz</p>
</header>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<!-- Quick Stats -->
<div class="bg-slate-800/70 rounded-2xl p-6 shadow-md">
<h2 class="text-xl font-semibold text-white mb-4">Aktive Druckaufträge</h2>
<div data-api-endpoint="/api/jobs/active" data-counter data-title="Laufende Druckaufträge"></div>
<div class="space-y-16">
<!-- Hero Section -->
<div class="relative overflow-hidden bg-gradient-to-br from-slate-900 via-blue-900 to-indigo-900 text-white rounded-3xl">
<div class="absolute inset-0 bg-black/20"></div>
<div class="absolute inset-0 bg-gradient-to-r from-transparent via-white/5 to-transparent"></div>
<!-- Mercedes-Benz Pattern Background -->
<div class="absolute inset-0 opacity-10">
<div class="absolute inset-0" style="background-image: radial-gradient(circle at 25% 25%, white 2px, transparent 2px), radial-gradient(circle at 75% 75%, white 2px, transparent 2px); background-size: 50px 50px;"></div>
</div>
<div class="bg-slate-800/70 rounded-2xl p-6 shadow-md">
<h2 class="text-xl font-semibold text-white mb-4">Verfügbare Drucker</h2>
<div data-api-endpoint="/api/printers" data-counter data-title="Verfügbare Drucker"></div>
</div>
<div class="bg-slate-800/70 rounded-2xl p-6 shadow-md">
<h2 class="text-xl font-semibold text-white mb-4">Schnellzugriff</h2>
<div class="space-y-3">
<a href="{{ url_for('jobs_page') }}" class="flex items-center p-3 bg-slate-700/40 rounded-xl text-white hover:bg-indigo-600/20 transition-colors">
<svg class="w-5 h-5 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"/>
<div class="relative max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-20">
<div class="text-center">
<!-- Mercedes-Benz Logo -->
<div class="inline-flex items-center justify-center w-24 h-24 bg-white/10 backdrop-blur-sm rounded-full mb-8 border border-white/20">
<svg class="w-12 h-12 text-white" viewBox="0 0 80 80" fill="currentColor">
<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>
Druckaufträge anzeigen
</a>
<a href="{{ url_for('printers_page') }}" class="flex items-center p-3 bg-slate-700/40 rounded-xl text-white hover:bg-indigo-600/20 transition-colors">
<svg class="w-5 h-5 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z"/>
</svg>
3D-Drucker verwalten
</a>
</div>
<h1 class="text-6xl md:text-7xl font-bold mb-6 tracking-tight">
<span class="bg-gradient-to-r from-white to-blue-200 bg-clip-text text-transparent">
MYP Platform
</span>
</h1>
<p class="text-xl md:text-2xl text-blue-100 max-w-4xl mx-auto leading-relaxed mb-12">
Professionelles 3D-Druck Management für Mercedes-Benz.
<br class="hidden md:block">
Das Beste oder nichts - Präzision in jeder Schicht.
</p>
<!-- CTA Buttons -->
<div class="flex flex-col sm:flex-row justify-center gap-6">
{% if current_user.is_authenticated %}
<a href="{{ url_for('dashboard') }}"
class="inline-flex items-center px-8 py-4 bg-white text-slate-900 rounded-xl font-bold text-lg hover:bg-blue-50 transition-all duration-300 hover:scale-105 shadow-lg">
<svg class="w-6 h-6 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2H5a2 2 0 00-2-2z"/>
</svg>
Zum Dashboard
</a>
{% else %}
<a href="{{ url_for('login') }}"
class="inline-flex items-center px-8 py-4 bg-white text-slate-900 rounded-xl font-bold text-lg hover:bg-blue-50 transition-all duration-300 hover:scale-105 shadow-lg">
<svg class="w-6 h-6 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 16l-4-4m0 0l4-4m-4 4h14m-5 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"/>
</svg>
Anmelden
</a>
{% endif %}
<a href="{{ url_for('guest.guest_request_form') }}"
class="inline-flex items-center px-8 py-4 bg-white/10 backdrop-blur-sm border border-white/20 text-white rounded-xl font-bold text-lg hover:bg-white/20 transition-all duration-300 hover:scale-105">
<svg class="w-6 h-6 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/>
</svg>
Gastanfrage stellen
</a>
</div>
</div>
</div>
</div>
<!-- Redirect to dashboard -->
<script>
window.location.href = "{{ url_for('dashboard') }}";
</script>
<!-- Features Section -->
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="text-center mb-16">
<h2 class="text-4xl font-bold text-slate-900 dark:text-white mb-4">
Mercedes-Benz Qualität in der 3D-Produktion
</h2>
<p class="text-xl text-slate-600 dark:text-slate-400 max-w-3xl mx-auto">
Unsere MYP Platform vereint höchste Präzision mit intelligenter Steuerung für professionelle Fertigungsprozesse
</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-8">
<!-- Feature 1 -->
<div class="dashboard-card p-8 text-center group hover:scale-105 transition-all duration-300">
<div class="w-16 h-16 bg-blue-100 dark:bg-blue-900/30 rounded-xl flex items-center justify-center mx-auto mb-6 group-hover:scale-110 transition-transform">
<svg class="w-8 h-8 text-blue-600 dark:text-blue-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"/>
</svg>
</div>
<h3 class="text-xl font-bold text-slate-900 dark:text-white mb-4">Intelligente Druckersteuerung</h3>
<p class="text-slate-600 dark:text-slate-400">
Vollautomatische Verwaltung und Überwachung aller 3D-Drucker mit Echtzeit-Status und prädiktiver Wartung
</p>
</div>
<!-- Feature 2 -->
<div class="dashboard-card p-8 text-center group hover:scale-105 transition-all duration-300">
<div class="w-16 h-16 bg-green-100 dark:bg-green-900/30 rounded-xl flex items-center justify-center mx-auto mb-6 group-hover:scale-110 transition-transform">
<svg class="w-8 h-8 text-green-600 dark:text-green-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01"/>
</svg>
</div>
<h3 class="text-xl font-bold text-slate-900 dark:text-white mb-4">Präzise Auftragsplanung</h3>
<p class="text-slate-600 dark:text-slate-400">
Optimierte Produktionsplanung mit Mercedes-Benz Standards für termingerechte und qualitätsorientierte Fertigung
</p>
</div>
<!-- Feature 3 -->
<div class="dashboard-card p-8 text-center group hover:scale-105 transition-all duration-300">
<div class="w-16 h-16 bg-purple-100 dark:bg-purple-900/30 rounded-xl flex items-center justify-center mx-auto mb-6 group-hover:scale-110 transition-transform">
<svg class="w-8 h-8 text-purple-600 dark:text-purple-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"/>
</svg>
</div>
<h3 class="text-xl font-bold text-slate-900 dark:text-white mb-4">Umfassende Analytik</h3>
<p class="text-slate-600 dark:text-slate-400">
Detaillierte Produktionsstatistiken und Leistungsanalysen für kontinuierliche Optimierung und Qualitätssicherung
</p>
</div>
</div>
</div>
<!-- Statistics Section -->
<div class="bg-gradient-to-r from-slate-50 to-blue-50 dark:from-slate-900 dark:to-slate-800 rounded-3xl mx-4">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-16">
<div class="text-center mb-12">
<h2 class="text-3xl font-bold text-slate-900 dark:text-white mb-4">
Leistung in Zahlen
</h2>
<p class="text-lg text-slate-600 dark:text-slate-400">
Unsere Plattform im Überblick
</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-4 gap-8">
<div class="text-center">
<div class="text-4xl font-bold text-blue-600 dark:text-blue-400 mb-2" id="total-jobs">0</div>
<div class="text-slate-600 dark:text-slate-400">Druckaufträge gesamt</div>
</div>
<div class="text-center">
<div class="text-4xl font-bold text-green-600 dark:text-green-400 mb-2" id="active-printers">0</div>
<div class="text-slate-600 dark:text-slate-400">Aktive Drucker</div>
</div>
<div class="text-center">
<div class="text-4xl font-bold text-purple-600 dark:text-purple-400 mb-2" id="success-rate">98.5%</div>
<div class="text-slate-600 dark:text-slate-400">Erfolgsrate</div>
</div>
<div class="text-center">
<div class="text-4xl font-bold text-orange-600 dark:text-orange-400 mb-2" id="uptime">99.9%</div>
<div class="text-slate-600 dark:text-slate-400">Verfügbarkeit</div>
</div>
</div>
</div>
</div>
<!-- Process Section -->
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="text-center mb-16">
<h2 class="text-4xl font-bold text-slate-900 dark:text-white mb-4">
Ihr Weg zum perfekten Druckteil
</h2>
<p class="text-xl text-slate-600 dark:text-slate-400 max-w-3xl mx-auto">
Von der Anfrage bis zum fertigen Bauteil - Mercedes-Benz Qualität in jedem Schritt
</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-4 gap-8">
<!-- Step 1 -->
<div class="text-center">
<div class="w-16 h-16 bg-blue-500 text-white rounded-full flex items-center justify-center mx-auto mb-4 text-xl font-bold">1</div>
<h3 class="text-lg font-semibold text-slate-900 dark:text-white mb-2">Anfrage stellen</h3>
<p class="text-slate-600 dark:text-slate-400 text-sm">Beschreiben Sie Ihr Projekt und laden Sie Ihre 3D-Datei hoch</p>
</div>
<!-- Step 2 -->
<div class="text-center">
<div class="w-16 h-16 bg-green-500 text-white rounded-full flex items-center justify-center mx-auto mb-4 text-xl font-bold">2</div>
<h3 class="text-lg font-semibold text-slate-900 dark:text-white mb-2">Prüfung & Genehmigung</h3>
<p class="text-slate-600 dark:text-slate-400 text-sm">Unser Team prüft Ihre Anfrage nach Mercedes-Benz Standards</p>
</div>
<!-- Step 3 -->
<div class="text-center">
<div class="w-16 h-16 bg-purple-500 text-white rounded-full flex items-center justify-center mx-auto mb-4 text-xl font-bold">3</div>
<h3 class="text-lg font-semibold text-slate-900 dark:text-white mb-2">Automatische Produktion</h3>
<p class="text-slate-600 dark:text-slate-400 text-sm">Intelligente Drucker-Zuweisung und überwachte Fertigung</p>
</div>
<!-- Step 4 -->
<div class="text-center">
<div class="w-16 h-16 bg-orange-500 text-white rounded-full flex items-center justify-center mx-auto mb-4 text-xl font-bold">4</div>
<h3 class="text-lg font-semibold text-slate-900 dark:text-white mb-2">Qualitätssicherung</h3>
<p class="text-slate-600 dark:text-slate-400 text-sm">Abnahme und Bereitstellung des fertigen Bauteils</p>
</div>
</div>
</div>
<!-- CTA Section -->
<div class="dashboard-card p-12 text-center mx-4">
<h2 class="text-3xl font-bold text-slate-900 dark:text-white mb-4">
Bereit für Mercedes-Benz Qualität?
</h2>
<p class="text-lg text-slate-600 dark:text-slate-400 mb-8 max-w-2xl mx-auto">
Starten Sie noch heute mit professioneller 3D-Druck Technologie und erleben Sie,
was präzise Fertigung nach Mercedes-Benz Standards bedeutet.
</p>
<div class="flex flex-col sm:flex-row justify-center gap-4">
{% if current_user.is_authenticated %}
<a href="{{ url_for('jobs_page') }}"
class="btn-primary">
Neuen Auftrag erstellen
</a>
{% else %}
<a href="{{ url_for('login') }}"
class="btn-primary">
Jetzt anmelden
</a>
{% endif %}
<a href="{{ url_for('guest.guest_request_form') }}"
class="btn-secondary">
Gastanfrage stellen
</a>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Lade Live-Statistiken
loadStatistics();
// Alle 30 Sekunden aktualisieren
setInterval(loadStatistics, 30000);
});
async function loadStatistics() {
try {
const response = await fetch('/api/statistics/public');
if (response.ok) {
const stats = await response.json();
// Animierte Zähler
animateCounter('total-jobs', stats.total_jobs || 0);
animateCounter('active-printers', stats.active_printers || 0);
// Statische Werte mit Animation
animatePercentage('success-rate', stats.success_rate || 98.5);
animatePercentage('uptime', stats.uptime || 99.9);
}
} catch (error) {
console.log('Statistiken konnten nicht geladen werden');
}
}
function animateCounter(elementId, targetValue) {
const element = document.getElementById(elementId);
const currentValue = parseInt(element.textContent) || 0;
const increment = Math.ceil((targetValue - currentValue) / 20);
if (currentValue < targetValue) {
element.textContent = Math.min(currentValue + increment, targetValue);
setTimeout(() => animateCounter(elementId, targetValue), 50);
}
}
function animatePercentage(elementId, targetValue) {
const element = document.getElementById(elementId);
element.textContent = targetValue.toFixed(1) + '%';
}
</script>
{% endblock %}

View File

@@ -1,412 +1,280 @@
{% extends "base.html" %}
{% block title %}Anmeldung - Mercedes-Benz MYP Platform{% endblock %}
{% block title %}Anmelden - Mercedes-Benz MYP Platform{% endblock %}
{% block content %}
<div class="min-h-screen bg-gradient-to-br from-gray-50 to-gray-100 dark:from-gray-900 dark:to-gray-800 flex items-center justify-center p-4 transition-all duration-500">
<!-- Floating Background Elements -->
<div class="absolute inset-0 overflow-hidden pointer-events-none">
<!-- Animated Mercedes Stars -->
<div class="absolute top-1/4 left-1/4 w-16 h-16 opacity-5 dark:opacity-10 animate-pulse">
<svg class="w-full h-full text-gray-600 dark:text-gray-400" 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 class="absolute top-3/4 right-1/4 w-12 h-12 opacity-5 dark:opacity-10 animate-pulse" style="animation-delay: 2s;">
<svg class="w-full h-full text-gray-600 dark:text-gray-400" 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 class="absolute top-1/2 right-1/3 w-8 h-8 opacity-5 dark:opacity-10 animate-pulse" style="animation-delay: 4s;">
<svg class="w-full h-full text-gray-600 dark:text-gray-400" 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>
<!-- Decorative Lines -->
<div class="absolute inset-0 opacity-5 dark:opacity-10">
<div class="absolute top-1/3 left-0 right-0 h-px bg-gradient-to-r from-transparent via-gray-600 dark:via-gray-400 to-transparent"></div>
<div class="absolute top-2/3 left-0 right-0 h-px bg-gradient-to-r from-transparent via-gray-600 dark:via-gray-400 to-transparent"></div>
</div>
</div>
<!-- Login Card -->
<div class="w-full max-w-md relative z-10">
<div class="bg-white dark:bg-gray-800 backdrop-blur-xl bg-opacity-95 dark:bg-opacity-95 rounded-2xl shadow-2xl border border-gray-200 dark:border-gray-700 p-8 transition-all duration-300 transform hover:shadow-3xl">
<!-- Mercedes-Benz Header -->
<div class="text-center mb-8">
<div class="flex justify-center mb-6">
<div class="w-20 h-20 transition-transform duration-500 hover:scale-110 hover:rotate-12">
<svg class="w-full h-full text-gray-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>
<h1 class="text-3xl font-bold text-gray-900 dark:text-white mb-1 tracking-tight transition-colors duration-300">Mercedes-Benz</h1>
<div class="w-16 h-0.5 bg-gray-300 dark:bg-gray-600 mx-auto my-3"></div>
<h2 class="text-xl font-medium text-gray-700 dark:text-gray-300 mb-1 transition-colors duration-300">MYP Platform</h2>
<p class="text-gray-600 dark:text-gray-400 text-sm transition-colors duration-300">3D-Druck Management System</p>
<div class="min-h-screen flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8">
<div class="max-w-md w-full space-y-8">
<!-- Header -->
<div class="text-center">
<!-- Mercedes-Benz Logo -->
<div class="inline-flex items-center justify-center w-20 h-20 bg-white/10 backdrop-blur-sm rounded-full mb-6 border border-white/20">
<svg class="w-10 h-10 text-slate-900 dark:text-white" viewBox="0 0 80 80" fill="currentColor">
<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>
<h2 class="text-3xl font-bold text-slate-900 dark:text-white mb-2">
Bei MYP Platform anmelden
</h2>
<p class="text-slate-600 dark:text-slate-400">
Zugang zu Ihrem professionellen 3D-Druck Dashboard
</p>
</div>
<!-- Flash Messages -->
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="mb-6 p-4 {% if category == 'error' %}bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800{% else %}bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800{% endif %} rounded-lg transition-all duration-300">
<div class="flex">
<div class="flex-shrink-0">
{% if category == 'error' %}
<svg class="h-5 w-5 text-red-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"/>
</svg>
{% else %}
<svg class="h-5 w-5 text-blue-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
{% endif %}
</div>
<div class="ml-3">
<h3 class="text-sm font-medium {% if category == 'error' %}text-red-800 dark:text-red-200{% else %}text-blue-800 dark:text-blue-200{% endif %}">{{ category|capitalize }}</h3>
<div class="mt-1 text-sm {% if category == 'error' %}text-red-700 dark:text-red-300{% else %}text-blue-700 dark:text-blue-300{% endif %}">
{{ message }}
</div>
</div>
</div>
</div>
{% endfor %}
{% endif %}
{% endwith %}
<!-- Login Form -->
<form id="login-form" action="/auth/login" method="POST" class="space-y-6">
<!-- CSRF-Token hinzufügen -->
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<!-- Login Form -->
<div class="dashboard-card p-8">
<form id="loginForm" method="POST" action="{{ url_for('login') }}" class="space-y-6">
{{ form.hidden_tag() if form }}
<div class="space-y-4">
<div>
<label for="username" class="block text-sm font-semibold text-gray-700 dark:text-gray-300 mb-2 transition-colors duration-300">
Benutzername
</label>
<div class="relative group">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<svg class="h-5 w-5 text-gray-400 dark:text-gray-500 group-focus-within:text-blue-500 dark:group-focus-within:text-blue-400 transition-colors duration-300" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 12a4 4 0 10-8 0 4 4 0 008 0zm0 0v1.5a2.5 2.5 0 005 0V12a9 9 0 10-9 9m4.5-1.206a8.959 8.959 0 01-4.5 1.207"/>
</svg>
</div>
<input
type="text"
id="username"
name="username"
required
class="block w-full pl-10 pr-3 py-3 border-2 border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-300"
placeholder="Benutzername oder E-Mail"
autocomplete="username"
>
<!-- E-Mail Address -->
<div>
<label for="email" class="block text-sm font-medium text-slate-700 dark:text-slate-300 mb-2">
E-Mail-Adresse
</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<svg class="h-5 w-5 text-slate-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 12a4 4 0 10-8 0 4 4 0 008 0zm0 0v1.5a2.5 2.5 0 005 0V12a9 9 0 10-9 9m4.5-1.206a8.959 8.959 0 01-4.5 1.207"/>
</svg>
</div>
{% if form %}
{{ form.email(class="block w-full pl-10 pr-3 py-3 border border-gray-300 dark:border-slate-600 rounded-lg bg-white dark:bg-slate-800 text-slate-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-blue-500", placeholder="ihre.email@mercedes-benz.com", autocomplete="email") }}
{% else %}
<input type="email" id="email" name="email" required
class="block w-full pl-10 pr-3 py-3 border border-gray-300 dark:border-slate-600 rounded-lg bg-white dark:bg-slate-800 text-slate-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
placeholder="ihre.email@mercedes-benz.com" autocomplete="email">
{% endif %}
</div>
<div>
<label for="password" class="block text-sm font-semibold text-gray-700 dark:text-gray-300 mb-2 transition-colors duration-300">
Passwort
</label>
<div class="relative group">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<svg class="h-5 w-5 text-gray-400 dark:text-gray-500 group-focus-within:text-blue-500 dark:group-focus-within:text-blue-400 transition-colors duration-300" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"/>
</svg>
</div>
<input
type="password"
id="password"
name="password"
required
class="block w-full pl-10 pr-3 py-3 border-2 border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-300"
placeholder="••••••••"
autocomplete="current-password"
>
{% if form and form.email.errors %}
<div class="mt-1 text-sm text-red-600">
{% for error in form.email.errors %}
<p>{{ error }}</p>
{% endfor %}
</div>
</div>
{% endif %}
</div>
<!-- Password -->
<div>
<label for="password" class="block text-sm font-medium text-slate-700 dark:text-slate-300 mb-2">
Passwort
</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<svg class="h-5 w-5 text-slate-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"/>
</svg>
</div>
{% if form %}
{{ form.password(class="block w-full pl-10 pr-10 py-3 border border-gray-300 dark:border-slate-600 rounded-lg bg-white dark:bg-slate-800 text-slate-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-blue-500", placeholder="Ihr Passwort", autocomplete="current-password") }}
{% else %}
<input type="password" id="password" name="password" required
class="block w-full pl-10 pr-10 py-3 border border-gray-300 dark:border-slate-600 rounded-lg bg-white dark:bg-slate-800 text-slate-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
placeholder="Ihr Passwort" autocomplete="current-password">
{% endif %}
<button type="button" id="togglePassword" class="absolute inset-y-0 right-0 pr-3 flex items-center">
<svg id="eyeOpen" class="h-5 w-5 text-slate-400 hover:text-slate-600 dark:hover:text-slate-300 transition-colors" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/>
</svg>
<svg id="eyeClosed" class="h-5 w-5 text-slate-400 hover:text-slate-600 dark:hover:text-slate-300 transition-colors hidden" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.878 9.878L3 3m6.878 6.878L21 21"/>
</svg>
</button>
</div>
{% if form and form.password.errors %}
<div class="mt-1 text-sm text-red-600">
{% for error in form.password.errors %}
<p>{{ error }}</p>
{% endfor %}
</div>
{% endif %}
</div>
<!-- Remember Me & Forgot Password -->
<div class="flex items-center justify-between">
<div class="flex items-center">
<input
id="remember-me"
name="remember-me"
type="checkbox"
class="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 dark:border-gray-600 rounded transition-colors duration-300"
>
<label for="remember-me" class="ml-2 block text-sm text-gray-700 dark:text-gray-300 transition-colors duration-300">
Angemeldet bleiben
</label>
{% if form and form.remember_me %}
{{ form.remember_me(class="w-4 h-4 text-blue-600 bg-white dark:bg-slate-800 border-gray-300 dark:border-slate-600 rounded focus:ring-blue-500 focus:ring-2") }}
{{ form.remember_me.label(class="ml-2 text-sm text-slate-700 dark:text-slate-300") }}
{% else %}
<input type="checkbox" id="remember_me" name="remember_me"
class="w-4 h-4 text-blue-600 bg-white dark:bg-slate-800 border-gray-300 dark:border-slate-600 rounded focus:ring-blue-500 focus:ring-2">
<label for="remember_me" class="ml-2 text-sm text-slate-700 dark:text-slate-300">
Angemeldet bleiben
</label>
{% endif %}
</div>
<div class="text-sm">
<a href="#" class="font-medium text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 transition-colors duration-300">
<a href="{{ url_for('reset_password_request') if url_for('reset_password_request') else '#' }}"
class="text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 transition-colors">
Passwort vergessen?
</a>
</div>
</div>
<button
type="submit"
class="w-full flex justify-center items-center py-3 px-4 bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600 border border-transparent rounded-lg shadow-md text-sm font-semibold text-white hover:shadow-lg focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-300 transform hover:-translate-y-0.5"
id="login-button"
>
<span id="login-text">Anmelden</span>
<svg id="login-spinner" class="hidden animate-spin ml-3 h-5 w-5" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
</button>
<!-- Submit Button -->
<div>
<button type="submit" id="submitBtn"
class="w-full flex justify-center items-center py-3 px-4 border border-transparent rounded-lg shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-300">
<svg id="loadingSpinner" class="hidden animate-spin -ml-1 mr-2 h-4 w-4 text-white" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
<span id="submitText">Anmelden</span>
</button>
</div>
</form>
<!-- Error Display -->
<div id="error-message" class="hidden mt-4 p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg transition-all duration-300">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-red-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"/>
</svg>
</div>
<div class="ml-3">
<h3 class="text-sm font-medium text-red-800 dark:text-red-200">Anmeldung fehlgeschlagen</h3>
<div class="mt-2 text-sm text-red-700 dark:text-red-300" id="error-text"></div>
</div>
</div>
</div>
<!-- Offline Notice -->
<div id="offline-notice" class="hidden mt-4 p-4 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg transition-all duration-300">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-yellow-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"/>
</svg>
</div>
<div class="ml-3">
<h3 class="text-sm font-medium text-yellow-800 dark:text-yellow-200">Offline-Modus</h3>
<div class="mt-2 text-sm text-yellow-700 dark:text-yellow-300">
Sie sind derzeit offline. Die Anwendung läuft im eingeschränkten Modus.
</div>
</div>
</div>
</div>
<!-- Footer -->
<div class="mt-8 pt-6 border-t border-gray-200 dark:border-gray-700 transition-colors duration-300">
<div class="text-center">
<p class="text-xs text-gray-500 dark:text-gray-400 transition-colors duration-300">
© 2024 Mercedes-Benz Group AG
</p>
<p class="text-xs text-gray-400 dark:text-gray-500 mt-1 transition-colors duration-300">
Das Beste oder nichts
</p>
</div>
</div>
</div>
</div>
<!-- Connection Status Indicator -->
<div id="connection-status-login" class="fixed bottom-6 right-6 z-50 bg-white dark:bg-gray-800 backdrop-blur-lg bg-opacity-90 dark:bg-opacity-90 border border-gray-200 dark:border-gray-700 rounded-full px-4 py-2 shadow-lg transition-all duration-300">
<div class="flex items-center space-x-2">
<div class="w-2 h-2 bg-green-500 rounded-full animate-pulse"></div>
<span class="text-xs font-medium text-gray-700 dark:text-gray-300 transition-colors duration-300">Online</span>
<!-- Alternative Actions -->
<div class="text-center space-y-4">
<div class="relative">
<div class="absolute inset-0 flex items-center">
<div class="w-full border-t border-gray-300 dark:border-slate-600"></div>
</div>
<div class="relative flex justify-center text-sm">
<span class="px-2 bg-white dark:bg-black text-slate-500 dark:text-slate-400">
Oder
</span>
</div>
</div>
<div class="space-y-3">
<a href="{{ url_for('guest.guest_request_form') }}"
class="w-full flex justify-center items-center py-3 px-4 border border-gray-300 dark:border-slate-600 rounded-lg shadow-sm text-sm font-medium text-slate-700 dark:text-slate-300 bg-white dark:bg-slate-800 hover:bg-gray-50 dark:hover:bg-slate-700 transition-colors">
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/>
</svg>
Als Gast eine Anfrage stellen
</a>
<a href="{{ url_for('index') }}"
class="w-full flex justify-center items-center py-3 px-4 border border-transparent rounded-lg text-sm font-medium text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 transition-colors">
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"/>
</svg>
Zurück zur Startseite
</a>
</div>
</div>
</div>
</div>
{% endblock %}
{% block extra_js %}
<script>
document.addEventListener('DOMContentLoaded', function() {
const loginForm = document.getElementById('login-form');
const loginButton = document.getElementById('login-button');
const loginText = document.getElementById('login-text');
const loginSpinner = document.getElementById('login-spinner');
const errorMessage = document.getElementById('error-message');
const errorText = document.getElementById('error-text');
const offlineNotice = document.getElementById('offline-notice');
const form = document.getElementById('loginForm');
const submitBtn = document.getElementById('submitBtn');
const submitText = document.getElementById('submitText');
const loadingSpinner = document.getElementById('loadingSpinner');
const togglePassword = document.getElementById('togglePassword');
const passwordInput = document.getElementById('password');
const eyeOpen = document.getElementById('eyeOpen');
const eyeClosed = document.getElementById('eyeClosed');
// Handle form submission
loginForm.addEventListener('submit', async function(e) {
e.preventDefault();
// Show loading state
setLoadingState(true);
hideError();
// Offline-Hinweis anzeigen, aber Anmeldung trotzdem erlauben
if (!navigator.onLine) {
showOfflineNotice();
} else {
hideOfflineNotice();
}
const formData = new FormData(loginForm);
const username = formData.get('username');
const password = formData.get('password');
const rememberMe = formData.get('remember-me') === 'on';
try {
const response = await fetch('/auth/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-CSRFToken': '{{ csrf_token() }}'
},
body: JSON.stringify({
username: username,
password: password,
remember_me: rememberMe
})
});
// Prüfen, ob die Antwort JSON ist
const contentType = response.headers.get('content-type');
if (contentType && contentType.includes('application/json')) {
const data = await response.json();
if (response.ok) {
// Erfolg - zur Zielseite weiterleiten
loginText.textContent = 'Erfolgreich angemeldet...';
setTimeout(() => {
window.location.href = data.redirect_url || '/dashboard';
}, 1000);
} else {
// Fehler - Fehlermeldung anzeigen
showError(data.error || 'Anmeldung fehlgeschlagen. Bitte überprüfen Sie Ihre Eingaben.');
setLoadingState(false);
}
} else if (response.redirected) {
// Erfolg mit Umleitung - Umleitung folgen
window.location.href = response.url;
// Password visibility toggle
if (togglePassword && passwordInput) {
togglePassword.addEventListener('click', function() {
if (passwordInput.type === 'password') {
passwordInput.type = 'text';
eyeOpen.classList.add('hidden');
eyeClosed.classList.remove('hidden');
} else {
// Unerwartete Antwort
console.error('Unerwartete Serverantwort:', await response.text());
showError('Unerwartete Serverantwort. Bitte versuchen Sie es später erneut.');
setLoadingState(false);
passwordInput.type = 'password';
eyeOpen.classList.remove('hidden');
eyeClosed.classList.add('hidden');
}
} catch (error) {
console.error('Login error:', error);
// Im Falle eines Netzwerkfehlers (wahrscheinlich offline)
showError('Verbindungsfehler. Stellen Sie sicher, dass der Server läuft und erreichbar ist.');
setLoadingState(false);
}
});
function setLoadingState(loading) {
loginButton.disabled = loading;
if (loading) {
loginText.textContent = 'Anmeldung läuft...';
loginSpinner.classList.remove('hidden');
} else {
loginText.textContent = 'Anmelden';
loginSpinner.classList.add('hidden');
}
});
}
function showError(message) {
errorText.textContent = message;
errorMessage.classList.remove('hidden');
errorMessage.classList.add('animate-pulse');
setTimeout(() => {
errorMessage.classList.remove('animate-pulse');
}, 1000);
// Form submission handling
if (form) {
form.addEventListener('submit', function(e) {
// Show loading state
submitBtn.disabled = true;
loadingSpinner.classList.remove('hidden');
submitText.textContent = 'Wird angemeldet...';
});
}
function hideError() {
errorMessage.classList.add('hidden');
// Form validation
const emailInput = document.getElementById('email');
if (emailInput) {
emailInput.addEventListener('blur', function() {
validateEmail();
});
emailInput.addEventListener('input', function() {
clearError(emailInput);
});
}
function showOfflineNotice() {
offlineNotice.classList.remove('hidden');
offlineNotice.classList.add('animate-pulse');
setTimeout(() => {
offlineNotice.classList.remove('animate-pulse');
}, 1000);
if (passwordInput) {
passwordInput.addEventListener('input', function() {
clearError(passwordInput);
});
}
function hideOfflineNotice() {
offlineNotice.classList.add('hidden');
// Auto-focus first empty field
if (emailInput && !emailInput.value) {
emailInput.focus();
} else if (passwordInput && !passwordInput.value) {
passwordInput.focus();
}
});
// Connection status monitoring
function updateConnectionStatus() {
const statusEl = document.getElementById('connection-status-login');
if (navigator.onLine) {
statusEl.innerHTML = `
<div class="flex items-center space-x-2">
<div class="w-2 h-2 bg-green-500 rounded-full animate-pulse"></div>
<span class="text-xs font-medium text-gray-700 dark:text-gray-300 transition-colors duration-300">Online</span>
</div>
`;
statusEl.className = 'fixed bottom-6 right-6 z-50 bg-white dark:bg-gray-800 backdrop-blur-lg bg-opacity-90 dark:bg-opacity-90 border border-gray-200 dark:border-gray-700 rounded-full px-4 py-2 shadow-lg transition-all duration-300';
hideOfflineNotice();
} else {
statusEl.innerHTML = `
<div class="flex items-center space-x-2">
<div class="w-2 h-2 bg-yellow-500 rounded-full animate-pulse"></div>
<span class="text-xs font-medium text-gray-700 dark:text-gray-300 transition-colors duration-300">Offline-Modus</span>
</div>
`;
statusEl.className = 'fixed bottom-6 right-6 z-50 bg-yellow-50 dark:bg-yellow-900 backdrop-blur-lg bg-opacity-90 dark:bg-opacity-90 border border-yellow-200 dark:border-yellow-700 rounded-full px-4 py-2 shadow-lg transition-all duration-300';
showOfflineNotice();
}
}
// Listen for connection changes
window.addEventListener('online', updateConnectionStatus);
window.addEventListener('offline', updateConnectionStatus);
function validateEmail() {
const emailInput = document.getElementById('email');
const email = emailInput.value.trim();
// Initial status
updateConnectionStatus();
if (email && !isValidEmail(email)) {
showError(emailInput, 'Bitte geben Sie eine gültige E-Mail-Adresse ein');
return false;
}
clearError(emailInput);
return true;
}
// Auto-focus email field
document.getElementById('username').focus();
function isValidEmail(email) {
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return emailRegex.test(email);
}
// Enhanced form validation with visual feedback
const inputs = document.querySelectorAll('input[type="text"], input[type="password"]');
inputs.forEach(input => {
input.addEventListener('blur', function() {
if (this.value && this.checkValidity()) {
this.classList.remove('border-red-300', 'dark:border-red-600');
this.classList.add('border-green-300', 'dark:border-green-600');
} else if (this.value && !this.checkValidity()) {
this.classList.remove('border-green-300', 'dark:border-green-600');
this.classList.add('border-red-300', 'dark:border-red-600');
}
});
function showError(input, message) {
clearError(input);
input.classList.add('border-red-500', 'focus:border-red-500', 'focus:ring-red-500');
const errorDiv = document.createElement('div');
errorDiv.className = 'mt-1 text-sm text-red-600 error-message';
errorDiv.textContent = message;
input.parentNode.appendChild(errorDiv);
}
input.addEventListener('focus', function() {
this.classList.remove('border-red-300', 'dark:border-red-600', 'border-green-300', 'dark:border-green-600');
});
});
function clearError(input) {
input.classList.remove('border-red-500', 'focus:border-red-500', 'focus:ring-red-500');
const errorMessage = input.parentNode.querySelector('.error-message');
if (errorMessage) {
errorMessage.remove();
}
}
// Add subtle entrance animation
setTimeout(() => {
document.querySelector('.w-full.max-w-md').classList.add('animate-fade-in');
}, 100);
// Auto-submit form on Enter key in any field
document.addEventListener('keypress', function(e) {
if (e.key === 'Enter' && e.target.form === document.getElementById('loginForm')) {
e.preventDefault();
document.getElementById('loginForm').submit();
}
});
</script>
{% endblock %}