{% macro printer_status_badge(status, size='sm') %} {% set status_config = { 'online': { 'color': 'green', 'icon': 'fa-check-circle', 'text': 'Online', 'description': 'Drucker ist einsatzbereit' }, 'offline': { 'color': 'red', 'icon': 'fa-times-circle', 'text': 'Offline', 'description': 'Drucker ist nicht erreichbar' }, 'busy': { 'color': 'blue', 'icon': 'fa-spinner', 'text': 'Beschäftigt', 'description': 'Drucker druckt gerade' }, 'idle': { 'color': 'yellow', 'icon': 'fa-pause-circle', 'text': 'Bereit', 'description': 'Drucker ist online aber inaktiv' }, 'available': { 'color': 'green', 'icon': 'fa-check-circle', 'text': 'Verfügbar', 'description': 'Drucker ist verfügbar' }, 'error': { 'color': 'red', 'icon': 'fa-exclamation-triangle', 'text': 'Fehler', 'description': 'Drucker hat einen Fehler' } } %} {% set config = status_config.get(status, status_config['offline']) %} {% set size_classes = { 'xs': 'px-2 py-1 text-xs', 'sm': 'px-3 py-1 text-sm', 'md': 'px-4 py-2 text-base', 'lg': 'px-6 py-3 text-lg' } %} {{ config.text }} {% endmacro %} {% macro printer_status_indicator(status, show_text=true) %} {% set status_config = { 'online': { 'color': 'green', 'icon': 'fa-circle', 'text': 'Online' }, 'offline': { 'color': 'red', 'icon': 'fa-circle', 'text': 'Offline' }, 'busy': { 'color': 'blue', 'icon': 'fa-circle', 'text': 'Beschäftigt' }, 'idle': { 'color': 'yellow', 'icon': 'fa-circle', 'text': 'Bereit' }, 'available': { 'color': 'green', 'icon': 'fa-circle', 'text': 'Verfügbar' } } %} {% set config = status_config.get(status, status_config['offline']) %}
{% if show_text %} {{ config.text }} {% endif %}
{% endmacro %} {% macro printer_power_status(is_powered, plug_available=false) %} {% if plug_available %}
{% if is_powered %} An {% else %} Aus {% endif %}
{% else %}
N/A
{% endif %} {% endmacro %} {% macro printer_status_card(printer, show_jobs=true) %}

{{ printer.name }}

{{ printer.location or 'Kein Standort' }}

{{ printer_status_badge(printer.status) }}
Verbindung: {{ printer_status_indicator(printer.status, false) }}
Strom: {{ printer_power_status(printer.plug_ip and printer.status != 'offline', printer.plug_ip != null) }}
{% if printer.ip_address %}
{{ printer.ip_address }}
{% endif %} {% if show_jobs and printer.jobs %}
Aktive Jobs: {{ printer.jobs|length }} Details →
{% endif %} {% if printer.last_checked %}
Zuletzt geprüft: {{ printer.last_checked.strftime('%H:%M') }}
{% endif %}
{% endmacro %}