{% extends "pretixcontrol/event/settings_base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% block inside %}
    <form action="" method="post" class="form-horizontal" enctype="multipart/form-data">
        {% csrf_token %}
        {% bootstrap_form_errors form %}
        <fieldset>
            <legend>{% trans "E-mail settings" %}</legend>
            {% bootstrap_field form.mail_prefix layout="horizontal" %}
            {% bootstrap_field form.mail_from layout="horizontal" %}
        </fieldset>
        <fieldset>
            <legend>{% trans "E-mail content" %}</legend>
            <div class="panel-group" id="questions_group">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            <a data-toggle="collapse" href="#order_placed">
                                <strong>{% trans "Placed order" %}</strong>
                            </a>
                        </h4>
                    </div>
                    <div id="order_placed" class="panel-collapse collapse">
                        <div class="panel-body">
                            {% bootstrap_field form.mail_text_order_placed layout="horizontal" %}
                        </div>
                    </div>
                </div>
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            <a data-toggle="collapse" href="#order_paid">
                                <strong>{% trans "Paid order" %}</strong>
                            </a>
                        </h4>
                    </div>
                    <div id="order_paid" class="panel-collapse collapse">
                        <div class="panel-body">
                            {% bootstrap_field form.mail_text_order_paid layout="horizontal" %}
                        </div>
                    </div>
                </div>
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            <a data-toggle="collapse" href="#order_free">
                                <strong>{% trans "Free order" %}</strong>
                            </a>
                        </h4>
                    </div>
                    <div id="order_free" class="panel-collapse collapse">
                        <div class="panel-body">
                            {% bootstrap_field form.mail_text_order_free layout="horizontal" %}
                        </div>
                    </div>
                </div>
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            <a data-toggle="collapse" href="#resend_link">
                                <strong>{% trans "Resend link" %}</strong>
                            </a>
                        </h4>
                    </div>
                    <div id="resend_link" class="panel-collapse collapse">
                        <div class="panel-body">
                            {% bootstrap_field form.mail_text_resend_link layout="horizontal" %}
                            {% bootstrap_field form.mail_text_resend_all_links layout="horizontal" %}
                        </div>
                    </div>
                </div>
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            <a data-toggle="collapse" href="#order_changed">
                                <strong>{% trans "Order changed" %}</strong>
                            </a>
                        </h4>
                    </div>
                    <div id="order_changed" class="panel-collapse collapse">
                        <div class="panel-body">
                            {% bootstrap_field form.mail_text_order_changed layout="horizontal" %}
                        </div>
                    </div>
                </div>
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            <a data-toggle="collapse" href="#order_expirew">
                                <strong>{% trans "Payment reminder" %}</strong>
                            </a>
                        </h4>
                    </div>
                    <div id="order_expirew" class="panel-collapse collapse">
                        <div class="panel-body">
                            {% bootstrap_field form.mail_days_order_expire_warning layout="horizontal" %}
                            {% bootstrap_field form.mail_text_order_expire_warning layout="horizontal" %}
                        </div>
                    </div>
                </div>
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            <a data-toggle="collapse" href="#waiting_list">
                                <strong>{% trans "Waiting list notification" %}</strong>
                            </a>
                        </h4>
                    </div>
                    <div id="waiting_list" class="panel-collapse collapse">
                        <div class="panel-body">
                            {% bootstrap_field form.mail_text_waiting_list layout="horizontal" %}
                        </div>
                    </div>
                </div>
            </div>
        </fieldset>
        <fieldset>
            <legend>{% trans "SMTP settings" %}</legend>
            {% bootstrap_field form.smtp_use_custom layout="horizontal" %}
            {% bootstrap_field form.smtp_host layout="horizontal" %}
            {% bootstrap_field form.smtp_port layout="horizontal" %}
            {% bootstrap_field form.smtp_username layout="horizontal" %}
            {% bootstrap_field form.smtp_password layout="horizontal" %}
            {% bootstrap_field form.smtp_use_tls layout="horizontal" %}
            {% bootstrap_field form.smtp_use_ssl layout="horizontal" %}
        </fieldset>
        <div class="form-group submit-group">
            <button type="submit" class="btn btn-primary btn-save">
                {% trans "Save" %}
            </button>
            <button type="submit" class="btn btn-default btn-save pull-left" name="test" value="1">
                {% trans "Save and test custom SMTP connection" %}
            </button>
        </div>
    </form>
{% endblock %}
