Projektarbeit-MYP/backend/app/templates/guest_request.html

435 lines
25 KiB
HTML

{% extends "base.html" %}
{% block title %}Gastanfrage - Mercedes-Benz MYP Platform{% endblock %}
{% block head %}
{{ super() }}
<meta name="csrf-token" content="{{ csrf_token() }}">
{% endblock %}
{% block content %}
<div class="bg-professional">
<!-- Professional Hero Header -->
<div class="professional-hero hero-pattern animate-fade-in">
<div class="absolute inset-0 bg-gradient-to-r from-black/10 to-black/20 dark:from-black/20 dark:to-black/40"></div>
<!-- Status Indicator -->
<div class="absolute top-6 right-6 flex items-center space-x-3 z-10">
<div class="mb-glass rounded-full px-4 py-2 animate-scale-in">
<div class="flex items-center space-x-2">
<div class="status-dot status-online"></div>
<span class="text-sm font-semibold text-professional-primary">Online</span>
</div>
</div>
<div class="mb-glass rounded-full px-4 py-2 animate-scale-in">
<span id="live-time" class="text-sm font-semibold text-professional-primary"></span>
</div>
</div>
<div class="relative max-w-6xl mx-auto px-6 lg:px-8 py-16 z-10">
<div class="text-center animate-slide-up">
<!-- Mercedes-Benz Logo -->
<div class="inline-flex items-center justify-center w-24 h-24 mb-glass rounded-full mb-8 professional-shadow">
<svg class="w-12 h-12 text-professional-primary" 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>
<h1 class="title-professional text-5xl md:text-6xl font-bold mb-6 tracking-tight">
Premium Gastanfrage
</h1>
<p class="subtitle-professional text-xl md:text-2xl max-w-4xl mx-auto leading-relaxed mb-8">
Exklusiver Zugang zu unseren hochmodernen 3D-Produktionsanlagen mit Mercedes-Benz Qualitätsstandard
</p>
<!-- Key Features -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mt-12">
<div class="card-professional text-center">
<div class="w-12 h-12 bg-gradient-to-br from-blue-400 to-blue-600 rounded-xl mx-auto mb-4 flex items-center justify-center">
<svg class="w-6 h-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"/>
</svg>
</div>
<h3 class="text-lg font-semibold text-professional-primary mb-2">Automatisierte Prüfverfahren für maximale Effizienz</h3>
<p class="text-professional-muted text-sm">Schnelle Bearbeitung Ihrer Anfrage</p>
</div>
<div class="card-professional text-center">
<div class="w-12 h-12 bg-gradient-to-br from-green-400 to-green-600 rounded-xl mx-auto mb-4 flex items-center justify-center">
<svg class="w-6 h-6 text-white" 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 text-professional-primary mb-2">Professionelle 3D-Drucker nach Industriestandard</h3>
<p class="text-professional-muted text-sm">Höchste Qualität für Ihre Projekte</p>
</div>
<div class="card-professional text-center">
<div class="w-12 h-12 bg-gradient-to-br from-purple-400 to-purple-600 rounded-xl mx-auto mb-4 flex items-center justify-center">
<svg class="w-6 h-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
</div>
<h3 class="text-lg font-semibold text-professional-primary mb-2">24/7 verfügbar nach Terminvereinbarung</h3>
<p class="text-professional-muted text-sm">Flexible Zeiten für Ihre Bedürfnisse</p>
</div>
</div>
</div>
</div>
</div>
<div class="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 -mt-8 relative z-10">
<!-- Form Container -->
<div class="professional-container p-8 lg:p-12 animate-slide-up">
<div class="text-center mb-10">
<h2 class="title-professional text-3xl font-bold mb-4">
Starten Sie Ihre Anfrage
</h2>
<p class="subtitle-professional text-lg">
Füllen Sie das folgende Formular aus und erhalten Sie innerhalb weniger Minuten Ihren persönlichen Zugangscode.
</p>
</div>
<form id="guestRequestForm" class="space-y-8">
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
<!-- Name (Pflichtfeld) -->
<div class="group">
<label for="name" class="block text-sm font-semibold text-professional-primary mb-3">
Vollständiger Name <span class="text-red-500">*</span>
</label>
<input type="text" name="name" id="name" required
class="input-professional"
placeholder="Max Mustermann">
<div class="mt-2 text-xs text-professional-muted">
Geben Sie Ihren vollständigen Namen für die Registrierung ein
</div>
</div>
<!-- E-Mail -->
<div class="group">
<label for="email" class="block text-sm font-semibold text-professional-primary mb-3">
E-Mail-Adresse
</label>
<input type="email" name="email" id="email"
class="input-professional"
placeholder="max.mustermann@mercedes-benz.com">
<div class="mt-2 text-xs text-professional-muted">
Optional: Für Updates und Benachrichtigungen
</div>
</div>
</div>
<!-- Projektzweck -->
<div class="group">
<label for="reason" class="block text-sm font-semibold text-professional-primary mb-3">
Projektbeschreibung & Verwendungszweck
</label>
<textarea name="reason" id="reason" rows="4"
class="input-professional resize-none"
placeholder="Beschreiben Sie ausführlich Ihr Projekt, den geplanten Druckauftrag und den Verwendungszweck. Je detaillierter, desto schneller die Genehmigung..."></textarea>
<div class="mt-2 text-xs text-professional-muted">
Tipp: Eine detaillierte Beschreibung beschleunigt die Genehmigung erheblich
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
<!-- Druckdauer -->
<div class="group">
<label for="duration_min" class="block text-sm font-semibold text-professional-primary mb-3">
Geschätzte Produktionszeit
</label>
<div class="relative">
<input type="number" name="duration_min" id="duration_min" value="60" min="15" max="480"
class="input-professional"
placeholder="60">
<div class="absolute inset-y-0 right-0 flex items-center pr-6 pointer-events-none">
<span class="text-professional-muted font-medium">min</span>
</div>
</div>
<div class="mt-2 flex items-center justify-between text-xs text-professional-muted">
<span>Minimum: 15 Minuten</span>
<span>Maximum: 8 Stunden</span>
</div>
<div class="mt-1 w-full bg-slate-200 dark:bg-slate-600 rounded-full h-1">
<div id="duration-progress" class="bg-gradient-to-r from-blue-500 to-purple-500 h-1 rounded-full transition-all duration-300" style="width: 12.5%"></div>
</div>
</div>
<!-- Drucker-Auswahl -->
{% if printers %}
<div class="group">
<label for="printer_id" class="block text-sm font-semibold text-professional-primary mb-3">
Bevorzugte Produktionseinheit
</label>
<div class="relative">
<select name="printer_id" id="printer_id"
class="input-professional appearance-none pr-12 cursor-pointer">
<option value="">Automatische Zuweisung</option>
{% for printer in printers %}
<option value="{{ printer.id }}">{{ printer.name }} {% if printer.location %}({{ printer.location }}){% endif %}</option>
{% endfor %}
</select>
<div class="absolute inset-y-0 right-0 flex items-center pr-6 pointer-events-none">
<svg class="h-5 w-5 text-professional-muted" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
</svg>
</div>
</div>
<div class="mt-2 text-xs text-professional-muted">
Tipp: Lassen Sie das System den optimalen Drucker für Sie auswählen
</div>
</div>
{% endif %}
</div>
<!-- Professional Info-Box -->
<div class="alert-professional alert-info">
<div class="flex-shrink-0">
<div class="w-12 h-12 bg-gradient-to-br from-blue-500 to-indigo-600 rounded-2xl flex items-center justify-center">
<svg class="h-6 w-6 text-white" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"></path>
</svg>
</div>
</div>
<div class="flex-1">
<h3 class="text-lg font-semibold text-professional-primary mb-4">
Mercedes-Benz Professional Service
</h3>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div class="flex items-center space-x-3">
<div class="w-2 h-2 bg-green-400 rounded-full"></div>
<span class="text-sm text-professional-secondary">Express-Bearbeitung in unter 5 Minuten</span>
</div>
<div class="flex items-center space-x-3">
<div class="w-2 h-2 bg-blue-400 rounded-full"></div>
<span class="text-sm text-professional-secondary">6-stelliger Sicherheitscode per E-Mail</span>
</div>
<div class="flex items-center space-x-3">
<div class="w-2 h-2 bg-purple-400 rounded-full"></div>
<span class="text-sm text-professional-secondary">Einmalige Verwendung für maximale Sicherheit</span>
</div>
<div class="flex items-center space-x-3">
<div class="w-2 h-2 bg-orange-400 rounded-full"></div>
<span class="text-sm text-professional-secondary">5 Minuten Toleranz nach geplanter Startzeit</span>
</div>
</div>
</div>
</div>
<!-- Professional Action Buttons -->
<div class="flex flex-col sm:flex-row items-center justify-end space-y-4 sm:space-y-0 sm:space-x-6 pt-8 border-t border-slate-200 dark:border-slate-600">
<a href="{{ url_for('index') }}"
class="btn-secondary-professional w-full sm:w-auto text-center">
← Zurück zur Übersicht
</a>
<button type="submit" id="submitBtn"
class="btn-professional w-full sm:w-auto group">
<span class="flex items-center justify-center">
<svg class="w-5 h-5 mr-3 group-hover:rotate-12 transition-transform duration-300" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"/>
</svg>
Anfrage übermitteln
</span>
</button>
</div>
</form>
</div>
<!-- Additional Info Section -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mt-8 animate-slide-up">
<div class="card-professional text-center">
<div class="w-12 h-12 bg-gradient-to-br from-emerald-400 to-emerald-600 rounded-xl mx-auto mb-4 flex items-center justify-center">
<svg class="w-6 h-6 text-white" 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 text-professional-primary mb-2">Qualitätsgarantie</h3>
<p class="text-sm text-professional-muted">Mercedes-Benz Qualitätsstandards bei jedem Druckauftrag</p>
</div>
<div class="card-professional text-center">
<div class="w-12 h-12 bg-gradient-to-br from-blue-400 to-blue-600 rounded-xl mx-auto mb-4 flex items-center justify-center">
<svg class="w-6 h-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.364 5.636l-3.536 3.536m0 5.656l3.536 3.536M9.172 9.172L5.636 5.636m3.536 9.192L5.636 18.364M12 12h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
</div>
<h3 class="text-lg font-semibold text-professional-primary mb-2">24/7 Support</h3>
<p class="text-sm text-professional-muted">Rund-um-die-Uhr technische Unterstützung</p>
</div>
<div class="card-professional text-center">
<div class="w-12 h-12 bg-gradient-to-br from-purple-400 to-purple-600 rounded-xl mx-auto mb-4 flex items-center justify-center">
<svg class="w-6 h-6 text-white" 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>
<h3 class="text-lg font-semibold text-professional-primary mb-2">Datenschutz</h3>
<p class="text-sm text-professional-muted">Höchste Sicherheitsstandards für Ihre Daten</p>
</div>
</div>
</div>
</div>
<!-- Professional Success Modal -->
<div id="successModal" class="fixed inset-0 bg-black/60 backdrop-blur-sm hidden z-50">
<div class="flex items-center justify-center min-h-screen p-4">
<div class="professional-container max-w-lg w-full p-8 transform transition-all duration-500 scale-95 opacity-0" id="successModalContent">
<div class="text-center">
<div class="mx-auto flex items-center justify-center h-16 w-16 rounded-full bg-gradient-to-br from-green-400 to-emerald-500 mb-6">
<svg class="h-8 w-8 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
</svg>
</div>
<h3 class="text-2xl font-bold text-professional-primary mb-4">
Anfrage erfolgreich übermittelt!
</h3>
<p class="text-professional-muted mb-6">
Ihre Gastanfrage wurde eingereicht und wird mit höchster Priorität bearbeitet. Sie können den Bearbeitungsstatus jederzeit unter folgendem Link verfolgen:
</p>
<div class="professional-container p-4 mb-6">
<code id="statusUrl" class="text-sm text-professional-primary break-all font-mono"></code>
</div>
<div class="flex items-center justify-center space-x-4">
<button onclick="closeSuccessModal()"
class="btn-professional">
Verstanden
</button>
<button onclick="copyStatusUrl()"
class="btn-secondary-professional">
Link kopieren
</button>
</div>
</div>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const form = document.getElementById('guestRequestForm');
const submitBtn = document.getElementById('submitBtn');
const successModal = document.getElementById('successModal');
const successModalContent = document.getElementById('successModalContent');
const statusUrl = document.getElementById('statusUrl');
const durationInput = document.getElementById('duration_min');
const durationProgress = document.getElementById('duration-progress');
// Live Time Update
function updateLiveTime() {
const now = new Date();
document.getElementById('live-time').textContent = now.toLocaleTimeString('de-DE');
}
updateLiveTime();
setInterval(updateLiveTime, 1000);
// Duration Progress Bar
durationInput.addEventListener('input', function() {
const value = parseInt(this.value) || 0;
const percentage = Math.min((value / 480) * 100, 100);
durationProgress.style.width = percentage + '%';
// Color changes based on duration
if (value <= 60) {
durationProgress.className = 'bg-gradient-to-r from-green-500 to-emerald-500 h-1 rounded-full transition-all duration-300';
} else if (value <= 240) {
durationProgress.className = 'bg-gradient-to-r from-blue-500 to-cyan-500 h-1 rounded-full transition-all duration-300';
} else {
durationProgress.className = 'bg-gradient-to-r from-orange-500 to-red-500 h-1 rounded-full transition-all duration-300';
}
});
// Form Submit Handler
form.addEventListener('submit', async function(e) {
e.preventDefault();
// Button Animation
submitBtn.disabled = true;
submitBtn.innerHTML = '<span class="flex items-center justify-center"><svg class="animate-spin w-5 h-5 mr-3" 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>Wird übertragen...</span>';
try {
const formData = new FormData(form);
const data = {
name: formData.get('name'),
email: formData.get('email'),
reason: formData.get('reason'),
duration_min: parseInt(formData.get('duration_min')) || 60,
printer_id: formData.get('printer_id') ? parseInt(formData.get('printer_id')) : null
};
// CSRF-Token aus Meta-Tag auslesen
const csrfToken = document.querySelector('meta[name="csrf-token"]')?.content;
const headers = {
'Content-Type': 'application/json',
'X-Requested-With': 'XMLHttpRequest'
};
// CSRF-Token hinzufügen, wenn vorhanden
if (csrfToken) {
headers['X-CSRFToken'] = csrfToken;
}
const response = await fetch('/api/guest/requests', {
method: 'POST',
headers: headers,
body: JSON.stringify(data)
});
const result = await response.json();
if (result.success) {
// Status-URL anzeigen
const url = window.location.origin + `/request/${result.request_id}`;
statusUrl.textContent = url;
// Success Modal mit Animation anzeigen
successModal.classList.remove('hidden');
setTimeout(() => {
successModalContent.classList.remove('scale-95', 'opacity-0');
successModalContent.classList.add('scale-100', 'opacity-100');
}, 10);
// Formular zurücksetzen
form.reset();
durationProgress.style.width = '12.5%';
} else {
alert('Fehler: ' + (result.error || 'Unbekannter Fehler'));
}
} catch (error) {
console.error('Fehler beim Senden der Anfrage:', error);
alert('Fehler beim Senden der Anfrage. Bitte versuchen Sie es später erneut.');
} finally {
// Button zurücksetzen
submitBtn.disabled = false;
submitBtn.innerHTML = '<span class="flex items-center justify-center"><svg class="w-5 h-5 mr-3 group-hover:rotate-12 transition-transform duration-300" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"/></svg>Anfrage übermitteln</span>';
}
});
// Modal functions
window.closeSuccessModal = function() {
successModalContent.classList.remove('scale-100', 'opacity-100');
successModalContent.classList.add('scale-95', 'opacity-0');
setTimeout(() => {
successModal.classList.add('hidden');
}, 200);
};
window.copyStatusUrl = function() {
navigator.clipboard.writeText(statusUrl.textContent).then(() => {
// Temporary feedback
const originalText = statusUrl.textContent;
statusUrl.textContent = 'Link kopiert!';
setTimeout(() => {
statusUrl.textContent = originalText;
}, 2000);
});
};
});
</script>
{% endblock %}