{# An editable pivot (components/pivot.py). One form; every box posts what it holds, so the form is the state of the grid. Each input is named by its row and column key and labelled by both headings (aria-labelledby). #} {# A total: a PivotCell whose value is a slot. Its own tone wins over the column's, as for an input cell. #} {% macro total_cell(t, column=none, extra_class="") -%} {%- set tone = t.tone or (column.tone if column else none) -%} {{ slot(t.value) }} {%- endmacro %}
{{ csrf_field() }} {% for key, value in hidden %}{% endfor %} {% for row in c.rows %}{% endfor %} {% for column in c.columns %}{% endfor %}
{% if c.caption %}{% endif %} {% for column in c.columns %} {% endfor %} {% if show_totals %} {% endif %} {% for row in c.rows %} {% set i = loop.index0 %} {% for column in c.columns %} {% set j = loop.index0 %} {% set cell = grid[i][j] %} {% set tone = cell.tone or column.tone %} {% endfor %} {% if show_totals %}{{ total_cell(row_totals[i]) }}{% endif %} {% else %} {% if c.empty %} {% endif %} {% endfor %} {% if show_totals %} {% for column in c.columns %}{{ total_cell(column_totals[loop.index0], column) }}{% endfor %} {{ total_cell(grand, none, "fcu-pivot-grand") }} {% endif %}
{{ c.caption }}
{{ c.corner or "" }} {%- if column.href %}{{ column.label }}{% else %}{{ column.label }}{% endif -%} {% if column.sublabel %}{{ column.sublabel }}{% endif %} {% if column.extra is not none %}
{{ slot(column.extra) }}
{% endif %}
{{ labels.total }} {% if c.total_extra is not none %}
{{ slot(c.total_extra) }}
{% endif %}
{%- if row.href %}{{ row.label }}{% else %}{{ row.label }}{% endif -%} {% if row.extra is not none %}{{ slot(row.extra) }}{% endif %} {% if row.sublabel %}{{ row.sublabel }}{% endif %} {% if cell.editable %} {% else %} {{ cell.value if cell.value is not none else '' }} {% endif %} {% if cell.extra is not none %}{{ slot(cell.extra) }}{% endif %}
{{ c.empty }}
{{ labels.footer }}
{% if c.save or c.controls %}
{% if c.save %}{% endif %} {% for control in c.controls %}{{ slot(control) }}{% endfor %}
{% endif %}