{# Report tables. Each block: title, icon, columns [(label, "start"|"end")], rows [[cell]], foot, note, empty. A cell is text, or a dict with text, url, bold, color ("danger"/"success"), indent. #} {% macro cell(value, align, foot=False) -%} {% set c = value if value is mapping else {'text': value} %} {%- if c.url %}{{ c.text }} {%- elif c.color == 'danger' %}{{ c.text }} {%- elif c.color == 'success' %}{{ c.text }} {%- else %}{{ c.text }}{% endif -%} {%- endmacro %}
{% for b in blocks %}
{% if b.title %}
{% if b.icon %}{{ icon(b.icon, 'h-5 w-5') }}{% endif %}

{{ __(b.title) }}

{% if b.link %}{{ __(b.link.label) }}{% endif %}
{% endif %}
{% if b.rows %} {% for label, align in b.columns %}{% endfor %} {% for row in b.rows %}{% for value in row %}{{ cell(value, b.columns[loop.index0][1]) }}{% endfor %}{% endfor %} {% if b.foot %}{% for value in b.foot %}{{ cell(value, b.columns[loop.index0][1], True) }}{% endfor %}{% endif %}
{{ __(label) }}
{% else %}

{{ __(b.empty or 'Nothing here for this period.') }}

{% endif %} {% if b.note %}

{{ b.note }}

{% endif %}
{% endfor %}