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

187 lines
12 KiB
HTML

{% extends "base.html" %}
{% block title %}Jobs - MYP Platform{% endblock %}
{% block content %}
<div class="mercedes-page-container">
<div class="mercedes-content-container">
<!-- Premium Header mit Mercedes Design -->
<div class="mercedes-page-header mercedes-fade-in">
<div class="flex flex-col lg:flex-row lg:items-center lg:justify-between">
<div>
<h1 class="text-4xl font-bold mb-2">Job-Reservierungen</h1>
<p class="text-xl opacity-90">Verwalten Sie 3D-Druckjobs und Druckerreservierungen professionell</p>
</div>
<div class="flex mt-6 lg:mt-0">
<button onclick="refreshJobs()" class="mercedes-btn-secondary">
<svg class="h-5 w-5 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<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>
<div class="mercedes-grid mercedes-grid-1 mt-8">
<!-- Neue Reservierung anlegen -->
<div class="mercedes-premium-card mercedes-slide-up">
<h2 class="text-2xl font-semibold mb-8 text-slate-900 dark:text-white">Neue Reservierung anlegen</h2>
<form id="newJobForm" class="space-y-8">
<div class="mercedes-grid mercedes-grid-3">
<!-- Drucker auswählen -->
<div>
<label for="printer_id" class="block text-sm font-semibold text-slate-700 dark:text-slate-300 mb-3">Drucker auswählen*</label>
<select id="printer_id" name="printer_id" required class="mercedes-form-input">
<option value="">Drucker auswählen...</option>
<!-- Wird durch JavaScript gefüllt -->
</select>
<div id="printer-status-info" class="mt-3 text-center">
<!-- Status-Info wird dynamisch gefüllt -->
</div>
<div id="printer-status-warning" class="mt-3 hidden">
<div class="flex items-center p-4 bg-red-50 dark:bg-red-900/20 border-2 border-red-400 dark:border-red-700 rounded-2xl shadow-md">
<div class="flex-shrink-0 w-12 h-12 mr-4 flex items-center justify-center rounded-full bg-red-100 dark:bg-red-800">
<svg class="w-6 h-6 text-red-600 dark:text-red-300" 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" />
</svg>
</div>
<div>
<p class="text-lg font-bold text-red-800 dark:text-red-200">ACHTUNG: Offline-Drucker ausgewählt!</p>
<p class="text-sm text-red-700 dark:text-red-300 mt-1">
Dieser Drucker ist derzeit <span class="font-bold">NICHT VERFÜGBAR</span>.
Der Job wird in der Warteschlange gespeichert und erst gestartet,
wenn der Drucker wieder online ist.
</p>
</div>
</div>
</div>
</div>
<!-- Gewünschte Startzeit -->
<div>
<label for="start_time" class="block text-sm font-semibold text-slate-700 dark:text-slate-300 mb-3">Gewünschte Startzeit*</label>
<input type="datetime-local" id="start_time" name="start_time" required class="mercedes-form-input">
</div>
<!-- Geschätzte Druckdauer -->
<div>
<label for="duration" class="block text-sm font-semibold text-slate-700 dark:text-slate-300 mb-3">Geschätzte Druckdauer (Minuten)*</label>
<input type="number" id="duration" name="duration" required min="1" max="7200" class="mercedes-form-input">
</div>
</div>
<div>
<label for="job_title" class="block text-sm font-semibold text-slate-700 dark:text-slate-300 mb-3">Job-Titel*</label>
<input type="text" id="job_title" name="job_title" required placeholder="Geben Sie einen beschreibenden Titel ein" class="mercedes-form-input">
</div>
<div>
<label for="stl_file" class="block text-sm font-semibold text-slate-700 dark:text-slate-300 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-40 border-2 border-slate-300 dark:border-slate-600 border-dashed rounded-2xl cursor-pointer bg-slate-50 dark:bg-slate-700/30 hover:bg-slate-100 dark:hover:bg-slate-700/50 transition-all duration-300">
<div class="flex flex-col items-center justify-center pt-5 pb-6">
<svg class="w-12 h-12 mb-4 text-slate-500 dark:text-slate-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" />
</svg>
<p class="mb-2 text-sm text-slate-600 dark:text-slate-400"><span class="font-semibold">Klicken Sie zum Hochladen</span> oder ziehen Sie die Datei hierher</p>
<p class="text-xs text-slate-500 dark:text-slate-500">STL bis zu 50MB</p>
</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-slate-500 dark:text-slate-400 hidden"></div>
</div>
<div class="flex justify-end pt-6">
<button type="submit" class="mercedes-btn-primary">
Reservierung erstellen
</button>
</div>
</form>
</div>
<!-- Aktive und geplante Jobs -->
<div class="mercedes-premium-card mercedes-slide-up">
<h2 class="text-2xl font-semibold mb-8 text-slate-900 dark:text-white">Aktive und geplante Jobs</h2>
<div id="active-jobs-container" class="mercedes-grid mercedes-grid-3">
<!-- Jobs werden dynamisch mit JavaScript geladen -->
<div class="col-span-full py-16 text-center bg-slate-50/50 dark:bg-slate-700/20 rounded-2xl" id="no-jobs-message">
<svg class="w-20 h-20 mx-auto mb-6 text-slate-400 dark:text-slate-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1" d="M19 14l-7 7m0 0l-7-7m7 7V3"></path>
</svg>
<h3 class="text-xl font-semibold text-slate-900 dark:text-white mb-2">Keine aktiven Jobs</h3>
<p class="text-slate-500 dark:text-slate-400">Sie haben derzeit keine aktiven oder geplanten Druckjobs.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Job Details Modal -->
<div id="jobDetailsModal" class="mercedes-modal">
<div class="absolute inset-0 bg-black/60 backdrop-blur-sm" onclick="closeJobModal()"></div>
<div class="mercedes-modal-content">
<button class="absolute top-6 right-6 text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200" onclick="closeJobModal()">
<svg class="w-8 h-8" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
<div class="p-8" id="jobDetailsContent">
<!-- Inhalt wird dynamisch geladen -->
<div class="animate-pulse">
<div class="h-8 bg-slate-200 dark:bg-slate-700 rounded-xl w-3/4 mb-6"></div>
<div class="h-5 bg-slate-200 dark:bg-slate-700 rounded-lg w-1/2 mb-8"></div>
<div class="mercedes-grid mercedes-grid-2 mb-8">
<div class="h-10 bg-slate-200 dark:bg-slate-700 rounded-xl"></div>
<div class="h-10 bg-slate-200 dark:bg-slate-700 rounded-xl"></div>
<div class="h-10 bg-slate-200 dark:bg-slate-700 rounded-xl"></div>
<div class="h-10 bg-slate-200 dark:bg-slate-700 rounded-xl"></div>
</div>
<div class="h-40 bg-slate-200 dark:bg-slate-700 rounded-xl mb-8"></div>
<div class="h-12 bg-slate-200 dark:bg-slate-700 rounded-xl w-1/3"></div>
</div>
</div>
</div>
</div>
<!-- Job verlängern Modal -->
<div id="extendJobModal" class="mercedes-modal">
<div class="absolute inset-0 bg-black/60 backdrop-blur-sm" onclick="closeExtendModal()"></div>
<div class="mercedes-modal-content max-w-md">
<button class="absolute top-6 right-6 text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200" onclick="closeExtendModal()">
<svg class="w-8 h-8" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
<div class="p-8">
<h3 class="text-2xl font-bold mb-6 text-slate-900 dark:text-white">Druckzeit verlängern</h3>
<p class="mb-8 text-slate-600 dark:text-slate-400">Geben Sie an, um wie viele Minuten die Druckzeit verlängert werden soll.</p>
<form id="extendJobForm">
<input type="hidden" id="extend_job_id" name="job_id">
<div class="mb-8">
<label for="extra_minutes" class="block text-sm font-semibold text-slate-700 dark:text-slate-300 mb-3">Zusätzliche Minuten</label>
<input type="number" id="extra_minutes" name="extra_minutes" required min="1" max="720" value="30" class="mercedes-form-input">
</div>
<div class="flex justify-end space-x-4">
<button type="button" onclick="closeExtendModal()" class="mercedes-btn-secondary">
Abbrechen
</button>
<button type="submit" class="mercedes-btn-primary">
Verlängern
</button>
</div>
</form>
</div>
</div>
</div>
{% endblock %}