289 lines
16 KiB
HTML
289 lines
16 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}Meine Druckanträge - Mercedes-Benz MYP Platform{% endblock %}
|
|
|
|
{% block head %}
|
|
{{ super() }}
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="space-y-8">
|
|
<!-- Page Header -->
|
|
<div class="dashboard-card p-6">
|
|
<div class="flex flex-col md:flex-row md:items-center md:justify-between gap-6">
|
|
<div class="flex items-center gap-4">
|
|
<div class="w-12 h-12 flex-shrink-0">
|
|
<svg class="w-full h-full text-slate-900 dark:text-white" 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>
|
|
</div>
|
|
<div>
|
|
<h1 class="text-3xl font-bold text-slate-900 dark:text-white tracking-tight">Meine Druckanträge</h1>
|
|
<p class="text-slate-500 dark:text-slate-400 mt-1">Übersicht Ihrer eingereichten Anträge für {{ email }}</p>
|
|
</div>
|
|
</div>
|
|
<div class="flex flex-wrap gap-3">
|
|
<a href="{{ url_for('guest.guest_request_form') }}"
|
|
class="btn-primary flex items-center gap-2">
|
|
<svg class="w-5 h-5" 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>
|
|
<span>Neuen Antrag stellen</span>
|
|
</a>
|
|
<button onclick="location.reload()"
|
|
class="btn-secondary flex items-center gap-2">
|
|
<svg class="w-5 h-5" 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>
|
|
<span>Aktualisieren</span>
|
|
</a>
|
|
<a href="{{ url_for('guest.guest_requests_overview') }}"
|
|
class="btn-secondary flex items-center gap-2">
|
|
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"/>
|
|
</svg>
|
|
<span>Alle Anträge</span>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Statistics Cards -->
|
|
<div class="grid grid-cols-1 md:grid-cols-4 gap-6">
|
|
{% set total_requests = requests|length %}
|
|
{% set pending_requests = requests|selectattr("request.status", "equalto", "pending")|list|length %}
|
|
{% set approved_requests = requests|selectattr("request.status", "equalto", "approved")|list|length %}
|
|
{% set denied_requests = requests|selectattr("request.status", "equalto", "denied")|list|length %}
|
|
|
|
<div class="dashboard-card p-6">
|
|
<div class="flex justify-between">
|
|
<div>
|
|
<h3 class="stat-label">Gesamt</h3>
|
|
<div class="stat-value">{{ total_requests }}</div>
|
|
</div>
|
|
<div class="mb-stat-icon text-slate-600 dark:text-slate-400">
|
|
<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="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="dashboard-card p-6">
|
|
<div class="flex justify-between">
|
|
<div>
|
|
<h3 class="stat-label">Prüfung</h3>
|
|
<div class="stat-value text-yellow-600 dark:text-yellow-400">{{ pending_requests }}</div>
|
|
</div>
|
|
<div class="mb-stat-icon text-yellow-600 dark:text-yellow-400">
|
|
<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="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="dashboard-card p-6">
|
|
<div class="flex justify-between">
|
|
<div>
|
|
<h3 class="stat-label">Genehmigt</h3>
|
|
<div class="stat-value text-green-600 dark:text-green-400">{{ approved_requests }}</div>
|
|
</div>
|
|
<div class="mb-stat-icon text-green-600 dark:text-green-400">
|
|
<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="M5 13l4 4L19 7"/>
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="dashboard-card p-6">
|
|
<div class="flex justify-between">
|
|
<div>
|
|
<h3 class="stat-label">Abgelehnt</h3>
|
|
<div class="stat-value text-red-600 dark:text-red-400">{{ denied_requests }}</div>
|
|
</div>
|
|
<div class="mb-stat-icon text-red-600 dark:text-red-400">
|
|
<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="M6 18L18 6M6 6l12 12"/>
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Requests List -->
|
|
{% if error %}
|
|
<div class="dashboard-card p-8 text-center">
|
|
<div class="text-red-500 dark:text-red-400 mb-4">
|
|
<svg class="w-12 h-12 mx-auto mb-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
|
</svg>
|
|
</div>
|
|
<h3 class="text-lg font-semibold text-slate-900 dark:text-white mb-2">Fehler beim Laden</h3>
|
|
<p class="text-slate-500 dark:text-slate-400">{{ error }}</p>
|
|
</div>
|
|
{% elif requests|length == 0 %}
|
|
<div class="dashboard-card p-8 text-center">
|
|
<div class="text-slate-400 dark:text-slate-500 mb-4">
|
|
<svg class="w-12 h-12 mx-auto mb-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
|
|
</svg>
|
|
</div>
|
|
<h3 class="text-lg font-semibold text-slate-900 dark:text-white mb-2">Keine Druckanträge gefunden</h3>
|
|
<p class="text-slate-500 dark:text-slate-400 mb-4">
|
|
Für die E-Mail-Adresse {{ email }} wurden keine Druckanträge gefunden.
|
|
</p>
|
|
<a href="{{ url_for('guest.guest_request_form') }}"
|
|
class="btn-primary">
|
|
Ersten Antrag stellen
|
|
</a>
|
|
</div>
|
|
{% else %}
|
|
<div class="space-y-4">
|
|
{% for req_data in requests %}
|
|
{% set request = req_data.request %}
|
|
{% set job = req_data.job %}
|
|
<div class="dashboard-card p-6 border-l-4 {% if request.status == 'pending' %}border-yellow-400{% elif request.status == 'approved' %}border-green-400{% elif request.status == 'denied' %}border-red-400{% endif %}">
|
|
<div class="flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4">
|
|
|
|
<!-- Left Section: Request Info -->
|
|
<div class="flex-1">
|
|
<div class="flex items-center gap-4 mb-4">
|
|
<span class="text-lg font-bold text-slate-900 dark:text-white">
|
|
#{{ request.id }}
|
|
</span>
|
|
<span class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium {% if request.status == 'pending' %}bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400{% elif request.status == 'approved' %}bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400{% elif request.status == 'denied' %}bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400{% endif %}">
|
|
{% if request.status == 'pending' %}
|
|
Wird geprüft
|
|
{% elif request.status == 'approved' %}
|
|
Genehmigt
|
|
{% elif request.status == 'denied' %}
|
|
Abgelehnt
|
|
{% endif %}
|
|
</span>
|
|
{% if job %}
|
|
<span class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-400">
|
|
Job: {{ job.status|title }}
|
|
</span>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 text-sm">
|
|
<div class="bg-gray-50 dark:bg-slate-700/30 p-3 rounded-lg">
|
|
<div class="text-slate-500 dark:text-slate-400 font-medium mb-1">Antragsteller</div>
|
|
<div class="text-slate-600 dark:text-slate-300">{{ request.name }}</div>
|
|
</div>
|
|
<div class="bg-gray-50 dark:bg-slate-700/30 p-3 rounded-lg">
|
|
<div class="text-slate-500 dark:text-slate-400 font-medium mb-1">E-Mail</div>
|
|
<div class="text-slate-600 dark:text-slate-300">{{ request.email }}</div>
|
|
</div>
|
|
<div class="bg-gray-50 dark:bg-slate-700/30 p-3 rounded-lg">
|
|
<div class="text-slate-500 dark:text-slate-400 font-medium mb-1">Drucker</div>
|
|
<div class="text-slate-600 dark:text-slate-300">
|
|
{% if request.printer %}
|
|
{{ request.printer.name }}
|
|
{% else %}
|
|
Automatisch zuweisen
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
<div class="bg-gray-50 dark:bg-slate-700/30 p-3 rounded-lg">
|
|
<div class="text-slate-500 dark:text-slate-400 font-medium mb-1">Dauer</div>
|
|
<div class="text-slate-600 dark:text-slate-300">{{ request.duration_min }} Min</div>
|
|
</div>
|
|
</div>
|
|
|
|
{% if request.reason %}
|
|
<div class="mt-4 bg-gray-50 dark:bg-slate-700/30 p-3 rounded-lg">
|
|
<div class="text-slate-500 dark:text-slate-400 font-medium mb-2">Projektbeschreibung</div>
|
|
<div class="text-sm text-slate-600 dark:text-slate-300">{{ request.reason }}</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if job %}
|
|
<div class="mt-4 bg-blue-50 dark:bg-blue-900/30 p-3 rounded-lg">
|
|
<div class="text-blue-700 dark:text-blue-400 font-medium mb-2">Zugewiesener Job</div>
|
|
<div class="grid grid-cols-1 md:grid-cols-3 gap-2 text-sm">
|
|
<div>
|
|
<span class="text-slate-500 dark:text-slate-400">Job-Name:</span>
|
|
<span class="text-slate-600 dark:text-slate-300 ml-1">{{ job.name }}</span>
|
|
</div>
|
|
<div>
|
|
<span class="text-slate-500 dark:text-slate-400">Drucker:</span>
|
|
<span class="text-slate-600 dark:text-slate-300 ml-1">{{ job.printer.name if job.printer else 'N/A' }}</span>
|
|
</div>
|
|
<div>
|
|
<span class="text-slate-500 dark:text-slate-400">Status:</span>
|
|
<span class="text-slate-600 dark:text-slate-300 ml-1">{{ job.status|title }}</span>
|
|
</div>
|
|
</div>
|
|
{% if job.status == 'running' %}
|
|
<div class="mt-2">
|
|
<a href="{{ url_for('guest.guest_job_status', job_id=job.id) }}"
|
|
class="btn-sm btn-primary">
|
|
Job-Status anzeigen
|
|
</a>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<!-- Right Section: Timestamp and Actions -->
|
|
<div class="lg:text-right">
|
|
<div class="bg-gray-50 dark:bg-slate-700/30 p-4 rounded-lg text-center lg:text-right">
|
|
<div class="text-sm font-medium text-slate-900 dark:text-white mb-1">
|
|
{{ request.created_at.strftime('%d.%m.%Y') }}
|
|
</div>
|
|
<div class="text-xs text-slate-500 dark:text-slate-400">
|
|
{{ request.created_at.strftime('%H:%M') }} Uhr
|
|
</div>
|
|
|
|
{% if request.status == 'approved' %}
|
|
<div class="mt-3">
|
|
<a href="{{ url_for('guest.guest_request_status', request_id=request.id) }}"
|
|
class="btn-sm btn-success">
|
|
Details anzeigen
|
|
</a>
|
|
</div>
|
|
{% elif request.status == 'pending' %}
|
|
<div class="mt-3">
|
|
<span class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400">
|
|
In Bearbeitung
|
|
</span>
|
|
</div>
|
|
{% elif request.status == 'denied' %}
|
|
<div class="mt-3">
|
|
<span class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400">
|
|
Abgelehnt
|
|
</span>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Live-Zeitanzeige im Browser-Tab
|
|
function updateTabTitle() {
|
|
const now = new Date();
|
|
const timeString = now.toLocaleTimeString('de-DE');
|
|
document.title = `Meine Anträge (${timeString}) - Mercedes-Benz MYP Platform`;
|
|
}
|
|
|
|
updateTabTitle();
|
|
setInterval(updateTabTitle, 1000);
|
|
|
|
// Auto-Refresh alle 30 Sekunden
|
|
setInterval(function() {
|
|
if (!document.hidden) {
|
|
window.location.reload();
|
|
}
|
|
}, 30000);
|
|
});
|
|
</script>
|
|
{% endblock %} |