Files
Projektarbeit-MYP/backend/app/templates/guest_status.html

396 lines
21 KiB
HTML

{% extends "base.html" %}
{% block title %}Anfrage-Status - Mercedes-Benz MYP Platform{% endblock %}
{% block head %}
{{ super() }}
<meta name="csrf-token" content="{{ csrf_token() }}">
<meta http-equiv="refresh" content="30">
{% endblock %}
{% block content %}
<div class="bg-professional" style="background: #f8fafc !important;">
<!-- Dark Mode Override -->
<style>
.dark .bg-professional {
background: #000000 !important;
}
.dark .professional-hero {
background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%) !important;
border-color: #333333 !important;
}
.dark .professional-container {
background: #111111 !important;
border-color: #333333 !important;
}
.dark .mb-glass {
background: rgba(17, 17, 17, 0.95) !important;
border-color: rgba(255, 255, 255, 0.1) !important;
}
</style>
<!-- Professional Hero Header -->
<div class="professional-hero hero-pattern animate-fade-in" style="margin: 2rem; margin-bottom: 3rem;">
<div class="absolute inset-0 bg-gradient-to-r from-black/10 to-black/20 dark:from-black/40 dark:to-black/60"></div>
<!-- Status Indicator -->
<div class="absolute top-6 right-6 flex items-center space-x-4 z-10">
<div class="mb-glass rounded-full px-6 py-3 animate-scale-in">
<div class="flex items-center space-x-3">
<div class="status-dot status-online"></div>
<span class="text-sm font-semibold text-professional-primary">Live Status</span>
</div>
</div>
<div class="mb-glass rounded-full px-6 py-3 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-20 z-10">
<div class="text-center animate-slide-up">
<!-- Mercedes-Benz Logo -->
<div class="inline-flex items-center justify-center w-28 h-28 mb-glass rounded-full mb-10 professional-shadow">
<svg class="w-14 h-14 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-6xl md:text-7xl font-bold mb-8 tracking-tight">
Anfrage-Status
</h1>
<p class="subtitle-professional text-2xl md:text-3xl max-w-5xl mx-auto leading-relaxed mb-12">
Verfolgen Sie den Status Ihrer Gastanfrage für 3D-Druck in Echtzeit
</p>
</div>
</div>
</div>
<div class="max-w-4xl mx-auto px-6 lg:px-8 -mt-12 relative z-10" style="margin-bottom: 4rem;">
<!-- Status Card -->
<div class="professional-container animate-slide-up" style="padding: 3rem; border-radius: 2rem; margin-bottom: 2rem;">
<!-- Status Badge -->
<div class="flex justify-center mb-8">
{% if request.status == 'pending' %}
<div class="inline-flex items-center px-8 py-4 rounded-3xl bg-yellow-100 dark:bg-yellow-900/30 text-yellow-800 dark:text-yellow-200 text-lg font-bold">
<svg class="w-6 h-6 mr-3 animate-spin" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"></path>
</svg>
Wird geprüft
</div>
{% elif request.status == 'approved' %}
<div class="inline-flex items-center px-8 py-4 rounded-3xl bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-200 text-lg font-bold">
<svg class="w-6 h-6 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
</svg>
Genehmigt
</div>
{% elif request.status == 'denied' %}
<div class="inline-flex items-center px-8 py-4 rounded-3xl bg-red-100 dark:bg-red-900/30 text-red-800 dark:text-red-200 text-lg font-bold">
<svg class="w-6 h-6 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
</svg>
Abgelehnt
</div>
{% endif %}
</div>
<!-- Anfrage-Details -->
<div class="space-y-8 mb-10">
<div class="text-center mb-12">
<h2 class="title-professional text-3xl font-bold mb-4">
Anfrage Details
</h2>
<p class="subtitle-professional text-lg">
Übersicht Ihrer eingereichten Gastanfrage
</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-8">
<div class="mb-glass p-6 rounded-2xl">
<h3 class="text-base font-bold text-professional-primary mb-3">Anfrage-ID</h3>
<p class="text-2xl font-bold text-professional-accent">#{{ request.id }}</p>
</div>
<div class="mb-glass p-6 rounded-2xl">
<h3 class="text-base font-bold text-professional-primary mb-3">Erstellt am</h3>
<p class="text-2xl font-bold text-professional-primary">{{ request.created_at|format_datetime }}</p>
</div>
<div class="mb-glass p-6 rounded-2xl">
<h3 class="text-base font-bold text-professional-primary mb-3">Name</h3>
<p class="text-2xl font-bold text-professional-primary">{{ request.name }}</p>
</div>
<div class="mb-glass p-6 rounded-2xl">
<h3 class="text-base font-bold text-professional-primary mb-3">Gewünschte Dauer</h3>
<p class="text-2xl font-bold text-professional-accent">{{ request.duration_min }} Minuten</p>
</div>
</div>
{% if request.reason %}
<div class="mb-glass p-6 rounded-2xl">
<h3 class="text-base font-bold text-professional-primary mb-4">Begründung</h3>
<p class="text-professional-secondary text-lg leading-relaxed">{{ request.reason }}</p>
</div>
{% endif %}
{% if request.printer %}
<div class="mb-glass p-6 rounded-2xl">
<h3 class="text-base font-bold text-professional-primary mb-4">Drucker</h3>
<p class="text-professional-secondary text-lg">{{ request.printer.name }} {% if request.printer.location %}({{ request.printer.location }}){% endif %}</p>
</div>
{% endif %}
</div>
<!-- Status-spezifische Inhalte -->
{% if request.status == 'pending' %}
<div class="alert-professional alert-warning" style="border-radius: 2rem; padding: 2.5rem;">
<div class="flex-shrink-0">
<div class="w-16 h-16 bg-gradient-to-br from-yellow-500 to-orange-600 rounded-3xl flex items-center justify-center">
<svg class="h-8 w-8 text-white" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd"></path>
</svg>
</div>
</div>
<div class="flex-1 ml-8">
<h3 class="text-2xl font-bold text-professional-primary mb-4">Ihre Anfrage wird geprüft</h3>
<p class="text-lg text-professional-secondary leading-relaxed">
Unser Team prüft Ihre Anfrage mit höchster Priorität. Sie erhalten eine sofortige Benachrichtigung, sobald eine Entscheidung getroffen wurde.
Diese Seite aktualisiert sich automatisch alle 30 Sekunden.
</p>
</div>
</div>
{% elif request.status == 'approved' %}
<div class="alert-professional alert-success" style="border-radius: 2rem; padding: 2.5rem; margin-bottom: 2rem;">
<div class="flex-shrink-0">
<div class="w-16 h-16 bg-gradient-to-br from-green-500 to-emerald-600 rounded-3xl flex items-center justify-center">
<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"/>
</svg>
</div>
</div>
<div class="flex-1 ml-8">
<h3 class="text-2xl font-bold text-professional-primary mb-4">Anfrage genehmigt!</h3>
<p class="text-lg text-professional-secondary leading-relaxed">Ihr Druckauftrag wurde genehmigt und ist bereit zum Start.</p>
</div>
</div>
{% if otp_code %}
<!-- Code-Anzeige -->
<div class="professional-container" style="padding: 2.5rem; border-radius: 2rem; margin-bottom: 2rem;">
<h4 class="text-2xl font-bold text-professional-primary mb-8 text-center">Ihr Zugangscode</h4>
<!-- 6-stelliger Code in schönen Boxen -->
<div class="flex justify-center space-x-4 mb-8">
{% for char in otp_code %}
<div class="w-20 h-20 bg-gradient-to-br from-blue-500 to-indigo-600 text-white rounded-2xl flex items-center justify-center text-3xl font-bold shadow-lg transform hover:scale-105 transition-transform duration-300">
{{ char }}
</div>
{% endfor %}
</div>
<!-- Code zum Kopieren -->
<div class="text-center mb-8">
<div class="inline-flex items-center mb-glass rounded-2xl px-6 py-4">
<span class="text-2xl font-mono font-bold text-professional-primary mr-4" id="otpCode">{{ otp_code }}</span>
<button onclick="copyCode()" class="text-professional-accent hover:text-professional-primary transition-colors duration-200" title="Code kopieren">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/>
</svg>
</button>
</div>
</div>
<!-- Wichtige Hinweise -->
<div class="alert-professional alert-warning" style="border-radius: 1.5rem; padding: 2rem; margin-bottom: 2rem;">
<div class="flex-shrink-0">
<div class="w-12 h-12 bg-gradient-to-br from-amber-500 to-orange-600 rounded-2xl 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 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.732-.833-2.5 0L3.734 16.5c-.77.833.192 2.5 1.732 2.5z"/>
</svg>
</div>
</div>
<div class="flex-1 ml-6">
<h5 class="text-xl font-bold text-professional-primary mb-4">Wichtige Hinweise:</h5>
<ul class="text-base text-professional-secondary space-y-2">
<li>• Dieser Code ist nur <strong>einmalig verwendbar</strong></li>
<li>• Notieren Sie sich den Code oder speichern Sie diese Seite</li>
<li>• Bei Verlust des Codes kontaktieren Sie den Administrator</li>
</ul>
</div>
</div>
<!-- Start-Button -->
<div class="text-center">
<a href="{{ url_for('guest.guest_start_job_form') }}"
class="btn-success-professional group px-10 py-5 text-lg">
<svg class="w-6 h-6 mr-4 group-hover:scale-110 transition-transform duration-300" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.828 14.828a4 4 0 01-5.656 0M9 10h1m4 0h1m-6 4h.01M12 5v.01M12 19v.01M12 12h.01M12 9a3 3 0 100-6 3 3 0 000 6zm0 0a3 3 0 100 6 3 3 0 000-6z"/>
</svg>
Job jetzt starten
</a>
</div>
</div>
{% elif show_start_link %}
<!-- Code bereits vorhanden, aber noch nicht verwendet -->
<div class="professional-container" style="padding: 2.5rem; border-radius: 2rem;">
<div class="text-center">
<div class="w-20 h-20 bg-gradient-to-r from-blue-500 to-indigo-500 rounded-full flex items-center justify-center mx-auto mb-6">
<svg class="w-10 h-10 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-3a1 1 0 011-1h2.586l6.243-6.243A6 6 0 0121 9z"/>
</svg>
</div>
<h4 class="text-2xl font-bold text-professional-primary mb-4">Zugangscode bereits generiert</h4>
<p class="text-lg text-professional-secondary mb-8">Ihr persönlicher Code wurde bereits erstellt und ist bereit zur Verwendung.</p>
<a href="{{ url_for('guest.guest_start_job_form') }}"
class="btn-professional group px-10 py-5 text-lg">
<svg class="w-6 h-6 mr-4 group-hover:scale-110 transition-transform duration-300" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-3a1 1 0 011-1h2.586l6.243-6.243A6 6 0 0121 9z"/>
</svg>
Code eingeben und starten
</a>
</div>
</div>
{% endif %}
{% elif request.status == 'denied' %}
<div class="alert-professional alert-danger" style="border-radius: 2rem; padding: 2.5rem;">
<div class="flex-shrink-0">
<div class="w-16 h-16 bg-gradient-to-br from-red-500 to-red-600 rounded-3xl flex items-center justify-center">
<svg class="h-8 w-8 text-white" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"></path>
</svg>
</div>
</div>
<div class="flex-1 ml-8">
<h3 class="text-2xl font-bold text-professional-primary mb-4">Anfrage abgelehnt</h3>
<p class="text-lg text-professional-secondary leading-relaxed">
Ihre Anfrage wurde leider abgelehnt. Bei Fragen wenden Sie sich bitte an unser Team.
</p>
</div>
</div>
{% endif %}
</div>
<!-- Aktionen -->
<div class="flex items-center justify-center space-x-6">
<a href="{{ url_for('guest.guest_request_form') }}"
class="btn-professional group px-8 py-4">
<svg class="w-6 h-6 mr-3 group-hover:scale-110 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 6v6m0 0v6m0-6h6m-6 0H6"/>
</svg>
Neue Anfrage stellen
</a>
<button onclick="location.reload()"
class="btn-professional group px-8 py-4">
<svg class="w-6 h-6 mr-3 group-hover:rotate-180 transition-transform duration-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/>
</svg>
Aktualisieren
</button>
</div>
</div>
</div>
<script>
// Live Time Update
function updateLiveTime() {
const now = new Date();
document.getElementById('live-time').textContent = now.toLocaleTimeString('de-DE');
}
updateLiveTime();
setInterval(updateLiveTime, 1000);
// Code-Kopier-Funktion
function copyCode() {
const codeElement = document.getElementById('otpCode');
if (codeElement) {
const code = codeElement.textContent;
// Versuche den Code in die Zwischenablage zu kopieren
if (navigator.clipboard) {
navigator.clipboard.writeText(code).then(function() {
showCopySuccess();
}).catch(function(err) {
console.error('Fehler beim Kopieren:', err);
fallbackCopyText(code);
});
} else {
fallbackCopyText(code);
}
}
}
// Fallback für ältere Browser
function fallbackCopyText(text) {
const textArea = document.createElement('textarea');
textArea.value = text;
textArea.style.position = 'fixed';
textArea.style.left = '-999999px';
textArea.style.top = '-999999px';
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
document.execCommand('copy');
showCopySuccess();
} catch (err) {
console.error('Fallback-Kopieren fehlgeschlagen:', err);
alert('Code konnte nicht kopiert werden. Bitte manuell markieren und kopieren.');
}
document.body.removeChild(textArea);
}
// Erfolgs-Animation für das Kopieren
function showCopySuccess() {
const button = event.target.closest('button');
const originalHTML = button.innerHTML;
button.innerHTML = `
<svg class="w-6 h-6 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
</svg>
`;
// Nach 2 Sekunden zurück zum Original
setTimeout(() => {
button.innerHTML = originalHTML;
}, 2000);
// Optional: Toast-Benachrichtigung
showToast('Code wurde in die Zwischenablage kopiert!');
}
// Toast-Benachrichtigung
function showToast(message) {
// Toast-Element erstellen, falls nicht vorhanden
let toast = document.getElementById('copyToast');
if (!toast) {
toast = document.createElement('div');
toast.id = 'copyToast';
toast.className = 'fixed top-4 right-4 bg-green-500 text-white px-6 py-3 rounded-lg shadow-lg transform transition-all duration-300 translate-x-full opacity-0 z-50';
document.body.appendChild(toast);
}
toast.textContent = message;
// Animation einblenden
setTimeout(() => {
toast.classList.remove('translate-x-full', 'opacity-0');
}, 100);
// Nach 3 Sekunden ausblenden
setTimeout(() => {
toast.classList.add('translate-x-full', 'opacity-0');
}, 3000);
}
</script>
{% endblock %}