"Update login, new job, and settings templates with improved UI elements (feat)"
This commit is contained in:
@@ -2,14 +2,257 @@
|
||||
|
||||
{% block title %}Anmelden - Mercedes-Benz MYP Platform{% endblock %}
|
||||
|
||||
{% block extra_css %}
|
||||
<style>
|
||||
/* Mercedes-Benz Corporate Design */
|
||||
.text-mercedes-black { color: #000000; }
|
||||
.text-mercedes-gray { color: #6b7280; }
|
||||
.text-mercedes-silver { color: #9ca3af; }
|
||||
.text-mercedes-blue { color: #0073ce; }
|
||||
.text-mercedes-green { color: #008c32; }
|
||||
.text-mercedes-red { color: #dc2626; }
|
||||
|
||||
.bg-mercedes-black { background-color: #000000; }
|
||||
.bg-mercedes-silver { background-color: #e5e7eb; }
|
||||
.bg-mercedes-blue { background-color: #0073ce; }
|
||||
.bg-mercedes-green { background-color: #008c32; }
|
||||
|
||||
.border-mercedes-silver { border-color: #d1d5db; }
|
||||
.border-mercedes-blue { border-color: #0073ce; }
|
||||
|
||||
.hover\:border-mercedes-blue:hover { border-color: #0073ce; }
|
||||
.focus\:ring-mercedes-blue:focus {
|
||||
--tw-ring-color: #0073ce;
|
||||
--tw-ring-opacity: 0.5;
|
||||
}
|
||||
.focus\:border-mercedes-blue:focus { border-color: #0073ce; }
|
||||
|
||||
/* Mercedes Login Container */
|
||||
.mercedes-login-container {
|
||||
background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
|
||||
min-height: 100vh;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.dark .mercedes-login-container {
|
||||
background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
|
||||
}
|
||||
|
||||
.mercedes-login-container::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23000000' fill-opacity='0.02'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
|
||||
animation: backgroundFloat 20s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes backgroundFloat {
|
||||
0%, 100% { transform: translateY(0px); }
|
||||
50% { transform: translateY(-10px); }
|
||||
}
|
||||
|
||||
/* Mercedes Card Effect */
|
||||
.mercedes-card {
|
||||
background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
|
||||
border: 1px solid #e5e7eb;
|
||||
box-shadow:
|
||||
0 25px 50px -12px rgba(0, 0, 0, 0.25),
|
||||
0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
||||
transition: all 0.3s ease;
|
||||
backdrop-filter: blur(10px);
|
||||
border-radius: 16px;
|
||||
}
|
||||
|
||||
.dark .mercedes-card {
|
||||
background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
|
||||
border-color: #334155;
|
||||
box-shadow:
|
||||
0 25px 50px -12px rgba(0, 0, 0, 0.5),
|
||||
0 4px 6px -1px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.mercedes-card:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow:
|
||||
0 32px 64px -12px rgba(0, 0, 0, 0.35),
|
||||
0 8px 16px -4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* Mercedes Logo Animation */
|
||||
.mercedes-logo {
|
||||
animation: logoFloat 3s ease-in-out infinite;
|
||||
filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
|
||||
}
|
||||
|
||||
@keyframes logoFloat {
|
||||
0%, 100% { transform: translateY(0px) rotate(0deg); }
|
||||
50% { transform: translateY(-5px) rotate(5deg); }
|
||||
}
|
||||
|
||||
/* Enhanced Form Inputs */
|
||||
.mercedes-input {
|
||||
transition: all 0.2s ease;
|
||||
border: 1px solid #d1d5db;
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.mercedes-input:focus {
|
||||
border-color: #0073ce;
|
||||
box-shadow:
|
||||
0 0 0 3px rgba(0, 115, 206, 0.1),
|
||||
0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
||||
transform: translateY(-1px);
|
||||
background: rgba(255, 255, 255, 1);
|
||||
}
|
||||
|
||||
.dark .mercedes-input {
|
||||
background: rgba(30, 41, 59, 0.8);
|
||||
border-color: #475569;
|
||||
color: #f8fafc;
|
||||
}
|
||||
|
||||
.dark .mercedes-input:focus {
|
||||
border-color: #0ea5e9;
|
||||
box-shadow:
|
||||
0 0 0 3px rgba(14, 165, 233, 0.1),
|
||||
0 4px 6px -1px rgba(0, 0, 0, 0.3);
|
||||
background: rgba(30, 41, 59, 1);
|
||||
}
|
||||
|
||||
/* Mercedes Button */
|
||||
.mercedes-button {
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
box-shadow: 0 4px 14px 0 rgba(0, 115, 206, 0.39);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.mercedes-button::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -100%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
|
||||
transition: left 0.5s;
|
||||
}
|
||||
|
||||
.mercedes-button:hover::before {
|
||||
left: 100%;
|
||||
}
|
||||
|
||||
.mercedes-button:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 8px 25px 0 rgba(0, 115, 206, 0.5);
|
||||
}
|
||||
|
||||
/* Form Validation States */
|
||||
.input-error {
|
||||
border-color: #dc2626 !important;
|
||||
box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1) !important;
|
||||
animation: shake 0.5s ease-in-out;
|
||||
}
|
||||
|
||||
.input-success {
|
||||
border-color: #16a34a !important;
|
||||
box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1) !important;
|
||||
}
|
||||
|
||||
@keyframes shake {
|
||||
0%, 100% { transform: translateX(0); }
|
||||
25% { transform: translateX(-5px); }
|
||||
75% { transform: translateX(5px); }
|
||||
}
|
||||
|
||||
/* Loading Animation */
|
||||
.loading-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 9999;
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.loading-overlay.active {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.loading-content {
|
||||
background: white;
|
||||
padding: 2rem;
|
||||
border-radius: 12px;
|
||||
text-align: center;
|
||||
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
|
||||
transform: scale(0.8);
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.loading-overlay.active .loading-content {
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
.dark .loading-content {
|
||||
background: #1e293b;
|
||||
color: #f8fafc;
|
||||
}
|
||||
|
||||
/* Security Indicator */
|
||||
.security-indicator {
|
||||
background: linear-gradient(90deg, #16a34a, #22c55e);
|
||||
color: white;
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 8px;
|
||||
font-size: 0.875rem;
|
||||
margin-bottom: 1rem;
|
||||
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* Responsive Design */
|
||||
@media (max-width: 768px) {
|
||||
.mercedes-card {
|
||||
margin: 1rem;
|
||||
padding: 1.5rem !important;
|
||||
}
|
||||
|
||||
.mercedes-logo {
|
||||
width: 60px !important;
|
||||
height: 60px !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Dark Mode Enhancements */
|
||||
.dark .security-indicator {
|
||||
background: linear-gradient(90deg, #15803d, #16a34a);
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="min-h-screen flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8">
|
||||
<div class="mercedes-login-container 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">
|
||||
<div class="mercedes-logo 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-mercedes-black 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
|
||||
@@ -19,40 +262,48 @@
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<h2 class="text-3xl font-bold text-slate-900 dark:text-white mb-2">
|
||||
<h2 class="text-3xl font-bold text-mercedes-black dark:text-white mb-2">
|
||||
Bei MYP Platform anmelden
|
||||
</h2>
|
||||
<p class="text-slate-600 dark:text-slate-400">
|
||||
<p class="text-mercedes-gray dark:text-slate-400">
|
||||
Zugang zu Ihrem professionellen 3D-Druck Dashboard
|
||||
</p>
|
||||
|
||||
<!-- Security Indicator -->
|
||||
<div class="security-indicator">
|
||||
<svg class="w-4 h-4 inline mr-2" 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>
|
||||
Sichere SSL-Verbindung aktiv
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Login Form -->
|
||||
<div class="dashboard-card p-8">
|
||||
<form id="loginForm" method="POST" action="{{ url_for('login') }}" class="space-y-6">
|
||||
<div class="mercedes-card p-8">
|
||||
<form id="loginForm" method="POST" action="{{ url_for('login') if url_for else '#' }}" class="space-y-6">
|
||||
{{ form.hidden_tag() if form }}
|
||||
|
||||
<!-- E-Mail Address -->
|
||||
<div>
|
||||
<label for="email" class="block text-sm font-medium text-slate-700 dark:text-slate-300 mb-2">
|
||||
<label for="email" class="block text-sm font-medium text-mercedes-black 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">
|
||||
<svg class="h-5 w-5 text-mercedes-silver" 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") }}
|
||||
{{ form.email(class="mercedes-input block w-full pl-10 pr-3 py-3 rounded-lg focus:ring-2 focus:ring-mercedes-blue focus:border-mercedes-blue", 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"
|
||||
class="mercedes-input block w-full pl-10 pr-3 py-3 rounded-lg focus:ring-2 focus:ring-mercedes-blue focus:border-mercedes-blue"
|
||||
placeholder="ihre.email@mercedes-benz.com" autocomplete="email">
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if form and form.email.errors %}
|
||||
<div class="mt-1 text-sm text-red-600">
|
||||
<div class="mt-1 text-sm text-mercedes-red">
|
||||
{% for error in form.email.errors %}
|
||||
<p>{{ error }}</p>
|
||||
{% endfor %}
|
||||
@@ -62,34 +313,42 @@
|
||||
|
||||
<!-- Password -->
|
||||
<div>
|
||||
<label for="password" class="block text-sm font-medium text-slate-700 dark:text-slate-300 mb-2">
|
||||
<label for="password" class="block text-sm font-medium text-mercedes-black 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">
|
||||
<svg class="h-5 w-5 text-mercedes-silver" 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") }}
|
||||
{{ form.password(class="mercedes-input block w-full pl-10 pr-10 py-3 rounded-lg focus:ring-2 focus:ring-mercedes-blue focus:border-mercedes-blue", 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"
|
||||
class="mercedes-input block w-full pl-10 pr-10 py-3 rounded-lg focus:ring-2 focus:ring-mercedes-blue focus:border-mercedes-blue"
|
||||
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">
|
||||
<svg id="eyeOpen" class="h-5 w-5 text-mercedes-silver hover:text-mercedes-blue 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">
|
||||
<svg id="eyeClosed" class="h-5 w-5 text-mercedes-silver hover:text-mercedes-blue 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>
|
||||
<div id="password-strength" class="mt-1 hidden">
|
||||
<div class="flex items-center space-x-1">
|
||||
<div class="flex-1 bg-gray-200 dark:bg-gray-700 rounded-full h-1">
|
||||
<div id="strength-bar" class="h-1 rounded-full transition-all duration-300"></div>
|
||||
</div>
|
||||
<span id="strength-text" class="text-xs font-medium"></span>
|
||||
</div>
|
||||
</div>
|
||||
{% if form and form.password.errors %}
|
||||
<div class="mt-1 text-sm text-red-600">
|
||||
<div class="mt-1 text-sm text-mercedes-red">
|
||||
{% for error in form.password.errors %}
|
||||
<p>{{ error }}</p>
|
||||
{% endfor %}
|
||||
@@ -101,29 +360,43 @@
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex items-center">
|
||||
{% 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") }}
|
||||
{{ form.remember_me(class="w-4 h-4 text-mercedes-blue bg-white dark:bg-slate-800 border-mercedes-silver rounded focus:ring-mercedes-blue focus:ring-2") }}
|
||||
{{ form.remember_me.label(class="ml-2 text-sm text-mercedes-black 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">
|
||||
class="w-4 h-4 text-mercedes-blue bg-white dark:bg-slate-800 border-mercedes-silver rounded focus:ring-mercedes-blue focus:ring-2">
|
||||
<label for="remember_me" class="ml-2 text-sm text-mercedes-black dark:text-slate-300">
|
||||
Angemeldet bleiben
|
||||
</label>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="text-sm">
|
||||
<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">
|
||||
<a href="{{ url_for('reset_password_request') if url_for and url_for('reset_password_request') else '#' }}"
|
||||
class="text-mercedes-blue hover:text-blue-700 transition-colors">
|
||||
Passwort vergessen?
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Rate Limiting Warning -->
|
||||
<div id="rate-limit-warning" class="hidden bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-3">
|
||||
<div class="flex">
|
||||
<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 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"/>
|
||||
</svg>
|
||||
<div class="ml-3">
|
||||
<p class="text-sm text-yellow-800 dark:text-yellow-200">
|
||||
<strong>Sicherheitshinweis:</strong> Bei mehreren fehlgeschlagenen Anmeldeversuchen wird Ihr Konto vorübergehend gesperrt.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 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">
|
||||
class="mercedes-button 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-mercedes-blue hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-mercedes-blue 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>
|
||||
@@ -138,26 +411,26 @@
|
||||
<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 class="w-full border-t border-mercedes-silver"></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">
|
||||
<span class="px-2 bg-white dark:bg-black text-mercedes-gray">
|
||||
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">
|
||||
<a href="{{ url_for('guest.guest_request_form') if url_for else '#guest-request' }}"
|
||||
class="w-full flex justify-center items-center py-3 px-4 border border-mercedes-silver rounded-lg shadow-sm text-sm font-medium text-mercedes-black 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">
|
||||
<a href="{{ url_for('index') if url_for else '/' }}"
|
||||
class="w-full flex justify-center items-center py-3 px-4 border border-transparent rounded-lg text-sm font-medium text-mercedes-blue hover:text-blue-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="M10 19l-7-7m0 0l7-7m-7 7h18"/>
|
||||
</svg>
|
||||
@@ -167,114 +440,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
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');
|
||||
|
||||
// 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 {
|
||||
passwordInput.type = 'password';
|
||||
eyeOpen.classList.remove('hidden');
|
||||
eyeClosed.classList.add('hidden');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Form submission handling
|
||||
if (form) {
|
||||
form.addEventListener('submit', function(e) {
|
||||
// Show loading state
|
||||
submitBtn.disabled = true;
|
||||
loadingSpinner.classList.remove('hidden');
|
||||
submitText.textContent = 'Wird angemeldet...';
|
||||
});
|
||||
}
|
||||
|
||||
// Form validation
|
||||
const emailInput = document.getElementById('email');
|
||||
if (emailInput) {
|
||||
emailInput.addEventListener('blur', function() {
|
||||
validateEmail();
|
||||
});
|
||||
|
||||
emailInput.addEventListener('input', function() {
|
||||
clearError(emailInput);
|
||||
});
|
||||
}
|
||||
|
||||
if (passwordInput) {
|
||||
passwordInput.addEventListener('input', function() {
|
||||
clearError(passwordInput);
|
||||
});
|
||||
}
|
||||
|
||||
// Auto-focus first empty field
|
||||
if (emailInput && !emailInput.value) {
|
||||
emailInput.focus();
|
||||
} else if (passwordInput && !passwordInput.value) {
|
||||
passwordInput.focus();
|
||||
}
|
||||
});
|
||||
|
||||
function validateEmail() {
|
||||
const emailInput = document.getElementById('email');
|
||||
const email = emailInput.value.trim();
|
||||
|
||||
if (email && !isValidEmail(email)) {
|
||||
showError(emailInput, 'Bitte geben Sie eine gültige E-Mail-Adresse ein');
|
||||
return false;
|
||||
}
|
||||
|
||||
clearError(emailInput);
|
||||
return true;
|
||||
}
|
||||
|
||||
function isValidEmail(email) {
|
||||
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
||||
return emailRegex.test(email);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
// 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 %}
|
@@ -2,6 +2,232 @@
|
||||
|
||||
{% block title %}Neuer Druckauftrag - MYP Platform{% endblock %}
|
||||
|
||||
{% block extra_css %}
|
||||
<style>
|
||||
/* Mercedes-Benz Corporate Design */
|
||||
.text-mercedes-black { color: #000000; }
|
||||
.text-mercedes-gray { color: #6b7280; }
|
||||
.text-mercedes-silver { color: #9ca3af; }
|
||||
.text-mercedes-blue { color: #0073ce; }
|
||||
.text-mercedes-green { color: #008c32; }
|
||||
.text-mercedes-red { color: #dc2626; }
|
||||
|
||||
.bg-mercedes-black { background-color: #000000; }
|
||||
.bg-mercedes-silver { background-color: #e5e7eb; }
|
||||
.bg-mercedes-blue { background-color: #0073ce; }
|
||||
.bg-mercedes-green { background-color: #008c32; }
|
||||
|
||||
.border-mercedes-silver { border-color: #d1d5db; }
|
||||
.border-mercedes-blue { border-color: #0073ce; }
|
||||
|
||||
.hover\:border-mercedes-blue:hover { border-color: #0073ce; }
|
||||
.focus\:ring-mercedes-blue:focus {
|
||||
--tw-ring-color: #0073ce;
|
||||
--tw-ring-opacity: 0.5;
|
||||
}
|
||||
.focus\:border-mercedes-blue:focus { border-color: #0073ce; }
|
||||
|
||||
/* Mercedes Card Effect */
|
||||
.mercedes-card {
|
||||
background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
|
||||
border: 1px solid #e5e7eb;
|
||||
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.dark .mercedes-card {
|
||||
background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
|
||||
border-color: #334155;
|
||||
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.mercedes-card:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
/* Mercedes Button */
|
||||
.mercedes-button {
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.mercedes-button::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -100%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
|
||||
transition: left 0.5s;
|
||||
}
|
||||
|
||||
.mercedes-button:hover::before {
|
||||
left: 100%;
|
||||
}
|
||||
|
||||
/* Enhanced File Upload Area */
|
||||
#file-upload-area {
|
||||
background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
|
||||
border: 2px dashed #cbd5e1;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.dark #file-upload-area {
|
||||
background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
|
||||
border-color: #475569;
|
||||
}
|
||||
|
||||
#file-upload-area.drag-over {
|
||||
border-color: #0073ce;
|
||||
background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
|
||||
transform: scale(1.02);
|
||||
}
|
||||
|
||||
.dark #file-upload-area.drag-over {
|
||||
background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
|
||||
}
|
||||
|
||||
/* File Preview Animation */
|
||||
#file-preview {
|
||||
animation: slideIn 0.3s ease-out;
|
||||
}
|
||||
|
||||
@keyframes slideIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(20px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Progress Ring for Upload */
|
||||
.progress-ring {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
|
||||
.progress-ring__circle {
|
||||
stroke: #0073ce;
|
||||
stroke-linecap: round;
|
||||
stroke-width: 4;
|
||||
fill: transparent;
|
||||
r: 26;
|
||||
cx: 30;
|
||||
cy: 30;
|
||||
stroke-dasharray: 163.36;
|
||||
stroke-dashoffset: 163.36;
|
||||
transition: stroke-dashoffset 0.3s ease;
|
||||
}
|
||||
|
||||
/* Form Enhancements */
|
||||
.form-input {
|
||||
transition: all 0.2s ease;
|
||||
border: 1px solid #d1d5db;
|
||||
}
|
||||
|
||||
.form-input:focus {
|
||||
border-color: #0073ce;
|
||||
box-shadow: 0 0 0 3px rgba(0, 115, 206, 0.1);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.dark .form-input {
|
||||
background-color: #1e293b;
|
||||
border-color: #475569;
|
||||
color: #f8fafc;
|
||||
}
|
||||
|
||||
.dark .form-input:focus {
|
||||
border-color: #0ea5e9;
|
||||
box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
|
||||
}
|
||||
|
||||
/* Printer Status Styling */
|
||||
.printer-online {
|
||||
background: linear-gradient(90deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.05) 100%);
|
||||
border-left: 4px solid #10b981;
|
||||
}
|
||||
|
||||
.printer-offline {
|
||||
background: linear-gradient(90deg, rgba(245, 158, 11, 0.1) 0%, rgba(217, 119, 6, 0.05) 100%);
|
||||
border-left: 4px solid #f59e0b;
|
||||
}
|
||||
|
||||
/* Success Animation */
|
||||
.success-checkmark {
|
||||
animation: checkmark 0.6s ease-in-out;
|
||||
}
|
||||
|
||||
@keyframes checkmark {
|
||||
0% {
|
||||
transform: scale(0);
|
||||
opacity: 0;
|
||||
}
|
||||
50% {
|
||||
transform: scale(1.2);
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
transform: scale(1);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Responsive Design */
|
||||
@media (max-width: 768px) {
|
||||
.mercedes-card {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
#file-upload-area {
|
||||
padding: 2rem 1rem;
|
||||
}
|
||||
|
||||
.grid-cols-1.md\\:grid-cols-2 {
|
||||
gap: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Loading Overlay */
|
||||
.loading-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.loading-content {
|
||||
background: white;
|
||||
padding: 2rem;
|
||||
border-radius: 12px;
|
||||
text-align: center;
|
||||
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
|
||||
.dark .loading-content {
|
||||
background: #1e293b;
|
||||
color: #f8fafc;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
|
||||
<!-- Header -->
|
||||
@@ -177,17 +403,26 @@
|
||||
<script>
|
||||
let selectedFile = null;
|
||||
let printers = [];
|
||||
let uploadProgress = 0;
|
||||
|
||||
// Initialize
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
loadPrinters();
|
||||
setupFileUpload();
|
||||
setupFormEnhancements();
|
||||
setupRealTimeValidation();
|
||||
});
|
||||
|
||||
// Load available printers
|
||||
// Load available printers with enhanced error handling
|
||||
async function loadPrinters() {
|
||||
const select = document.getElementById('printer-select');
|
||||
|
||||
try {
|
||||
// Lade ALLE Drucker mit Live-Status-Check (nicht nur verfügbare)
|
||||
// Show loading state
|
||||
select.innerHTML = '<option value="">Lade Drucker...</option>';
|
||||
select.disabled = true;
|
||||
|
||||
// Try multiple API endpoints for better reliability
|
||||
let response;
|
||||
try {
|
||||
response = await apiCall('/api/printers/status/live');
|
||||
@@ -198,19 +433,19 @@
|
||||
printers = response.printers || [];
|
||||
}
|
||||
|
||||
const select = document.getElementById('printer-select');
|
||||
select.innerHTML = '<option value="">Drucker auswählen...</option>';
|
||||
select.disabled = false;
|
||||
|
||||
console.log('Geladene Drucker:', printers);
|
||||
|
||||
if (printers.length === 0) {
|
||||
select.innerHTML = '<option value="">Keine Drucker in der Datenbank</option>';
|
||||
select.innerHTML = '<option value="">Keine Drucker verfügbar</option>';
|
||||
select.disabled = true;
|
||||
showFlashMessage('Keine Drucker in der Datenbank gefunden', 'error');
|
||||
showAdvancedMessage('Keine Drucker in der Datenbank gefunden. Kontaktieren Sie den Administrator.', 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
// Sortiere Drucker: Online zuerst, dann nach Name
|
||||
// Enhanced printer sorting and display
|
||||
const sortedPrinters = printers.sort((a, b) => {
|
||||
const aOnline = a.status === 'available' || a.is_online || a.active;
|
||||
const bOnline = b.status === 'available' || b.is_online || b.active;
|
||||
@@ -221,173 +456,336 @@
|
||||
return a.name.localeCompare(b.name);
|
||||
});
|
||||
|
||||
// Zähler für Online- und Offline-Drucker
|
||||
let onlineCount = 0;
|
||||
let offlineCount = 0;
|
||||
|
||||
// Alle Drucker anzeigen (online und offline)
|
||||
// Create printer options with enhanced status display
|
||||
sortedPrinters.forEach(printer => {
|
||||
const option = document.createElement('option');
|
||||
option.value = printer.id;
|
||||
option.dataset.printerId = printer.id;
|
||||
|
||||
// Status-Indikator bestimmen
|
||||
const isOnline = printer.status === 'available' || printer.is_online || printer.active;
|
||||
let statusIcon, statusText;
|
||||
let statusIcon, statusText, estimatedTime = '';
|
||||
|
||||
if (isOnline) {
|
||||
statusIcon = '✅';
|
||||
statusText = 'ONLINE - Sofortiger Start';
|
||||
option.style.backgroundColor = 'rgba(4, 120, 87, 0.1)';
|
||||
option.style.color = '#047857';
|
||||
option.style.fontWeight = '500';
|
||||
statusIcon = '🟢';
|
||||
statusText = 'SOFORT VERFÜGBAR';
|
||||
option.className = 'printer-online';
|
||||
estimatedTime = ' - Startzeit: <2 Min';
|
||||
onlineCount++;
|
||||
} else {
|
||||
statusIcon = '🔄';
|
||||
statusText = 'OFFLINE - Warteschlange';
|
||||
option.style.backgroundColor = 'rgba(245, 158, 11, 0.1)';
|
||||
option.style.color = '#d97706';
|
||||
option.style.fontWeight = '400';
|
||||
option.setAttribute('data-offline', 'true');
|
||||
statusIcon = '🟡';
|
||||
statusText = 'WARTESCHLANGE';
|
||||
option.className = 'printer-offline';
|
||||
option.dataset.offline = 'true';
|
||||
|
||||
// Estimate queue time based on current jobs
|
||||
const queuedJobs = printer.queued_jobs || 0;
|
||||
const avgJobTime = 2; // hours
|
||||
const estimatedHours = queuedJobs * avgJobTime;
|
||||
estimatedTime = ` - Geschätzte Wartezeit: ${estimatedHours}h`;
|
||||
offlineCount++;
|
||||
}
|
||||
|
||||
// Letzter Check-Zeitstempel
|
||||
let lastChecked = '';
|
||||
if (printer.last_checked) {
|
||||
const checkTime = new Date(printer.last_checked);
|
||||
const now = new Date();
|
||||
const diffMinutes = Math.floor((now - checkTime) / 60000);
|
||||
|
||||
if (diffMinutes < 1) {
|
||||
lastChecked = ' (gerade geprüft)';
|
||||
} else if (diffMinutes < 60) {
|
||||
lastChecked = ` (vor ${diffMinutes} Min)`;
|
||||
} else {
|
||||
lastChecked = ` (vor ${Math.floor(diffMinutes / 60)} Std)`;
|
||||
}
|
||||
}
|
||||
|
||||
// Enhanced printer info
|
||||
const location = printer.location || printer.model || 'Unbekanntes Modell';
|
||||
option.textContent = `${statusIcon} ${printer.name} (${location}) - ${statusText}${lastChecked}`;
|
||||
const capabilities = printer.capabilities ? ` | ${printer.capabilities}` : '';
|
||||
|
||||
option.textContent = `${statusIcon} ${printer.name} (${location}) - ${statusText}${estimatedTime}${capabilities}`;
|
||||
option.title = `Status: ${statusText} | Standort: ${location} | Modell: ${printer.model || 'Unbekannt'}`;
|
||||
|
||||
select.appendChild(option);
|
||||
});
|
||||
|
||||
// Status-Nachricht anzeigen
|
||||
// Show comprehensive status message
|
||||
if (onlineCount > 0) {
|
||||
if (onlineCount === sortedPrinters.length) {
|
||||
showFlashMessage(`✅ OPTIMAL: Alle ${sortedPrinters.length} Drucker sind ONLINE und bereit`, 'success');
|
||||
showAdvancedMessage(`🎯 OPTIMAL: Alle ${sortedPrinters.length} Drucker sind bereit für sofortigen Start!`, 'success');
|
||||
} else {
|
||||
showFlashMessage(`🔄 ${onlineCount} von ${sortedPrinters.length} Drucker ONLINE | ${offlineCount} Drucker in Warteschlange verfügbar`, 'success');
|
||||
showAdvancedMessage(`✅ ${onlineCount} Drucker SOFORT verfügbar | ${offlineCount} Drucker über Warteschlange planbar`, 'success');
|
||||
}
|
||||
} else {
|
||||
showFlashMessage(`🔄 WARTESCHLANGEN-MODUS: Alle ${sortedPrinters.length} Drucker sind OFFLINE - Jobs werden automatisch gestartet, wenn Drucker verfügbar werden`, 'warning');
|
||||
showAdvancedMessage(`⏳ WARTESCHLANGEN-MODUS: Alle ${sortedPrinters.length} Drucker sind ausgelastet. Ihr Job wird automatisch gestartet, sobald ein Drucker frei wird.`, 'warning');
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error loading printers:', error);
|
||||
showFlashMessage('Fehler beim Laden der Drucker', 'error');
|
||||
select.innerHTML = '<option value="">Fehler beim Laden der Drucker</option>';
|
||||
select.disabled = true;
|
||||
showAdvancedMessage('Kritischer Fehler beim Laden der Drucker. Bitte aktualisieren Sie die Seite oder kontaktieren Sie den Support.', 'error');
|
||||
}
|
||||
}
|
||||
|
||||
// Setup file upload
|
||||
// Enhanced file upload setup
|
||||
function setupFileUpload() {
|
||||
const uploadArea = document.getElementById('file-upload-area');
|
||||
const fileInput = document.getElementById('file-input');
|
||||
|
||||
// Click to select file
|
||||
uploadArea.addEventListener('click', () => {
|
||||
if (!selectedFile) {
|
||||
// Enhanced click handling
|
||||
uploadArea.addEventListener('click', (e) => {
|
||||
if (!selectedFile && !e.target.closest('button')) {
|
||||
fileInput.click();
|
||||
}
|
||||
});
|
||||
|
||||
// Drag and drop
|
||||
uploadArea.addEventListener('dragover', (e) => {
|
||||
// Enhanced drag and drop with visual feedback
|
||||
let dragCounter = 0;
|
||||
|
||||
uploadArea.addEventListener('dragenter', (e) => {
|
||||
e.preventDefault();
|
||||
uploadArea.classList.add('border-mercedes-blue', 'bg-blue-50');
|
||||
dragCounter++;
|
||||
uploadArea.classList.add('drag-over');
|
||||
});
|
||||
|
||||
uploadArea.addEventListener('dragleave', (e) => {
|
||||
e.preventDefault();
|
||||
uploadArea.classList.remove('border-mercedes-blue', 'bg-blue-50');
|
||||
dragCounter--;
|
||||
if (dragCounter === 0) {
|
||||
uploadArea.classList.remove('drag-over');
|
||||
}
|
||||
});
|
||||
|
||||
uploadArea.addEventListener('dragover', (e) => {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
uploadArea.addEventListener('drop', (e) => {
|
||||
e.preventDefault();
|
||||
uploadArea.classList.remove('border-mercedes-blue', 'bg-blue-50');
|
||||
dragCounter = 0;
|
||||
uploadArea.classList.remove('drag-over');
|
||||
|
||||
const files = e.dataTransfer.files;
|
||||
if (files.length > 0) {
|
||||
handleFileSelect({ target: { files } });
|
||||
}
|
||||
});
|
||||
|
||||
// File input change handler
|
||||
fileInput.addEventListener('change', handleFileSelect);
|
||||
}
|
||||
|
||||
// Handle file selection
|
||||
// Enhanced file selection handling
|
||||
function handleFileSelect(event) {
|
||||
const file = event.target.files[0];
|
||||
if (!file) return;
|
||||
|
||||
// Validate file type
|
||||
const allowedTypes = ['.stl', '.gcode', '.3mf', '.obj'];
|
||||
const fileExtension = '.' + file.name.split('.').pop().toLowerCase();
|
||||
|
||||
if (!allowedTypes.includes(fileExtension)) {
|
||||
showFlashMessage('Ungültiger Dateityp. Erlaubt sind: STL, GCODE, 3MF, OBJ', 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
// Validate file size (100MB max)
|
||||
const maxSize = 100 * 1024 * 1024; // 100MB in bytes
|
||||
if (file.size > maxSize) {
|
||||
showFlashMessage('Datei ist zu groß. Maximum: 100MB', 'error');
|
||||
// Enhanced file validation
|
||||
const validation = validateFile(file);
|
||||
if (!validation.valid) {
|
||||
showAdvancedMessage(validation.message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
selectedFile = file;
|
||||
showFilePreview(file);
|
||||
showEnhancedFilePreview(file);
|
||||
validateForm();
|
||||
|
||||
// Analyze file for additional insights
|
||||
analyzeFile(file);
|
||||
}
|
||||
|
||||
// Show file preview
|
||||
function showFilePreview(file) {
|
||||
// Comprehensive file validation
|
||||
function validateFile(file) {
|
||||
const allowedTypes = {
|
||||
'.stl': { mime: ['application/octet-stream', 'model/stl'], description: 'STL (Stereolithography)' },
|
||||
'.gcode': { mime: ['text/plain', 'application/octet-stream'], description: 'G-Code' },
|
||||
'.3mf': { mime: ['application/vnd.ms-package.3dmanufacturing-3dmodel+xml'], description: '3MF (3D Manufacturing Format)' },
|
||||
'.obj': { mime: ['text/plain', 'application/octet-stream'], description: 'OBJ (Wavefront)' }
|
||||
};
|
||||
|
||||
const fileExtension = '.' + file.name.split('.').pop().toLowerCase();
|
||||
|
||||
// Check file extension
|
||||
if (!allowedTypes[fileExtension]) {
|
||||
return {
|
||||
valid: false,
|
||||
message: `Ungültiger Dateityp "${fileExtension}". Erlaubte Formate: STL, GCODE, 3MF, OBJ`
|
||||
};
|
||||
}
|
||||
|
||||
// Check file size (100MB max)
|
||||
const maxSize = 100 * 1024 * 1024;
|
||||
if (file.size > maxSize) {
|
||||
return {
|
||||
valid: false,
|
||||
message: `Datei zu groß (${formatFileSize(file.size)}). Maximum: 100MB`
|
||||
};
|
||||
}
|
||||
|
||||
// Check minimum file size (1KB)
|
||||
if (file.size < 1024) {
|
||||
return {
|
||||
valid: false,
|
||||
message: 'Datei ist zu klein. Mindestgröße: 1KB'
|
||||
};
|
||||
}
|
||||
|
||||
// Additional checks for specific file types
|
||||
if (fileExtension === '.gcode' && file.size > 50 * 1024 * 1024) {
|
||||
return {
|
||||
valid: true,
|
||||
warning: 'Große G-Code Datei erkannt. Verarbeitungszeit kann länger dauern.'
|
||||
};
|
||||
}
|
||||
|
||||
return { valid: true };
|
||||
}
|
||||
|
||||
// Enhanced file preview with more details
|
||||
function showEnhancedFilePreview(file) {
|
||||
document.getElementById('upload-placeholder').classList.add('hidden');
|
||||
document.getElementById('file-preview').classList.remove('hidden');
|
||||
const previewContainer = document.getElementById('file-preview');
|
||||
previewContainer.classList.remove('hidden');
|
||||
|
||||
document.getElementById('file-name').textContent = file.name;
|
||||
document.getElementById('file-size').textContent = formatFileSize(file.size);
|
||||
|
||||
// Add file type indicator
|
||||
const fileExtension = '.' + file.name.split('.').pop().toLowerCase();
|
||||
const typeIndicator = document.createElement('div');
|
||||
typeIndicator.className = 'text-xs text-mercedes-blue font-medium mt-1';
|
||||
typeIndicator.textContent = getFileTypeDescription(fileExtension);
|
||||
|
||||
const fileSizeElement = document.getElementById('file-size');
|
||||
fileSizeElement.parentElement.appendChild(typeIndicator);
|
||||
|
||||
// Add estimated print time (placeholder)
|
||||
const estimateElement = document.createElement('div');
|
||||
estimateElement.className = 'text-xs text-mercedes-gray mt-2';
|
||||
estimateElement.innerHTML = '<span class="animate-pulse">📊 Datei wird analysiert...</span>';
|
||||
fileSizeElement.parentElement.appendChild(estimateElement);
|
||||
|
||||
// Simulate analysis completion
|
||||
setTimeout(() => {
|
||||
estimateElement.innerHTML = '⏱️ Geschätzte Druckzeit: Wird nach Druckerauswahl berechnet';
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
// Clear selected file
|
||||
function clearFile() {
|
||||
selectedFile = null;
|
||||
document.getElementById('file-input').value = '';
|
||||
document.getElementById('upload-placeholder').classList.remove('hidden');
|
||||
document.getElementById('file-preview').classList.add('hidden');
|
||||
validateForm();
|
||||
// File analysis for insights
|
||||
function analyzeFile(file) {
|
||||
const fileExtension = '.' + file.name.split('.').pop().toLowerCase();
|
||||
|
||||
if (fileExtension === '.stl') {
|
||||
// For STL files, we could potentially read the header
|
||||
console.log('STL-Datei erkannt - weitere Analyse verfügbar');
|
||||
} else if (fileExtension === '.gcode') {
|
||||
// For G-Code, we could estimate print time
|
||||
console.log('G-Code-Datei erkannt - Druckzeit-Analyse möglich');
|
||||
}
|
||||
}
|
||||
|
||||
// Validate form
|
||||
// Setup form enhancements
|
||||
function setupFormEnhancements() {
|
||||
// Add form-input class to all inputs and selects
|
||||
const formElements = document.querySelectorAll('input, select, textarea');
|
||||
formElements.forEach(element => {
|
||||
element.classList.add('form-input');
|
||||
});
|
||||
|
||||
// Enhanced printer selection with additional info
|
||||
const printerSelect = document.getElementById('printer-select');
|
||||
printerSelect.addEventListener('change', function() {
|
||||
const selectedPrinterId = this.value;
|
||||
if (selectedPrinterId) {
|
||||
const printer = printers.find(p => p.id == selectedPrinterId);
|
||||
if (printer) {
|
||||
showPrinterInfo(printer);
|
||||
updateEstimatedPrintTime(printer);
|
||||
}
|
||||
}
|
||||
validateForm();
|
||||
});
|
||||
|
||||
// Auto-suggest materials based on file type
|
||||
const materialInput = document.getElementById('material-input');
|
||||
const fileInput = document.getElementById('file-input');
|
||||
|
||||
fileInput.addEventListener('change', function() {
|
||||
if (this.files[0] && !materialInput.value) {
|
||||
const suggestedMaterial = getSuggestedMaterial(this.files[0]);
|
||||
if (suggestedMaterial) {
|
||||
materialInput.value = suggestedMaterial;
|
||||
materialInput.style.backgroundColor = 'rgba(16, 185, 129, 0.1)';
|
||||
setTimeout(() => {
|
||||
materialInput.style.backgroundColor = '';
|
||||
}, 2000);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Real-time form validation
|
||||
function setupRealTimeValidation() {
|
||||
const form = document.getElementById('jobForm');
|
||||
const inputs = form.querySelectorAll('input, select, textarea');
|
||||
|
||||
inputs.forEach(input => {
|
||||
input.addEventListener('input', validateForm);
|
||||
input.addEventListener('blur', validateFieldOnBlur);
|
||||
});
|
||||
}
|
||||
|
||||
// Validate individual field on blur
|
||||
function validateFieldOnBlur(event) {
|
||||
const field = event.target;
|
||||
const fieldName = field.name || field.id;
|
||||
|
||||
// Clear previous validation state
|
||||
field.classList.remove('border-red-500', 'border-green-500');
|
||||
|
||||
if (field.hasAttribute('required') && !field.value.trim()) {
|
||||
field.classList.add('border-red-500');
|
||||
showFieldError(field, 'Dieses Feld ist erforderlich');
|
||||
} else if (field.value.trim()) {
|
||||
field.classList.add('border-green-500');
|
||||
clearFieldError(field);
|
||||
}
|
||||
}
|
||||
|
||||
// Enhanced form validation
|
||||
function validateForm() {
|
||||
const printerSelected = document.getElementById('printer-select').value;
|
||||
const submitButton = document.getElementById('submit-button');
|
||||
|
||||
const isValid = selectedFile && printerSelected;
|
||||
|
||||
submitButton.disabled = !isValid;
|
||||
|
||||
// Update button appearance based on validation state
|
||||
if (isValid) {
|
||||
submitButton.classList.remove('opacity-50', 'cursor-not-allowed');
|
||||
submitButton.classList.add('hover:bg-green-700');
|
||||
} else {
|
||||
submitButton.classList.add('opacity-50', 'cursor-not-allowed');
|
||||
submitButton.classList.remove('hover:bg-green-700');
|
||||
}
|
||||
|
||||
// Show validation feedback
|
||||
updateValidationFeedback(isValid);
|
||||
}
|
||||
|
||||
// Form validation on change
|
||||
document.getElementById('printer-select').addEventListener('change', validateForm);
|
||||
|
||||
// Handle form submission
|
||||
// Enhanced form submission with progress tracking
|
||||
async function handleJobSubmission(event) {
|
||||
event.preventDefault();
|
||||
|
||||
if (!selectedFile) {
|
||||
showFlashMessage('Bitte wählen Sie eine Datei aus', 'error');
|
||||
showAdvancedMessage('Bitte wählen Sie eine Datei aus', 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
const printer = printers.find(p => p.id == document.getElementById('printer-select').value);
|
||||
|
||||
// Pre-submission validation
|
||||
const validationResult = await performPreSubmissionValidation();
|
||||
if (!validationResult.valid) {
|
||||
showAdvancedMessage(validationResult.message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
// Show loading overlay
|
||||
showLoadingOverlay('Druckauftrag wird erstellt...');
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('file', selectedFile);
|
||||
formData.append('printer_id', document.getElementById('printer-select').value);
|
||||
@@ -398,60 +796,225 @@
|
||||
formData.append('infill', document.getElementById('infill-select').value);
|
||||
formData.append('notes', document.getElementById('notes-textarea').value);
|
||||
|
||||
// Show loading state
|
||||
const submitButton = document.getElementById('submit-button');
|
||||
const submitText = document.getElementById('submit-text');
|
||||
const submitSpinner = document.getElementById('submit-spinner');
|
||||
|
||||
submitButton.disabled = true;
|
||||
submitText.textContent = 'Wird erstellt...';
|
||||
submitSpinner.classList.remove('hidden');
|
||||
|
||||
// Enhanced submission with progress tracking
|
||||
try {
|
||||
const response = await fetch('/api/jobs', {
|
||||
const response = await fetchWithProgress('/api/jobs', {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
headers: {
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
});
|
||||
body: formData
|
||||
}, updateUploadProgress);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
const errorData = await response.json().catch(() => ({}));
|
||||
throw new Error(errorData.message || `HTTP error! status: ${response.status}`);
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
if (result.success) {
|
||||
showFlashMessage('Druckauftrag erfolgreich erstellt', 'success');
|
||||
hideLoadingOverlay();
|
||||
showSuccessMessage(result, printer);
|
||||
|
||||
// Redirect to job details or jobs list
|
||||
// Redirect after success
|
||||
setTimeout(() => {
|
||||
window.location.href = `/job/${result.job_id}`;
|
||||
}, 1500);
|
||||
window.location.href = result.redirect_url || `/job/${result.job_id}`;
|
||||
}, 2000);
|
||||
} else {
|
||||
throw new Error(result.message || 'Unbekannter Fehler');
|
||||
throw new Error(result.message || 'Unbekannter Fehler beim Erstellen des Auftrags');
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error creating job:', error);
|
||||
showFlashMessage('Fehler beim Erstellen des Auftrags: ' + error.message, 'error');
|
||||
|
||||
// Reset button state
|
||||
submitButton.disabled = false;
|
||||
submitText.textContent = 'Auftrag erstellen';
|
||||
submitSpinner.classList.add('hidden');
|
||||
validateForm();
|
||||
hideLoadingOverlay();
|
||||
showAdvancedMessage(`Fehler beim Erstellen des Auftrags: ${error.message}`, 'error');
|
||||
enableFormSubmission();
|
||||
}
|
||||
}
|
||||
|
||||
// Reset form
|
||||
// Progress tracking for file upload
|
||||
function fetchWithProgress(url, options, onProgress) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const xhr = new XMLHttpRequest();
|
||||
|
||||
xhr.upload.addEventListener('progress', (e) => {
|
||||
if (e.lengthComputable) {
|
||||
const percentComplete = (e.loaded / e.total) * 100;
|
||||
onProgress(percentComplete);
|
||||
}
|
||||
});
|
||||
|
||||
xhr.addEventListener('load', () => {
|
||||
if (xhr.status >= 200 && xhr.status < 300) {
|
||||
resolve({
|
||||
ok: true,
|
||||
status: xhr.status,
|
||||
json: () => Promise.resolve(JSON.parse(xhr.responseText))
|
||||
});
|
||||
} else {
|
||||
reject(new Error(`HTTP ${xhr.status}`));
|
||||
}
|
||||
});
|
||||
|
||||
xhr.addEventListener('error', () => reject(new Error('Network Error')));
|
||||
|
||||
xhr.open(options.method || 'GET', url);
|
||||
|
||||
if (options.headers) {
|
||||
Object.entries(options.headers).forEach(([key, value]) => {
|
||||
xhr.setRequestHeader(key, value);
|
||||
});
|
||||
}
|
||||
|
||||
xhr.send(options.body);
|
||||
});
|
||||
}
|
||||
|
||||
// Helper functions
|
||||
function getFileTypeDescription(extension) {
|
||||
const descriptions = {
|
||||
'.stl': 'STL - 3D Mesh Datei',
|
||||
'.gcode': 'G-Code - Druckfertiger Code',
|
||||
'.3mf': '3MF - 3D Manufacturing Format',
|
||||
'.obj': 'OBJ - Wavefront 3D Object'
|
||||
};
|
||||
return descriptions[extension] || 'Unbekannter Dateityp';
|
||||
}
|
||||
|
||||
function getSuggestedMaterial(file) {
|
||||
const fileName = file.name.toLowerCase();
|
||||
if (fileName.includes('pla')) return 'PLA';
|
||||
if (fileName.includes('abs')) return 'ABS';
|
||||
if (fileName.includes('petg')) return 'PETG';
|
||||
if (fileName.includes('tpu')) return 'TPU';
|
||||
return 'PLA'; // Default suggestion
|
||||
}
|
||||
|
||||
function showAdvancedMessage(message, type) {
|
||||
// Use enhanced message display
|
||||
if (window.showToast) {
|
||||
window.showToast(message, type);
|
||||
} else {
|
||||
console.log(`${type.toUpperCase()}: ${message}`);
|
||||
}
|
||||
}
|
||||
|
||||
function showLoadingOverlay(message) {
|
||||
const overlay = document.createElement('div');
|
||||
overlay.id = 'loading-overlay';
|
||||
overlay.className = 'loading-overlay';
|
||||
overlay.innerHTML = `
|
||||
<div class="loading-content">
|
||||
<div class="progress-ring">
|
||||
<svg class="progress-ring" width="60" height="60">
|
||||
<circle class="progress-ring__circle" stroke="#0073ce" stroke-width="4" fill="transparent" r="26" cx="30" cy="30"/>
|
||||
</svg>
|
||||
</div>
|
||||
<h3 class="text-lg font-semibold mt-4">${message}</h3>
|
||||
<p class="text-sm text-gray-600 dark:text-gray-400 mt-2">Bitte warten Sie...</p>
|
||||
<div id="upload-progress" class="mt-4 text-sm font-medium">0%</div>
|
||||
</div>
|
||||
`;
|
||||
document.body.appendChild(overlay);
|
||||
}
|
||||
|
||||
function hideLoadingOverlay() {
|
||||
const overlay = document.getElementById('loading-overlay');
|
||||
if (overlay) {
|
||||
overlay.remove();
|
||||
}
|
||||
}
|
||||
|
||||
function updateUploadProgress(percent) {
|
||||
const progressElement = document.getElementById('upload-progress');
|
||||
if (progressElement) {
|
||||
progressElement.textContent = `${Math.round(percent)}% hochgeladen`;
|
||||
}
|
||||
|
||||
const circle = document.querySelector('.progress-ring__circle');
|
||||
if (circle) {
|
||||
const offset = 163.36 - (percent / 100) * 163.36;
|
||||
circle.style.strokeDashoffset = offset;
|
||||
}
|
||||
}
|
||||
|
||||
function showSuccessMessage(result, printer) {
|
||||
const overlay = document.createElement('div');
|
||||
overlay.className = 'loading-overlay';
|
||||
overlay.innerHTML = `
|
||||
<div class="loading-content">
|
||||
<div class="success-checkmark">
|
||||
<svg class="w-16 h-16 text-green-500 mx-auto" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
||||
</svg>
|
||||
</div>
|
||||
<h3 class="text-lg font-semibold mt-4 text-green-600">Auftrag erfolgreich erstellt!</h3>
|
||||
<p class="text-sm text-gray-600 dark:text-gray-400 mt-2">
|
||||
Job-ID: ${result.job_id}<br>
|
||||
Drucker: ${printer ? printer.name : 'Unbekannt'}<br>
|
||||
Status: ${result.status || 'In Warteschlange'}
|
||||
</p>
|
||||
<p class="text-xs text-gray-500 mt-3">Sie werden automatisch weitergeleitet...</p>
|
||||
</div>
|
||||
`;
|
||||
document.body.appendChild(overlay);
|
||||
}
|
||||
|
||||
function enableFormSubmission() {
|
||||
const submitButton = document.getElementById('submit-button');
|
||||
const submitText = document.getElementById('submit-text');
|
||||
const submitSpinner = document.getElementById('submit-spinner');
|
||||
|
||||
submitButton.disabled = false;
|
||||
submitText.textContent = 'Auftrag erstellen';
|
||||
submitSpinner.classList.add('hidden');
|
||||
validateForm();
|
||||
}
|
||||
|
||||
// Clear selected file
|
||||
function clearFile() {
|
||||
selectedFile = null;
|
||||
document.getElementById('file-input').value = '';
|
||||
document.getElementById('upload-placeholder').classList.remove('hidden');
|
||||
document.getElementById('file-preview').classList.add('hidden');
|
||||
validateForm();
|
||||
}
|
||||
|
||||
// Reset form with confirmation
|
||||
function resetForm() {
|
||||
if (confirm('Sind Sie sicher, dass Sie das Formular zurücksetzen möchten?')) {
|
||||
if (confirm('Sind Sie sicher, dass Sie das Formular zurücksetzen möchten? Alle Eingaben gehen verloren.')) {
|
||||
document.getElementById('jobForm').reset();
|
||||
clearFile();
|
||||
validateForm();
|
||||
showAdvancedMessage('Formular wurde zurückgesetzt', 'info');
|
||||
}
|
||||
}
|
||||
|
||||
// Format file size helper
|
||||
function formatFileSize(bytes) {
|
||||
if (bytes === 0) return '0 Bytes';
|
||||
const k = 1024;
|
||||
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
||||
}
|
||||
|
||||
// Pre-submission validation
|
||||
async function performPreSubmissionValidation() {
|
||||
// Check if printer is still available
|
||||
try {
|
||||
const printerId = document.getElementById('printer-select').value;
|
||||
const response = await apiCall(`/api/printers/${printerId}/status`);
|
||||
|
||||
if (!response.available) {
|
||||
return {
|
||||
valid: false,
|
||||
message: 'Der ausgewählte Drucker ist nicht mehr verfügbar. Bitte wählen Sie einen anderen Drucker.'
|
||||
};
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('Drucker-Status konnte nicht überprüft werden:', error);
|
||||
}
|
||||
|
||||
return { valid: true };
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
@@ -400,7 +400,24 @@
|
||||
|
||||
// Sammle alle Einstellungen und speichere sie
|
||||
async function saveAllSettings() {
|
||||
const saveButton = document.getElementById('save-security-settings');
|
||||
const originalButtonText = saveButton.innerHTML;
|
||||
|
||||
try {
|
||||
// Show loading state
|
||||
saveButton.disabled = true;
|
||||
saveButton.innerHTML = `
|
||||
<svg class="animate-spin -ml-1 mr-3 h-5 w-5 text-white inline" 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>
|
||||
Speichern...
|
||||
`;
|
||||
|
||||
// Add loading state to settings cards
|
||||
const settingsCards = document.querySelectorAll('.glass-card');
|
||||
settingsCards.forEach(card => card.classList.add('settings-loading'));
|
||||
|
||||
// Erscheinungsbild-Einstellungen
|
||||
const theme = localStorage.getItem(STORAGE_KEY) === 'true' ? 'dark' :
|
||||
localStorage.getItem(STORAGE_KEY) === 'false' ? 'light' : 'system';
|
||||
@@ -418,6 +435,11 @@
|
||||
const twoFactor = document.getElementById('two-factor').checked;
|
||||
const autoLogout = document.getElementById('auto-logout').value;
|
||||
|
||||
// Validate settings
|
||||
if (!validateSettings({ theme, contrast, autoLogout })) {
|
||||
throw new Error('Ungültige Einstellungen erkannt');
|
||||
}
|
||||
|
||||
// Einstellungsobjekt erstellen
|
||||
const settings = {
|
||||
theme: theme,
|
||||
@@ -433,11 +455,19 @@
|
||||
activity_logs: activityLogs,
|
||||
two_factor: twoFactor,
|
||||
auto_logout: autoLogout
|
||||
}
|
||||
},
|
||||
timestamp: new Date().toISOString()
|
||||
};
|
||||
|
||||
// Apply reduced motion immediately if changed
|
||||
if (reducedMotion) {
|
||||
document.documentElement.style.setProperty('--tw-transition-duration', '0s');
|
||||
} else {
|
||||
document.documentElement.style.removeProperty('--tw-transition-duration');
|
||||
}
|
||||
|
||||
// Einstellungen an den Server senden
|
||||
const response = await fetch('/user/update-settings', {
|
||||
const response = await fetch('/api/user/settings', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -449,123 +479,484 @@
|
||||
const result = await response.json();
|
||||
|
||||
if (result.success) {
|
||||
// Success animation
|
||||
settingsCards.forEach(card => {
|
||||
card.classList.add('settings-saved');
|
||||
setTimeout(() => card.classList.remove('settings-saved'), 600);
|
||||
});
|
||||
|
||||
showFlashMessage('Alle Einstellungen wurden erfolgreich gespeichert', 'success');
|
||||
|
||||
// Cache settings locally for faster access
|
||||
localStorage.setItem('myp-settings-cache', JSON.stringify(settings));
|
||||
|
||||
} else {
|
||||
throw new Error(result.error || 'Unbekannter Fehler');
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Fehler beim Speichern der Einstellungen:', error);
|
||||
showFlashMessage('Fehler beim Speichern der Einstellungen: ' + error.message, 'error');
|
||||
} finally {
|
||||
// Restore button and remove loading states
|
||||
saveButton.disabled = false;
|
||||
saveButton.innerHTML = originalButtonText;
|
||||
|
||||
const settingsCards = document.querySelectorAll('.glass-card');
|
||||
settingsCards.forEach(card => card.classList.remove('settings-loading'));
|
||||
}
|
||||
}
|
||||
|
||||
// Einstellungen beim Laden der Seite abrufen
|
||||
// Validate settings before saving
|
||||
function validateSettings(settings) {
|
||||
const validThemes = ['light', 'dark', 'system'];
|
||||
const validContrast = ['normal', 'high'];
|
||||
const validLogoutValues = ['never', '30', '60', '120', '480'];
|
||||
|
||||
return validThemes.includes(settings.theme) &&
|
||||
validContrast.includes(settings.contrast) &&
|
||||
validLogoutValues.includes(settings.autoLogout);
|
||||
}
|
||||
|
||||
// Enhanced settings loading with caching
|
||||
async function loadUserSettings() {
|
||||
try {
|
||||
// Try to load from cache first for better performance
|
||||
const cachedSettings = localStorage.getItem('myp-settings-cache');
|
||||
if (cachedSettings) {
|
||||
try {
|
||||
const cached = JSON.parse(cachedSettings);
|
||||
// Use cached settings if they're less than 5 minutes old
|
||||
if (new Date() - new Date(cached.timestamp) < 5 * 60 * 1000) {
|
||||
applySettings(cached);
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
localStorage.removeItem('myp-settings-cache');
|
||||
}
|
||||
}
|
||||
|
||||
const response = await fetch('/api/user/settings');
|
||||
const result = await response.json();
|
||||
|
||||
if (result.success) {
|
||||
const settings = result.settings;
|
||||
applySettings(settings);
|
||||
|
||||
// Theme-Einstellungen anwenden
|
||||
if (settings.theme === 'dark') {
|
||||
localStorage.setItem(STORAGE_KEY, 'true');
|
||||
document.documentElement.classList.add('dark');
|
||||
setActiveThemeButton(darkThemeBtn);
|
||||
} else if (settings.theme === 'light') {
|
||||
localStorage.setItem(STORAGE_KEY, 'false');
|
||||
document.documentElement.classList.remove('dark');
|
||||
setActiveThemeButton(lightThemeBtn);
|
||||
} else {
|
||||
localStorage.removeItem(STORAGE_KEY);
|
||||
setActiveThemeButton(systemThemeBtn);
|
||||
}
|
||||
|
||||
// Weitere Einstellungen anwenden
|
||||
document.getElementById('reduced-motion').checked = settings.reduced_motion;
|
||||
document.getElementById('notify-new-jobs').checked = settings.notifications.new_jobs;
|
||||
document.getElementById('notify-job-updates').checked = settings.notifications.job_updates;
|
||||
document.getElementById('notify-system').checked = settings.notifications.system;
|
||||
document.getElementById('notify-email').checked = settings.notifications.email;
|
||||
document.getElementById('activity-logs').checked = settings.privacy.activity_logs;
|
||||
document.getElementById('two-factor').checked = settings.privacy.two_factor;
|
||||
document.getElementById('auto-logout').value = settings.privacy.auto_logout;
|
||||
|
||||
// Kontrast-Einstellungen
|
||||
if (settings.contrast === 'high') {
|
||||
localStorage.setItem('myp-contrast', 'high');
|
||||
document.documentElement.classList.add('high-contrast');
|
||||
setActiveContrastButton(highContrastBtn);
|
||||
} else {
|
||||
localStorage.setItem('myp-contrast', 'normal');
|
||||
document.documentElement.classList.remove('high-contrast');
|
||||
setActiveContrastButton(normalContrastBtn);
|
||||
}
|
||||
// Cache the loaded settings
|
||||
settings.timestamp = new Date().toISOString();
|
||||
localStorage.setItem('myp-settings-cache', JSON.stringify(settings));
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Fehler beim Laden der Einstellungen:', error);
|
||||
// Use fallback defaults if loading fails
|
||||
applyDefaultSettings();
|
||||
}
|
||||
}
|
||||
|
||||
// Einstellungen beim Laden der Seite abrufen
|
||||
loadUserSettings();
|
||||
function applySettings(settings) {
|
||||
// Theme-Einstellungen anwenden
|
||||
if (settings.theme === 'dark') {
|
||||
localStorage.setItem(STORAGE_KEY, 'true');
|
||||
document.documentElement.classList.add('dark');
|
||||
setActiveThemeButton(darkThemeBtn);
|
||||
} else if (settings.theme === 'light') {
|
||||
localStorage.setItem(STORAGE_KEY, 'false');
|
||||
document.documentElement.classList.remove('dark');
|
||||
setActiveThemeButton(lightThemeBtn);
|
||||
} else {
|
||||
localStorage.removeItem(STORAGE_KEY);
|
||||
setActiveThemeButton(systemThemeBtn);
|
||||
}
|
||||
|
||||
// Apply reduced motion setting
|
||||
if (settings.reduced_motion) {
|
||||
document.documentElement.style.setProperty('--tw-transition-duration', '0s');
|
||||
document.getElementById('reduced-motion').checked = true;
|
||||
} else {
|
||||
document.documentElement.style.removeProperty('--tw-transition-duration');
|
||||
document.getElementById('reduced-motion').checked = false;
|
||||
}
|
||||
|
||||
// Weitere Einstellungen anwenden
|
||||
document.getElementById('notify-new-jobs').checked = settings.notifications?.new_jobs ?? true;
|
||||
document.getElementById('notify-job-updates').checked = settings.notifications?.job_updates ?? true;
|
||||
document.getElementById('notify-system').checked = settings.notifications?.system ?? true;
|
||||
document.getElementById('notify-email').checked = settings.notifications?.email ?? false;
|
||||
document.getElementById('activity-logs').checked = settings.privacy?.activity_logs ?? true;
|
||||
document.getElementById('two-factor').checked = settings.privacy?.two_factor ?? false;
|
||||
document.getElementById('auto-logout').value = settings.privacy?.auto_logout ?? '60';
|
||||
|
||||
// Kontrast-Einstellungen
|
||||
if (settings.contrast === 'high') {
|
||||
localStorage.setItem('myp-contrast', 'high');
|
||||
document.documentElement.classList.add('high-contrast');
|
||||
setActiveContrastButton(highContrastBtn);
|
||||
} else {
|
||||
localStorage.setItem('myp-contrast', 'normal');
|
||||
document.documentElement.classList.remove('high-contrast');
|
||||
setActiveContrastButton(normalContrastBtn);
|
||||
}
|
||||
}
|
||||
|
||||
function applyDefaultSettings() {
|
||||
// Apply safe defaults if loading fails
|
||||
setActiveThemeButton(systemThemeBtn);
|
||||
setActiveContrastButton(normalContrastBtn);
|
||||
|
||||
document.getElementById('reduced-motion').checked = false;
|
||||
document.getElementById('notify-new-jobs').checked = true;
|
||||
document.getElementById('notify-job-updates').checked = true;
|
||||
document.getElementById('notify-system').checked = true;
|
||||
document.getElementById('notify-email').checked = false;
|
||||
document.getElementById('activity-logs').checked = true;
|
||||
document.getElementById('two-factor').checked = false;
|
||||
document.getElementById('auto-logout').value = '60';
|
||||
}
|
||||
|
||||
// Auto-logout implementation
|
||||
let logoutTimer = null;
|
||||
|
||||
function setupAutoLogout() {
|
||||
const autoLogoutSelect = document.getElementById('auto-logout');
|
||||
|
||||
function resetLogoutTimer() {
|
||||
if (logoutTimer) {
|
||||
clearTimeout(logoutTimer);
|
||||
}
|
||||
|
||||
const minutes = parseInt(autoLogoutSelect.value);
|
||||
if (minutes && minutes !== 'never') {
|
||||
logoutTimer = setTimeout(() => {
|
||||
if (confirm('Sie werden aufgrund von Inaktivität abgemeldet. Möchten Sie angemeldet bleiben?')) {
|
||||
resetLogoutTimer();
|
||||
} else {
|
||||
window.location.href = '/logout';
|
||||
}
|
||||
}, minutes * 60 * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
// Reset timer on any user activity
|
||||
['mousedown', 'mousemove', 'keypress', 'scroll', 'touchstart', 'click'].forEach(event => {
|
||||
document.addEventListener(event, resetLogoutTimer, { passive: true });
|
||||
});
|
||||
|
||||
// Initial setup
|
||||
resetLogoutTimer();
|
||||
|
||||
// Update timer when setting changes
|
||||
autoLogoutSelect.addEventListener('change', resetLogoutTimer);
|
||||
}
|
||||
|
||||
// Enhanced toggle switches with keyboard support
|
||||
function enhanceToggleSwitches() {
|
||||
document.querySelectorAll('.toggle-checkbox').forEach(checkbox => {
|
||||
// Add keyboard support
|
||||
checkbox.addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Enter' || e.key === ' ') {
|
||||
e.preventDefault();
|
||||
this.click();
|
||||
}
|
||||
});
|
||||
|
||||
// Enhanced change handler with debouncing
|
||||
let changeTimeout;
|
||||
checkbox.addEventListener('change', function() {
|
||||
clearTimeout(changeTimeout);
|
||||
changeTimeout = setTimeout(() => {
|
||||
const settingName = this.name.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase());
|
||||
const status = this.checked ? 'aktiviert' : 'deaktiviert';
|
||||
|
||||
// Visual feedback
|
||||
const label = this.nextElementSibling;
|
||||
if (label) {
|
||||
label.style.transform = 'scale(1.05)';
|
||||
setTimeout(() => {
|
||||
label.style.transform = '';
|
||||
}, 150);
|
||||
}
|
||||
|
||||
// Auto-save individual settings
|
||||
saveIndividualSetting(this.name, this.checked);
|
||||
|
||||
showFlashMessage(`${settingName} wurde ${status}`, 'info');
|
||||
}, 300); // Debounce to prevent spam
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Save individual settings for immediate feedback
|
||||
async function saveIndividualSetting(settingName, value) {
|
||||
try {
|
||||
const response = await fetch('/api/user/setting', {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': document.querySelector('meta[name="csrf-token"]')?.getAttribute('content') || ''
|
||||
},
|
||||
body: JSON.stringify({ [settingName]: value })
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Fehler beim Speichern der Einstellung');
|
||||
}
|
||||
|
||||
// Update cache
|
||||
const cached = localStorage.getItem('myp-settings-cache');
|
||||
if (cached) {
|
||||
try {
|
||||
const settings = JSON.parse(cached);
|
||||
// Update the specific setting in cache
|
||||
const keys = settingName.split('.');
|
||||
let current = settings;
|
||||
for (let i = 0; i < keys.length - 1; i++) {
|
||||
if (!current[keys[i]]) current[keys[i]] = {};
|
||||
current = current[keys[i]];
|
||||
}
|
||||
current[keys[keys.length - 1]] = value;
|
||||
settings.timestamp = new Date().toISOString();
|
||||
localStorage.setItem('myp-settings-cache', JSON.stringify(settings));
|
||||
} catch (e) {
|
||||
localStorage.removeItem('myp-settings-cache');
|
||||
}
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Fehler beim Speichern der Einzeleinstellung:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// Performance optimization: Intersection Observer for animations
|
||||
function setupIntersectionObserver() {
|
||||
const observer = new IntersectionObserver((entries) => {
|
||||
entries.forEach(entry => {
|
||||
if (entry.isIntersecting) {
|
||||
entry.target.classList.add('in-view');
|
||||
}
|
||||
});
|
||||
}, { threshold: 0.1 });
|
||||
|
||||
document.querySelectorAll('.glass-card').forEach(card => {
|
||||
observer.observe(card);
|
||||
});
|
||||
}
|
||||
|
||||
// Initialize all enhanced features
|
||||
function initializeEnhancedFeatures() {
|
||||
setupAutoLogout();
|
||||
enhanceToggleSwitches();
|
||||
setupIntersectionObserver();
|
||||
setupNavigationLinks();
|
||||
}
|
||||
|
||||
// Setup navigation links
|
||||
function setupNavigationLinks() {
|
||||
const navItems = document.querySelectorAll('.nav-item');
|
||||
navItems.forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
// If it's a real link to another page, don't preventDefault
|
||||
if (this.getAttribute('href').startsWith('#')) {
|
||||
e.preventDefault();
|
||||
|
||||
// Update active state
|
||||
navItems.forEach(navItem => {
|
||||
navItem.classList.remove('bg-blue-50', 'dark:bg-blue-900/20', 'text-blue-700', 'dark:text-blue-300');
|
||||
navItem.classList.add('text-slate-900', 'dark:text-white', 'hover:bg-gray-100', 'dark:hover:bg-slate-800');
|
||||
});
|
||||
|
||||
this.classList.add('bg-blue-50', 'dark:bg-blue-900/20', 'text-blue-700', 'dark:text-blue-300');
|
||||
this.classList.remove('text-slate-900', 'dark:text-white', 'hover:bg-gray-100', 'dark:hover:bg-slate-800');
|
||||
|
||||
// Scroll to section with offset for header
|
||||
const targetId = this.getAttribute('href').substring(1);
|
||||
const targetElement = document.querySelector(`[id="${targetId}"]`) ||
|
||||
document.querySelector(`h2:contains("${targetId}")`);
|
||||
|
||||
if (targetElement) {
|
||||
const offsetTop = targetElement.offsetTop - 100; // Account for header
|
||||
window.scrollTo({
|
||||
top: offsetTop,
|
||||
behavior: 'smooth'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Helper function to show flash messages
|
||||
function showFlashMessage(message, type = 'info') {
|
||||
// Use the global toast manager if available
|
||||
if (window.showToast) {
|
||||
window.showToast(message, type);
|
||||
} else if (window.MYP && window.MYP.UI && window.MYP.UI.ToastManager) {
|
||||
const toast = new window.MYP.UI.ToastManager();
|
||||
toast.show(message, type);
|
||||
} else {
|
||||
alert(message);
|
||||
// Fallback to simple notification
|
||||
const notification = document.createElement('div');
|
||||
notification.className = `fixed top-4 right-4 p-4 rounded-lg text-white z-50 ${
|
||||
type === 'success' ? 'bg-green-500' :
|
||||
type === 'error' ? 'bg-red-500' :
|
||||
type === 'warning' ? 'bg-yellow-500' : 'bg-blue-500'
|
||||
}`;
|
||||
notification.textContent = message;
|
||||
document.body.appendChild(notification);
|
||||
|
||||
setTimeout(() => {
|
||||
notification.style.opacity = '0';
|
||||
setTimeout(() => document.body.removeChild(notification), 300);
|
||||
}, 3000);
|
||||
}
|
||||
}
|
||||
|
||||
// Navigation links
|
||||
const navItems = document.querySelectorAll('.nav-item');
|
||||
navItems.forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
// If it's a real link to another page, don't preventDefault
|
||||
if (this.getAttribute('href').startsWith('#')) {
|
||||
e.preventDefault();
|
||||
|
||||
// Update active state
|
||||
navItems.forEach(navItem => {
|
||||
navItem.classList.remove('bg-blue-50', 'dark:bg-blue-900/20', 'text-blue-700', 'dark:text-blue-300');
|
||||
navItem.classList.add('text-slate-900', 'dark:text-white', 'hover:bg-gray-100', 'dark:hover:bg-slate-800');
|
||||
});
|
||||
|
||||
this.classList.add('bg-blue-50', 'dark:bg-blue-900/20', 'text-blue-700', 'dark:text-blue-300');
|
||||
this.classList.remove('text-slate-900', 'dark:text-white', 'hover:bg-gray-100', 'dark:hover:bg-slate-800');
|
||||
|
||||
// Scroll to section
|
||||
const targetId = this.getAttribute('href').substring(1);
|
||||
const targetElement = document.querySelector(`[id="${targetId}"]`) ||
|
||||
document.querySelector(`h2:contains("${targetId}")`);
|
||||
|
||||
if (targetElement) {
|
||||
targetElement.scrollIntoView({ behavior: 'smooth' });
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
// Initialize everything
|
||||
loadUserSettings();
|
||||
initializeEnhancedFeatures();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* Glass Card Effect */
|
||||
.glass-card {
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
backdrop-filter: blur(12px);
|
||||
-webkit-backdrop-filter: blur(12px);
|
||||
border: 1px solid rgba(229, 231, 235, 0.8);
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
||||
padding: 1.5rem;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.dark .glass-card {
|
||||
background: rgba(30, 41, 59, 0.8);
|
||||
border-color: rgba(100, 116, 139, 0.3);
|
||||
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.glass-card:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.dark .glass-card:hover {
|
||||
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
/* Loading State Animations */
|
||||
.settings-loading {
|
||||
opacity: 0.6;
|
||||
pointer-events: none;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.settings-loading::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin: -10px 0 0 -10px;
|
||||
border: 2px solid #f3f3f3;
|
||||
border-top: 2px solid #3498db;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
/* Enhanced Toggle Switches */
|
||||
.toggle-checkbox {
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
/* Toggle Switch Styling */
|
||||
.toggle-checkbox:checked {
|
||||
right: 0;
|
||||
border-color: #60a5fa;
|
||||
@apply bg-blue-500;
|
||||
border-color: #3b82f6;
|
||||
background-color: #3b82f6;
|
||||
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
||||
}
|
||||
|
||||
.toggle-checkbox:checked + .toggle-label {
|
||||
@apply bg-blue-500 dark:bg-blue-600;
|
||||
background-color: #3b82f6;
|
||||
}
|
||||
|
||||
.dark .toggle-checkbox:checked + .toggle-label {
|
||||
background-color: #2563eb;
|
||||
}
|
||||
|
||||
.toggle-label {
|
||||
transition: background-color 0.3s ease;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.toggle-checkbox:focus + .toggle-label {
|
||||
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
||||
}
|
||||
|
||||
/* Button states */
|
||||
.theme-btn.active,
|
||||
.contrast-btn.active {
|
||||
box-shadow: 0 0 0 2px #3b82f6;
|
||||
}
|
||||
|
||||
/* High contrast mode styles */
|
||||
.high-contrast {
|
||||
--tw-text-opacity: 1;
|
||||
}
|
||||
|
||||
.high-contrast * {
|
||||
outline: 2px solid transparent;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.high-contrast button:focus,
|
||||
.high-contrast input:focus,
|
||||
.high-contrast select:focus {
|
||||
outline: 3px solid #000 !important;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.dark.high-contrast button:focus,
|
||||
.dark.high-contrast input:focus,
|
||||
.dark.high-contrast select:focus {
|
||||
outline: 3px solid #fff !important;
|
||||
}
|
||||
|
||||
/* Accessibility improvements */
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.glass-card,
|
||||
.toggle-checkbox,
|
||||
.toggle-label {
|
||||
transition: none !important;
|
||||
}
|
||||
|
||||
.settings-loading::after {
|
||||
animation: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Success feedback animation */
|
||||
.settings-saved {
|
||||
animation: settingsSaved 0.6s ease-in-out;
|
||||
}
|
||||
|
||||
@keyframes settingsSaved {
|
||||
0% { transform: scale(1); }
|
||||
50% { transform: scale(1.02); background-color: rgba(34, 197, 94, 0.1); }
|
||||
100% { transform: scale(1); }
|
||||
}
|
||||
|
||||
/* Smooth section transitions */
|
||||
.settings-section {
|
||||
scroll-margin-top: 2rem;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user