{# Detail view component - displays entity fields as a definition list #} {% if detail %}
{# Header with actions #} {% block detail_header %}
← Back

{{ detail.title }}

{% if detail.edit_url %} Edit {% endif %} {% if detail.delete_url %} {% endif %}
{% endblock detail_header %} {# Transition buttons (state machine) #} {% block detail_transitions %} {% if detail.transitions %}
{% for transition in detail.transitions %} {% endfor %}
{% endif %} {% endblock detail_transitions %} {# External link actions #} {% block detail_external_links %} {% if detail.external_link_actions %}
{% for link in detail.external_link_actions %} {{ link.label }} {% endfor %}
{% endif %} {% endblock detail_external_links %} {# Integration action buttons (manual triggers) #} {% block detail_integration_actions %} {% if detail.integration_actions %}
{% for action in detail.integration_actions %} {% endfor %}
{% endif %} {% endblock detail_integration_actions %} {# Detail card #} {% block detail_fields %}
{% for field in detail.fields %} {% if field.visible | default(true) %} {% set value = detail.item.get(field.name, "") %}
{{ field.label }}
{% if field.type == "badge" %} {% include 'fragments/status_badge.html' %} {% elif field.type == "bool" or field.type == "checkbox" %} {{ value | bool_icon }} {% elif field.type == "date" %} {{ value | dateformat }} {% elif field.type == "currency" or field.type == "money" %} {{ value | currency(field.extra.get('currency_code', 'GBP') if field.extra else 'GBP') }} {% elif field.type == "file" %} {% if value %} {{ value | basename_or_url }} {% else %}—{% endif %} {% elif field.type == "ref" %} {# Try _display keys: relation_name_display (from _inject_display_names) or fk_field_display #} {% set rel_name = field.name.removesuffix("_id") if field.name.endswith("_id") else field.name %} {% set display_val = detail.item.get(rel_name ~ "_display", "") or detail.item.get(field.name ~ "_display", "") %} {% if display_val %}{{ display_val }}{% elif value is mapping %}{{ value.get("name") or value.get("title") or value.get("label") or value.get("email") or value.get("id", "—") }}{% elif value %}{{ value }}{% else %}—{% endif %} {% else %} {% if field.type == "enum" %}{{ value | default("—") | humanize }}{% else %}{{ value | default("—") }}{% endif %} {% endif %}
{% endif %} {% endfor %}
{% endblock detail_fields %} {# Related entity groups (#related-display-intent) #} {% if detail.related_groups %} {% block detail_related_groups %} {% for group in detail.related_groups %}
{% if detail.related_groups | length > 1 or not group.is_auto %}

{{ group.label }}

{% endif %} {% if group.display == "status_cards" %} {% include "fragments/related_status_cards.html" %} {% elif group.display == "file_list" %} {% include "fragments/related_file_list.html" %} {% else %} {% include "fragments/related_table_group.html" %} {% endif %}
{% endfor %} {% endblock detail_related_groups %} {% endif %}
{% endif %}