"feat: Refactor database files

This commit is contained in:
Till Tomczak 2025-05-29 15:29:45 +02:00
parent a7fd854b7b
commit 4f9b97c79f
4 changed files with 140 additions and 140 deletions

Binary file not shown.

Binary file not shown.

View File

@ -3,30 +3,15 @@
{% block title %}Druckaufträge - Mercedes-Benz MYP Platform{% endblock %}
{% block content %}
<div class="bg-professional">
<div class="min-h-screen bg-mercedes-black">
<!-- 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">Live</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-7xl mx-auto px-6 lg:px-8 py-16 z-10">
<!-- Mercedes Hero Section -->
<div class="mercedes-hero">
<div class="mercedes-container py-16 lg:py-24">
<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">
<div class="inline-flex items-center justify-center w-24 h-24 mercedes-card rounded-full mb-8">
<svg class="w-12 h-12 text-gray-900 dark:text-white" viewBox="0 0 80 80" fill="currentColor">
<path d="M58.6,4.5C53,1.6,46.7,0,40,0c-6.7,0-13,1.6-18.6,4.5v0C8.7,11.2,0,24.6,0,40c0,15.4,8.7,28.8,21.5,35.5
C27,78.3,33.3,80,40,80c6.7,0,12.9-1.7,18.5-4.6C71.3,68.8,80,55.4,80,40C80,24.6,71.3,11.2,58.6,4.5z M4,40
c0-13.1,7-24.5,17.5-30.9v0C26.6,6,32.5,4.2,39,4l-4.5,32.7L21.5,46.8v0L8.3,57.1C5.6,52,4,46.2,4,40z M58.6,70.8
@ -36,184 +21,199 @@
</svg>
</div>
<h1 class="title-professional text-5xl md:text-6xl font-bold mb-6 tracking-tight">
<h1 class="text-5xl md:text-6xl font-bold mb-6 tracking-tight text-gray-900 dark:text-white">
Druckaufträge Management
</h1>
<p class="subtitle-professional text-xl md:text-2xl max-w-4xl mx-auto leading-relaxed mb-8">
<p class="text-xl md:text-2xl max-w-4xl mx-auto leading-relaxed mb-8 text-gray-600 dark:text-gray-300">
Verwalten Sie Ihre 3D-Druckjobs mit höchster Präzision und Mercedes-Benz Qualitätsstandard
</p>
<!-- Status Overview Dashboard Style -->
<div class="stats-grid mb-8">
<div class="dashboard-stat-card">
<div class="flex items-center space-x-3">
<div class="status-dot online"></div>
<span class="text-gray-900 dark:text-white font-semibold">Live System</span>
</div>
<div class="mt-2">
<span id="live-time" class="text-sm font-mono text-gray-600 dark:text-gray-400"></span>
</div>
</div>
</div>
<!-- Action Buttons -->
<div class="flex flex-wrap justify-center gap-4">
<button onclick="refreshJobs()" class="btn-professional group">
<button onclick="refreshJobs()" class="btn-mercedes-primary group">
<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"></path>
</svg>
<span>Aktualisieren</span>
</button>
</button>
</div>
</div>
</div>
</div>
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 -mt-8 relative z-10 space-y-8">
<div class="mercedes-container section-spacing">
<!-- Neue Reservierung anlegen -->
<div class="professional-container p-8 lg:p-12 animate-slide-up">
<!-- Neue Reservierung anlegen -->
<div class="mercedes-card animate-slide-up">
<div class="text-center mb-10">
<h2 class="title-professional text-3xl font-bold mb-4">
<h2 class="text-3xl font-bold mb-4 text-gray-900 dark:text-white">
Neue Reservierung anlegen
</h2>
<p class="subtitle-professional text-lg">
<p class="text-lg text-gray-600 dark:text-gray-300">
Erstellen Sie einen neuen Druckauftrag mit professionellen Einstellungen
</p>
</div>
<!-- Queue-Status-Anzeige -->
<!-- Queue-Status-Anzeige -->
<div id="queue-status-info" class="mb-8"></div>
<form id="newJobForm" class="space-y-8">
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
<!-- Drucker auswählen -->
<div class="cards-grid">
<!-- Drucker auswählen -->
<div class="group">
<label for="printer_id" class="block text-sm font-semibold text-professional-primary mb-3">
<label for="printer_id" class="block text-sm font-semibold text-gray-900 dark:text-white mb-3">
Drucker auswählen <span class="text-red-500">*</span>
</label>
<div class="relative">
<select id="printer_id" name="printer_id" required
class="input-professional appearance-none pr-12 cursor-pointer">
<option value="">Drucker auswählen...</option>
<!-- Wird durch JavaScript gefüllt -->
</select>
class="form-input-mercedes appearance-none pr-12 cursor-pointer">
<option value="">Drucker auswählen...</option>
<!-- Wird durch JavaScript gefüllt -->
</select>
<div class="absolute inset-y-0 right-0 flex items-center pr-4 pointer-events-none">
<svg class="h-5 w-5 text-professional-muted group-hover:text-professional-primary transition-colors duration-200" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<svg class="h-5 w-5 text-gray-400 group-hover:text-gray-600 dark:group-hover:text-gray-300 transition-colors duration-200" 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 id="printer-status-info" class="mt-3 text-center">
<!-- Status-Info wird dynamisch gefüllt -->
</div>
<!-- Status-Info wird dynamisch gefüllt -->
</div>
<div id="printer-status-warning" class="mt-4 hidden">
<div class="alert-professional alert-warning">
<div class="flex-shrink-0">
<div class="w-12 h-12 bg-gradient-to-br from-orange-500 to-red-600 rounded-2xl flex items-center justify-center">
<svg class="h-6 w-6 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<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-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path>
</svg>
</div>
</div>
<div class="flex-1">
<h3 class="text-lg font-semibold text-professional-primary mb-4">
🔄 WARTESCHLANGEN-MODUS: Offline-Drucker ausgewählt!
</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-red-500 rounded-full"></div>
<span class="text-sm text-professional-secondary">Drucker ist derzeit <strong>OFFLINE</strong></span>
</div>
<div class="flex items-center space-x-3">
<div class="w-2 h-2 bg-yellow-500 rounded-full"></div>
<span class="text-sm text-professional-secondary">Job wird in <strong>WARTESCHLANGE</strong> eingereiht</span>
</div>
<div class="flex items-center space-x-3">
<div class="w-2 h-2 bg-blue-500 rounded-full"></div>
<span class="text-sm text-professional-secondary">System überwacht alle <strong>2 Minuten</strong></span>
<div class="mercedes-card bg-yellow-50 dark:bg-yellow-900/20 border-yellow-200 dark:border-yellow-700/50">
<div class="flex">
<div class="flex-shrink-0">
<div class="w-12 h-12 bg-gradient-to-br from-orange-500 to-red-600 rounded-2xl flex items-center justify-center">
<svg class="h-6 w-6 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<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-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path>
</svg>
</div>
<div class="flex items-center space-x-3">
<div class="w-2 h-2 bg-green-500 rounded-full"></div>
<span class="text-sm text-professional-secondary">Start <strong>AUTOMATISCH</strong> bei Verfügbarkeit</span>
</div>
<div class="flex-1 ml-4">
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4">
🔄 WARTESCHLANGEN-MODUS: Offline-Drucker ausgewählt!
</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-red-500 rounded-full"></div>
<span class="text-sm text-gray-700 dark:text-gray-300">Drucker ist derzeit <strong>OFFLINE</strong></span>
</div>
<div class="flex items-center space-x-3">
<div class="w-2 h-2 bg-yellow-500 rounded-full"></div>
<span class="text-sm text-gray-700 dark:text-gray-300">Job wird in <strong>WARTESCHLANGE</strong> eingereiht</span>
</div>
<div class="flex items-center space-x-3">
<div class="w-2 h-2 bg-blue-500 rounded-full"></div>
<span class="text-sm text-gray-700 dark:text-gray-300">System überwacht alle <strong>2 Minuten</strong></span>
</div>
<div class="flex items-center space-x-3">
<div class="w-2 h-2 bg-green-500 rounded-full"></div>
<span class="text-sm text-gray-700 dark:text-gray-300">Start <strong>AUTOMATISCH</strong> bei Verfügbarkeit</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Gewünschte Startzeit -->
<!-- Gewünschte Startzeit -->
<div class="group">
<label for="start_time" class="block text-sm font-semibold text-professional-primary mb-3">
<label for="start_time" class="block text-sm font-semibold text-gray-900 dark:text-white mb-3">
Gewünschte Startzeit <span class="text-red-500">*</span>
</label>
<input type="datetime-local" id="start_time" name="start_time" required
class="input-professional">
</div>
<!-- Geschätzte Druckdauer -->
<input type="datetime-local" id="start_time" name="start_time" required
class="form-input-mercedes">
</div>
<!-- Geschätzte Druckdauer -->
<div class="group">
<label for="duration" class="block text-sm font-semibold text-professional-primary mb-3">
<label for="duration" class="block text-sm font-semibold text-gray-900 dark:text-white mb-3">
Geschätzte Druckdauer (Minuten) <span class="text-red-500">*</span>
</label>
<input type="number" id="duration" name="duration" required min="1" max="7200"
class="input-professional" placeholder="60">
<input type="number" id="duration" name="duration" required min="1" max="7200"
class="form-input-mercedes" placeholder="60">
</div>
</div>
</div>
<div class="grid grid-cols-1 gap-8">
<div class="space-y-8">
<!-- Job-Titel -->
<div class="group">
<label for="job_title" class="block text-sm font-semibold text-professional-primary mb-3">
<label for="job_title" class="block text-sm font-semibold text-gray-900 dark:text-white mb-3">
Job-Titel <span class="text-red-500">*</span>
</label>
<input type="text" id="job_title" name="job_title" required
class="input-professional"
class="form-input-mercedes"
placeholder="Geben Sie einen beschreibenden Titel ein">
</div>
</div>
<!-- STL-Datei hochladen -->
<div class="group">
<label for="stl_file" class="block text-sm font-semibold text-professional-primary mb-3">
<label for="stl_file" class="block text-sm font-semibold text-gray-900 dark:text-white mb-3">
STL-Datei hochladen (optional)
</label>
<div class="flex items-center justify-center w-full">
<label for="stl_file" class="flex flex-col items-center justify-center w-full h-32 border-2 border-slate-300 dark:border-slate-600 border-dashed rounded-2xl cursor-pointer bg-slate-50/50 dark:bg-slate-700/30 hover:bg-slate-100/70 dark:hover:bg-slate-700/50 transition-all duration-300 backdrop-blur-sm">
<div class="flex flex-col items-center justify-center pt-5 pb-6">
<svg class="w-10 h-10 mb-3 text-professional-muted" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<div class="flex items-center justify-center w-full">
<label for="stl_file" class="flex flex-col items-center justify-center w-full h-32 border-2 border-dashed border-gray-300 dark:border-gray-600 rounded-card cursor-pointer bg-gray-50/50 dark:bg-gray-700/30 hover:bg-gray-100/70 dark:hover:bg-gray-700/50 transition-all duration-300 backdrop-blur-sm">
<div class="flex flex-col items-center justify-center pt-5 pb-6">
<svg class="w-10 h-10 mb-3 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"></path>
</svg>
<p class="mb-2 text-sm text-professional-primary"><span class="font-semibold">Klicken Sie zum Hochladen</span> oder ziehen Sie die Datei hierher</p>
<p class="text-xs text-professional-muted">STL bis zu 50MB</p>
</svg>
<p class="mb-2 text-sm text-gray-700 dark:text-gray-300"><span class="font-semibold">Klicken Sie zum Hochladen</span> oder ziehen Sie die Datei hierher</p>
<p class="text-xs text-gray-500 dark:text-gray-400">STL bis zu 50MB</p>
</div>
<input id="stl_file" name="stl_file" type="file" accept=".stl" class="hidden" />
</label>
</div>
<input id="stl_file" name="stl_file" type="file" accept=".stl" class="hidden" />
</label>
</div>
<div id="file-name" class="mt-3 text-sm text-professional-muted hidden"></div>
<div id="file-name" class="mt-3 text-sm text-gray-500 dark:text-gray-400 hidden"></div>
</div>
</div>
</div>
<!-- Submit Button -->
<div class="flex items-center justify-end pt-8 border-t border-slate-200 dark:border-slate-600">
<button type="submit" class="btn-professional group">
<div class="flex items-center justify-end pt-8 border-t border-gray-200 dark:border-gray-600">
<button type="submit" class="btn-mercedes-primary group">
<svg class="w-5 h-5 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"></path>
</svg>
<span>Reservierung erstellen</span>
</button>
</div>
</form>
</div>
<!-- Aktive und geplante Jobs -->
<div class="professional-container p-8 lg:p-12 animate-slide-up">
</button>
</div>
</form>
</div>
<!-- Aktive und geplante Jobs -->
<div class="mercedes-card animate-slide-up">
<div class="text-center mb-10">
<h2 class="title-professional text-3xl font-bold mb-4">
<h2 class="text-3xl font-bold mb-4 text-gray-900 dark:text-white">
Aktive und geplante Jobs
</h2>
<p class="subtitle-professional text-lg">
<p class="text-lg text-gray-600 dark:text-gray-300">
Übersicht Ihrer laufenden und geplanten Druckaufträge
</p>
</div>
<div id="active-jobs-container" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<!-- Jobs werden dynamisch mit JavaScript geladen -->
<div id="active-jobs-container" class="cards-grid">
<!-- Jobs werden dynamisch mit JavaScript geladen -->
<div class="col-span-full py-12 text-center" id="no-jobs-message">
<div class="text-professional-muted mb-4">
<div class="text-gray-400 mb-4">
<svg class="w-16 h-16 mx-auto" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1" d="M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path>
</svg>
</svg>
</div>
<h3 class="text-lg font-semibold text-professional-primary mb-2">Keine aktiven Jobs</h3>
<p class="text-professional-muted">Sie haben derzeit keine aktiven oder geplanten Druckjobs.</p>
<h3 class="text-lg font-semibold text-gray-700 dark:text-gray-300 mb-2">Keine aktiven Jobs</h3>
<p class="text-gray-500 dark:text-gray-400">Sie haben derzeit keine aktiven oder geplanten Druckjobs.</p>
</div>
</div>
</div>
@ -223,21 +223,21 @@
<!-- Job Details Modal -->
<div id="jobDetailsModal" 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-2xl w-full p-8 transform transition-all duration-500 scale-95 opacity-0" id="jobModalContent">
<div class="mercedes-card max-w-2xl w-full transform transition-all duration-500 scale-95 opacity-0" id="jobModalContent">
<div class="flex justify-between items-center mb-8">
<div>
<h3 class="text-2xl font-bold text-professional-primary mb-2">Job Details</h3>
<p class="text-professional-muted">Detaillierte Informationen zu Ihrem Druckauftrag</p>
<h3 class="text-2xl font-bold text-gray-900 dark:text-white mb-2">Job Details</h3>
<p class="text-gray-600 dark:text-gray-300">Detaillierte Informationen zu Ihrem Druckauftrag</p>
</div>
<button onclick="closeJobModal()" class="p-2 hover:bg-slate-100 dark:hover:bg-slate-700 rounded-xl transition-colors duration-200">
<svg class="w-6 h-6 text-professional-muted hover:text-professional-primary" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<button onclick="closeJobModal()" class="p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-xl transition-colors duration-200">
<svg class="w-6 h-6 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300" 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>
</button>
</svg>
</button>
</div>
<div id="jobDetailsContent">
<!-- Inhalt wird dynamisch geladen -->
<!-- Inhalt wird dynamisch geladen -->
</div>
</div>
</div>
@ -246,36 +246,36 @@
<!-- Job verlängern Modal -->
<div id="extendJobModal" 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-md w-full p-8 transform transition-all duration-500 scale-95 opacity-0" id="extendModalContent">
<div class="mercedes-card max-w-md w-full transform transition-all duration-500 scale-95 opacity-0" id="extendModalContent">
<div class="flex justify-between items-center mb-8">
<div>
<h3 class="text-2xl font-bold text-professional-primary mb-2">Druckzeit verlängern</h3>
<p class="text-professional-muted">Geben Sie die zusätzlichen Minuten an</p>
<h3 class="text-2xl font-bold text-gray-900 dark:text-white mb-2">Druckzeit verlängern</h3>
<p class="text-gray-600 dark:text-gray-300">Geben Sie die zusätzlichen Minuten an</p>
</div>
<button onclick="closeExtendModal()" class="p-2 hover:bg-slate-100 dark:hover:bg-slate-700 rounded-xl transition-colors duration-200">
<svg class="w-6 h-6 text-professional-muted hover:text-professional-primary" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<button onclick="closeExtendModal()" class="p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-xl transition-colors duration-200">
<svg class="w-6 h-6 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300" 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>
</button>
</svg>
</button>
</div>
<form id="extendJobForm" class="space-y-6">
<input type="hidden" id="extend_job_id" name="job_id">
<div>
<label for="extra_minutes" class="block text-sm font-semibold text-professional-primary mb-3">
<label for="extra_minutes" class="block text-sm font-semibold text-gray-900 dark:text-white mb-3">
Zusätzliche Minuten
</label>
<input type="number" id="extra_minutes" name="extra_minutes" required min="1" max="720" value="30"
class="input-professional" placeholder="30">
class="form-input-mercedes" placeholder="30">
</div>
<div class="flex items-center justify-end space-x-4 pt-6 border-t border-slate-200 dark:border-slate-600">
<div class="flex items-center justify-end space-x-4 pt-6 border-t border-gray-200 dark:border-gray-600">
<button type="button" onclick="closeExtendModal()"
class="btn-secondary-professional">
class="btn-mercedes-secondary">
Abbrechen
</button>
<button type="submit"
class="btn-professional">
class="btn-mercedes-primary">
Verlängern
</button>
</div>
@ -304,7 +304,7 @@ setInterval(updateLiveTime, 1000);
// Modal Animations
function showModal(modalId) {
const modal = document.getElementById(modalId);
const content = modal.querySelector('.professional-container');
const content = modal.querySelector('.mercedes-card');
modal.classList.remove('hidden');
setTimeout(() => {
@ -315,7 +315,7 @@ function showModal(modalId) {
function hideModal(modalId) {
const modal = document.getElementById(modalId);
const content = modal.querySelector('.professional-container');
const content = modal.querySelector('.mercedes-card');
content.classList.remove('scale-100', 'opacity-100');
content.classList.add('scale-95', 'opacity-0');