{# Jinja-Makros für UI-Komponenten zur JavaScript-Ersetzung #} {# Status-Indikator mit CSS-Animation #} {% macro status_indicator(status, text="") %} {% set status_classes = { 'online': 'mb-status-online', 'offline': 'mb-status-offline', 'busy': 'mb-status-busy', 'idle': 'mb-status-idle', 'running': 'mb-status-busy', 'completed': 'mb-status-online', 'failed': 'mb-status-offline', 'paused': 'mb-status-idle', 'queued': 'mb-status-idle' } %}
{% if text %} {{ text }} {% endif %}
{% endmacro %} {# Fortschrittsbalken mit CSS-Animation #} {% macro progress_bar(progress, show_text=True) %}
{% if show_text %}
{{ progress }}%
{% endif %} {% endmacro %} {# Klickbare Karte #} {% macro clickable_card(url, class="dashboard-card p-6") %} {{ caller() }} {% endmacro %} {# Tab-Navigation mit serverseitiger Logik #} {% macro tab_navigation(tabs, active_tab) %}
{% endmacro %} {# Drucker-Status-Karte ohne JavaScript #} {% macro printer_card(printer, show_link=True) %} {% if show_link %} {% endif %} {% if show_link %} {% endif %} {% endmacro %} {# Job-Zeile in Tabelle ohne JavaScript #} {% macro job_row(job, show_link=True) %} {% if show_link %} {{ job_row_content(job) }} {% else %} {{ job_row_content(job) }} {% endif %} {% endmacro %} {# Job-Zeilen-Inhalt (für Wiederverwendung) #} {% macro job_row_content(job) %} {{ status_indicator(job.status, job.status_text) }}
{{ job.name }}
{{ job.file_name }}
{{ job.printer }}
{{ job.start_time }}
{{ progress_bar(job.progress) }} Details {% endmacro %} {# Benachrichtigungs-Toast mit Auto-Close via CSS #} {% macro notification_toast(message, type="info", auto_close=True) %} {% set type_classes = { 'success': 'border-green-200 bg-green-50 text-green-800 dark:border-green-800 dark:bg-green-900/20 dark:text-green-300', 'error': 'border-red-200 bg-red-50 text-red-800 dark:border-red-800 dark:bg-red-900/20 dark:text-red-300', 'warning': 'border-yellow-200 bg-yellow-50 text-yellow-800 dark:border-yellow-800 dark:bg-yellow-900/20 dark:text-yellow-300', 'info': 'border-blue-200 bg-blue-50 text-blue-800 dark:border-blue-800 dark:bg-blue-900/20 dark:text-blue-300' } %}

{{ message }}

{{ csrf_token() }}
{% endmacro %} {# Formular-Submit-Button mit CSS-basiertem Loading-State #} {% macro submit_button(text, loading_text="Wird verarbeitet...", class="btn-primary") %} {% endmacro %} {# Auto-Refresh Meta-Tag für periodische Seitenaktualisierung #} {% macro auto_refresh(seconds) %} {% endmacro %} {# CSS-only Dropdown-Menu #} {% macro css_dropdown(button_text, items, button_class="btn-secondary") %}
{% endmacro %} {# Dashboard-Statistik-Karte ohne JavaScript #} {% macro dashboard_stat_card(title, value, icon, color="slate", trend=None) %}

{{ title }}

{{ value }}
{% if trend %}
{% if trend.direction == 'up' %} +{{ trend.value }}% {% elif trend.direction == 'down' %} -{{ trend.value }}% {% else %} {{ trend.value }}% {% endif %} {{ trend.period }}
{% endif %}
{% endmacro %} {# Drucker-Übersicht-Tabelle ohne JavaScript #} {% macro printer_overview_table(printers) %}
{% for printer in printers %} {% endfor %}
Status Name Modell Standort Aktueller Job Letzte Aktivität
{{ status_indicator(printer.status, printer.status_text) }}
{{ printer.model }}
{{ printer.location }}
{% if printer.current_job %}
{{ printer.current_job.name }}
{{ progress_bar(printer.current_job.progress, show_text=False) }} {% else %} Kein aktiver Job {% endif %}
{{ printer.last_activity }}
{% endmacro %} {# Formular mit CSRF und serverseitiger Validierung #} {% macro form_field(field, label=None, help_text=None) %}
{% if label %} {% endif %} {{ field(class="form-input" + (" border-red-500 dark:border-red-400" if field.errors else "")) }} {% if field.errors %}
{% for error in field.errors %}

{{ error }}

{% endfor %}
{% endif %} {% if help_text %}

{{ help_text }}

{% endif %}
{% endmacro %} {# Modal-Dialog ohne JavaScript #} {% macro modal_dialog(id, title, form_action=None) %} {% endmacro %} {# URL-basierte Tab-Navigation für Filter #} {% macro filter_tabs(filters, current_filter, base_url) %}
{% for filter in filters %} {% if filter.icon %} {% endif %} {{ filter.name }} {% if filter.count is defined %} {{ filter.count }} {% endif %} {% endfor %}
{% endmacro %}