{% extends "pretixcontrol/event/base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% block title %}{% trans "Create Email Rule" %}{% endblock %}
{% block content %}
    <h1>{% trans "Create Email Rule" %}</h1>
    {% if not request.event.live %}
        <div class="alert alert-warning">
            {% trans "Scheduled emails are not sent as long as your ticket shop is offline." %}
        </div>
    {% endif %}
    {% block inner %}
        <form class="form-horizontal" method="post" action="" enctype="multipart/form-data">
            {% csrf_token %}
            {% bootstrap_form_errors form %}

            {% bootstrap_field form.enabled layout='control' %}

            <fieldset>
                <legend>{% trans "Content" %}</legend>
                {% bootstrap_field form.subject layout='control' %}
                {% bootstrap_field form.template layout='control' %}
                {% if form.attach_ical %}
                    {% bootstrap_field form.attach_ical layout='horizontal' %}
                {% endif %}
            </fieldset>
            <fieldset>
                <legend>{% trans "Recipients" %}</legend>
                {% bootstrap_field form.send_to layout='control' %}
                {% if form.subevent %}
                    {% bootstrap_field form.subevent layout='control' %}
                {% endif %}
                {% bootstrap_field form.restrict_to_status layout='control' %}
                {% bootstrap_field form.checked_in_status layout='control' %}
                <hr>
                {% bootstrap_field form.all_products layout='control' %}
                {% bootstrap_field form.limit_products layout='horizontal' %}
            </fieldset>
            <fieldset>
                <legend>{% trans "Time" %}</legend>
                {% bootstrap_field form.schedule_type layout='horizontal' %}
                {% bootstrap_field form.send_date layout='horizontal' %}
                {% bootstrap_field form.send_offset_days layout='horizontal' %}
                {% bootstrap_field form.send_offset_time layout='horizontal' %}

                <div class="form-group">
                    <div class="col-md-9 col-md-offset-3">
                        <div class="alert alert-info">
                            {% blocktrans trimmed %}
                                For technical reasons, the email might actually be sent a bit later than your
                                configured date. Typically, this will not be more than 10 minutes. Your email
                                will never be sent earlier than the time you configured.
                            {% endblocktrans %}
                        </div>
                    </div>
                </div>
            </fieldset>

            <div class="form-group submit-group">
                <button type="submit" class="btn btn-primary btn-save">
                    {% trans "Save" %}
                </button>
            </div>
        </form>
    {% endblock %}
{% endblock %}
