{% extends "base.html" %} {% block title %}{{ inspection.template.name }} — Inspection{% endblock %} {% block extra_css %} {% endblock %} {% block content %}
{# ── Header ── #}

{{ inspection.template.name }}

{{ inspection.facility.name }} {% if inspection.area %} · {{ inspection.area.name }}{% endif %}  ·  Inspector: {{ inspection.inspector.username }}
{{ inspection.template.frequency|title }} Flag Issue
{# ── Form body ── #}
{% if form_fields %}
{% for field in form_fields %} {% set fid = field.id %} {% set saved = saved_responses.get(fid, '') %}
{# ── Section label (display only) ── #} {% if field.type == 'section' %}
{{ field.label }}
{# ── Static label ── #} {% elif field.type == 'label' %} {% set fs_map = {'small':'0.78rem','normal':'0.9rem','large':'1.05rem','x-large':'1.25rem'} %}
{{ field.text_content or '' }}
{# ── Submit / Print / Email buttons (display in preview; no action needed here) ── #} {% elif field.type in ('button_submit','button_print','button_email') %} {# rendered by the sticky footer instead #} {# ── Text ── #} {% elif field.type == 'text' %} {% if field.help_text %}
{{ field.help_text }}
{% endif %} {# ── Textarea ── #} {% elif field.type == 'textarea' %} {% if field.help_text %}
{{ field.help_text }}
{% endif %} {# ── Number ── #} {% elif field.type == 'number' %} {% if field.help_text %}
{{ field.help_text }}
{% endif %} {# ── Date ── #} {% elif field.type == 'date' %} {% if field.help_text %}
{{ field.help_text }}
{% endif %} {# ── Email ── #} {% elif field.type == 'email' %} {% if field.help_text %}
{{ field.help_text }}
{% endif %} {# ── Checkbox ── #} {% elif field.type == 'checkbox' %}
{% if field.help_text %}
{{ field.help_text }}
{% endif %} {# ── Checkbox group ── #} {% elif field.type == 'checkbox_group' %} {% for opt in field.options %}
{% endfor %} {% if field.help_text %}
{{ field.help_text }}
{% endif %} {# ── Radio ── #} {% elif field.type == 'radio' %} {% for opt in field.options %}
{% endfor %} {% if field.help_text %}
{{ field.help_text }}
{% endif %} {# ── Select / Dropdown ── #} {% elif field.type == 'select' %} {% if field.help_text %}
{{ field.help_text }}
{% endif %} {# ── Rating (stars) ── #} {% elif field.type == 'rating' %}
{% for i in range(1, 6) %} {% endfor %}
{% if field.help_text %}
{{ field.help_text }}
{% endif %} {# ── Image / Photo upload ── #} {% elif field.type == 'image' %} {% if saved %} Uploaded photo {% endif %}
Click or drag to upload {% if saved %}{{ saved.split('/')[-1] }}{% endif %}
{% if field.help_text %}
{{ field.help_text }}
{% endif %} {# ── Signature ── #} {% elif field.type == 'signature' %}
{% if field.help_text %}
{{ field.help_text }}
{% endif %} {# ── Table ── #} {% elif field.type == 'table' %}
{% for hdr in (field.col_headers or ['Column 1','Column 2','Column 3']) %} {% endfor %} {% set tbl_data = saved if saved is iterable and saved is not string else [] %} {% for r in range(field.table_rows or 3) %} {% set row_data = tbl_data[r] if r < tbl_data|length else {} %} {% for hdr in (field.col_headers or ['Column 1','Column 2','Column 3']) %}{% set c_idx = loop.index0 %} {% endfor %} {% endfor %}
{{ hdr }}
{% if field.help_text %}
{{ field.help_text }}
{% endif %} {% endif %}
{% endfor %}
{% else %}

This template has no form fields. Please add fields in the template editor.

{% endif %}
{# ── Sticky footer ── #}
{% endblock %} {% block extra_js %} {% endblock %}