{{ inspection.title }}

Prüfungsbericht

Anlage: {{ container.name }}
Prüfungsdatum: {{ inspection.nextInspection|date('d.m.Y') }}
{% if inspection.inspectorEmail %}
Prüfer: {{ inspection.inspectorEmail }}
{% endif %} {% if inspection.description %}
Beschreibung: {{ inspection.description }}
{% endif %}
{% if formData and inspection.template %}

Prüfungsergebnisse

{% set templateFields = inspection.template.formFields %} {% set signatureCounter = 0 %} {% set fieldCounter = 0 %} {% for field in templateFields %}
{% if field.type == 'heading' %}
{{ field.label|default('Überschrift') }}
{# Skip field counter for headings #} {% elseif field.type == 'signature' %}
{{ field.label }}{{ field.required ? ' *' : '' }}
{# Use signatureCounter only - no loop.index0 #} {% set sigKey = 'signature_' ~ signatureCounter %} {% if formData[sigKey] is defined and formData[sigKey] %}
Unterschrift
{% else %}
Keine Unterschrift vorhanden
{% endif %} {% set confirmKey = 'confirmCheck' ~ signatureCounter %} {% if formData[confirmKey] is defined and formData[confirmKey] %}
✓ Bestätigung erteilt
{% endif %} {% set signatureCounter = signatureCounter + 1 %} {% elseif field.type == 'checkbox' %} {% set fieldKey = 'field_' ~ fieldCounter %}
{{ field.label }}
{{ (formData[fieldKey] is defined and formData[fieldKey]) ? '✓ Ja' : '✗ Nein' }}
{% set fieldCounter = fieldCounter + 1 %} {% elseif field.type == 'switch' %} {% set fieldKey = 'field_' ~ fieldCounter %}
{{ field.label }}
{{ (formData[fieldKey] is defined and formData[fieldKey]) ? '✓ OK' : '✗ Nicht OK' }}
{% set fieldCounter = fieldCounter + 1 %} {% elseif field.type == 'file' %} {% set fieldKey = 'field_' ~ fieldCounter %} {% set fieldFilesKey = fieldKey ~ '_files' %} {% set attachments = fileFieldAttachments[fieldFilesKey]|default([]) %}
{{ field.label }}{{ field.required ? ' *' : '' }}
{% if attachments is not empty %} {% for attachment in attachments %}
{{ attachment.name }}
{% endfor %} {% else %} Keine Dateien hochgeladen {% endif %}
{% if attachments is not empty %} {% set imageAttachments = attachments|filter(a => a.isImage and a.dataUri) %} {% if imageAttachments is not empty %}
{% for photo in imageAttachments %}
Foto {{ loop.index }}
{{ photo.name }}
{% endfor %}
{% endif %} {% endif %} {% set fieldCounter = fieldCounter + 1 %} {% else %} {# text, textarea, number, date, select #} {% set fieldKey = 'field_' ~ fieldCounter %}
{{ field.label }}{{ field.required ? ' *' : '' }}
{{ formData[fieldKey] is defined ? formData[fieldKey] : '-' }}
{% set fieldCounter = fieldCounter + 1 %} {% endif %}
{% endfor %}
{% endif %}