{% extends "events/base.html" %}
{% load i18n %}
{% load event_tags %}
{% load perm_tags %}
{% load styled_forms %}

{% block title %}{{ block.super }}{% trans "Edit Email for Registration Confirmation and Reminders" %}{% endblock %}

{% block extra_head %}
{{ block.super }}
<link rel="stylesheet" href="{{ STATIC_URL }}css/events.css">
<script type="text/javascript" src="{{ TINYMCE_JS_URL }}"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/global/tinymce.event_handlers.js"></script>
<style type="text/css">
    .well{
        width: 90%;
        margin: 1em 0;
    }
    .errors{
        background-color: #ffebe8;
        border: 2px solid #ff8b78;
        margin-bottom: 20px;
        margin-left: 110px;
        padding: 10px;
        width: 75%;
    }
    .btn-primary{
        color: #0E4D84;
    }
</style>
{% endblock %}

{% block body %}

<div class="t">
     {% event_nav request.user event %}
    <h1>{% trans "Edit Email to Event Registrants" %}</h1>
    
    <div class="well">
        This Email is used for:
        <ul>
        <li>The event reminders to the registrants </li> 
        </ul>
    </div>
    
    <h3>{% trans "Event: " %}<a href="{% url event event.id %}">{{ event.title }}</a></h3>
    
    <div class="forms">
        
    {% if form.errors.values %}
        <div class="errors">
            <ul>
                {{ form.non_field_errors }}
                {% for field in form %}
                    {% if field.errors %}
                        {% for error in field.errors %}
                        <li>{{ field.label_tag }}  &ndash; {{ error }}</li>
                        {% endfor %}
                    {% endif %}
                {% endfor %}
            </ul>
        </div>
    {% endif %}

        <form action="." method="post" name="form1">{% csrf_token %}
            <div class="form-field">
                <div class="label">To:
                ALL Attendees
                <a href="{% url event.registrant.roster event.id %}">{% trans "View all registrant(s)" %}</a>
                </div>
            </div>
            
            {% for field in form %}
            <div class="form-field">
                <div class="error">{{ field.errors }}</div>
                <div class="label {% if field.field.required %} required{% endif %}">{% trans field.label %}</div>
                <div class="field"> {{ field }}</div>
                <div class="help-text">{{ field.help_text|safe }}</div>   
            </div>
            {% endfor %}
            
            <div style="float:right;">
            <input class="btn btn-secondary" type="submit" name="submit" value="Save & Test" title="Save and receive a test email" />
            </div>
            
            <div>               
            <input class="btn btn-primary btn-large" name="submit" type="submit" value="Save" />
            </div>
            <div style="clear: right;"></div>
        
        </form>
        
  </div>
  
</div>

{% endblock %}

