{% extends 'events/management/base.html' %}
{% from 'forms/_form.html' import simple_form %}

{% block title %}
    {%- trans %}Participants{% endtrans -%}
{% endblock %}

{% block content %}
    <div class="action-box highlight">
        <div class="section">
            {% if regform and not registration_enabled %}
                {{ render_feature_disabled() }}
            {% elif not regform %}
                {{ render_no_regform() }}
            {% endif %}
        </div>
    </div>
    {% if not regform %}
        {{ simple_form(form, fields=form._meeting_fields, submit=_('Create'),
                       disabled_until_change=false, back_button=false) }}
    {% endif %}
{% endblock %}


{% macro render_feature_disabled() %}
    <div class="icon icon-users"></div>
    <div class="text">
        <div class="label">
            {% trans %}The registration feature is disabled{% endtrans %}
        </div>
        {% trans -%}
            Participants are now handled through a registration form.
        {%- endtrans %}
    </div>
    <div class="toolbar">
        <button class="i-button highlight"
                data-href="{{ url_for('.manage', event) }}"
                data-method="POST">
            {% trans %}Enable{% endtrans %}
        </button>
    </div>
{% endmacro %}

{% macro render_no_regform() %}
    <div class="icon icon-users"></div>
    <div class="text">
        <div class="label">
            {% trans %}There is no registration form for participants{% endtrans %}
        </div>
        {% trans -%}
            To create a new registration form, specify the participant visibility settings below.
            These settings can only be changed while there are no registrations.
        {%- endtrans %}
    </div>
{% endmacro %}
