{# table_rows.html — inline-editable row cells, row states, Tab navigation Requires: dzTable Alpine controller (editing, selected, isEditing, startEdit, toggleRow) Row height: h-9 (36px dense). No DaisyUI classes. #} {% from 'macros/status_badge.html' import render_status_badge %} {% if table and table.rows %} {% set _row_label_col = namespace(key="id") %} {% for col in table.columns %}{% if col.type not in ["ref", "badge", "bool", "currency"] and _row_label_col.key == "id" %}{% set _row_label_col.key = col.key %}{% endif %}{% endfor %} {% for item in table.rows %} {% set _row_label = item[_row_label_col.key] | default(item.id) %} {% set _row_label = _row_label | ref_display if _row_label is mapping else _row_label %} {# ── Checkbox cell ─────────────────────────────────────────────────────── #} {% if table.bulk_actions %} {% endif %} {# ── Data cells ────────────────────────────────────────────────────────── #} {% for col in table.columns %} {% if not col.hidden %} {# ── Inline editable cell ──────────────────────────────────────────── #} {% if table.inline_editable and col.key in table.inline_editable %} {# Edit mode: input rendered via inline_edit.html #} {# Display mode: double-click to enter edit #} {# ── Non-editable cell — type-specific rendering ───────────────────── #} {% else %} {% if col.type == "badge" %} {{ render_status_badge(value=item[col.key]) }} {% elif col.type == "bool" %} {{ item[col.key] | bool_icon }} {% elif col.type == "date" %} {{ item[col.key] | dateformat }} {% elif col.type == "currency" %} {{ item[col.key] | currency(col.currency_code or "GBP") }} {% elif col.type == "sensitive" %} {% set raw = item[col.key] | default("") | string %} {% if raw | length > 4 %}{{ "****" ~ raw[-4:] }}{% elif raw %}****{% else %}{% endif %} {% elif col.type == "ref" %} {{ item.get(col.key ~ "_display", "") or (item[col.key] | ref_display) }} {% elif col.type == "percentage" %} {{ item[col.key] | default("") }}% {% else %} {{ item[col.key] | default("") | truncate_text }} {% endif %} {% endif %} {% endif %} {% endfor %} {# ── Row actions — revealed on hover ──────────────────────────────────────── #}
{# View action #} {% if table.detail_url_template %} {# Edit action #} {% endif %} {# Delete action #}
{% endfor %} {% else %} {{ table.empty_message | default("No " + (table.entity_name|default("items"))|lower + " found.") if table else "No items found." }} {% endif %}