{% extends 'events/registration/management/_regform_base.html' %} {% from '_statistics.html' import stats_badges, stats_box %} {% block subtitle %} {% trans title=regform.title -%} Stats for "{{ title }}" {%- endtrans %} {% endblock %} {% block content %}
{%- for stats in regform_stats -%} {%- if stats.type == 'overview' -%} {{ render_overview(stats) }} {%- elif stats.type == 'table' -%} {% call stats_box(title=stats.title, subtitle=stats.subtitle, label=regform.currency if stats.is_currency_shown else '', label_tooltip=_('Currency: {}').format( get_currency_name(regform.currency, locale=session.lang))) %} {{ render_table(stats.get_table()) }} {%- endcall %} {%- endif -%} {%- endfor -%}
{% endblock %} {% macro render_overview(stats) %} {% set height = stats.countries|length * 24 + 28 %} {% set badges = [(_("Registrations"), stats.registrations|length), (_("Days left
to register"), stats.days_left), (_("Countries"), stats.num_countries)]%} {% set taken, total, progress = stats.availability %} {% call stats_box(title=stats.title, subtitle=stats.subtitle, label=stats.currency if stats.is_currency_shown else '') %} {{ stats_badges(badges) }} {%- if total > 0 -%}
{% trans %}Availability{% endtrans %} {%- if total == taken %} {%- trans %}event full{% endtrans -%} {%- else -%} {%- trans places=total-taken %}{{ places }} places available{% endtrans -%} {% endif -%}
{% endif %} {% if stats.num_countries %}
{% trans %}Registrants per country{% endtrans %}
{% endif %} {% endcall %} {% endmacro %} {% macro render_table(table) -%} {%- if table.head %} {%- for head in table.head %} {% if head.type == 'str' -%} {%- endif -%} {% endfor %} {%- endif %} {%- if table.rows %} {%- for row_type, row in table.rows %} {%- for cell in row -%} {% if cell.type == 'currency' %} {{ _render_currency_cell(cell) }} {% elif cell.type == 'icon' %} {{ _render_icon_cell(cell) }} {% elif cell.type == 'progress' %} {{ _render_progress_cell(cell) }} {% elif cell.type == 'progress-stacked' %} {{ _render_progress_stacked_cell(cell) }} {% elif cell.type == 'str' %} {{ _render_str_cell(cell) }} {% elif cell.type == 'default' %} {{ _render_default_cell(cell) }} {% endif %} {%- endfor -%} {% endfor %} {% endif %}
1 %} colspan="{{ head.colspan }}"{% endif %}>{{ head.data }}
{%- endmacro %} {%- macro _render_currency_cell(cell) -%} {%- call _generate_cell(cell) -%} {{ format_currency(cell.data, '', locale=session.lang) }} {%- endcall -%} {%- endmacro -%} {% macro _render_icon_cell(cell) -%} {%- call _generate_cell(cell) -%} {%- endcall -%} {%- endmacro %} {% macro _render_progress_cell(cell) %} {%- call _generate_cell(cell) %} {{ cell.data[1] }} {% endcall -%} {% endmacro %} {% macro _render_progress_stacked_cell(cell) %} {%- call _generate_cell(cell) %} {% for width in cell.data[0] -%} {%- endfor %} {{ cell.data[1] }} {% endcall -%} {% endmacro %} {%- macro _render_str_cell(cell) -%} {%- call _generate_cell(cell) -%} {{ cell.data }} {%- endcall -%} {%- endmacro -%} {%- macro _render_default_cell(cell) -%} {%- call _generate_cell(cell) -%} {%- endcall -%} {%- endmacro -%} {% macro _generate_cell(cell) %} 1 %} colspan="{{cell.colspan}}" {%- endif -%} {%- if cell.qtip %} title="{{ cell.qtip }}" {%- endif -%} {%- if cell.classes %} class="{{ ' '.join(cell.classes) }}" {%- endif -%}> {{- caller() -}} {%- endmacro %}