{% extends "cms/admin_home.html" %}
{% load sekizai_tags i18n %}

{% block content %}

	<h2>{% trans "Email Students: Confirmation" %}</h2>

	<p>{% trans "Please confirm the following before sending" %}:</p>

	<hr />

	{% if testemail %}<h3>{% trans "Test Email (No Recipients)" %}</h3> <hr />{% endif %}
	<h4>{% trans "From" %}: {{ from_name }} &lt;{{ from_address }}&gt;</h3>
	<h4>{% trans "Subject" %}: {{ subject }}</h4>

	<hr />

	<div class="card">
	<h5 class="card-header">{% trans "Message" %}</h5>
	<div class="card-body">
		{% if richTextChoice == "HTML" %}
			{{ html_message|safe }}
		{% else %}
			<pre>{{ message }}</pre>
		{% endif %}
	</div>
	</div>

	<div id="accordion" role="tablist" aria-multiselectable="true" class="my-4">
	  <div class="card">
        <h5 class="mb-0 card-header" role="tab" id="headingOne">
          <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true"   aria-controls="collapseOne">
            {% trans "Recipients" %}
          </a>
        </h5>
	    <div id="collapseOne" class="collapse show" role="tabpanel" aria-labelledby="headingOne" data-parent="#accordion">
	      <div class="card-body">

			<h4>
				{% if month and not series and not customers_to_send %}
					{% blocktrans %}Events in {{ month }}{% endblocktrans %}:
				{% elif series and not customers_to_send %}
					{% trans "Students Registered for Events" %}:
				{% elif customers_to_send %}
					{% trans "Specific Customers" %}:
				{% endif %}
			</h4>
			<ul>
				{% for s in events_to_send %}
					<li>{{ s.name }}</li>
				{% endfor %}
				{% for s in customers_to_send %}
					<li>{{ s.fullName }} &lt;{{ s.email }}&gt;</li>
				{% endfor %}
			</ul>

	      </div>
	    </div>
	  </div>
	  <div class="card">
	    <h5 class="card-header" role="tab" id="headingTwo">
	        <a role="button" data-toggle="collapse" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
	          {% trans "Detailed Recipients" %}
	        </a>
	    </h5>
	    <div id="collapseTwo" class="collapse" role="tabpanel" aria-labelledby="headingTwo" data-parent="#accordion">
	      <div class="card-body">

			{% if to %}
			<h5>CC:</h5>
			<ul>
			{% for item in to %}
				<li>{{ item }}</li>
			{% endfor %}
			</ul>
			{% endif %}
					
			{% if cc %}
			<h5>CC:</h5>
			<ul>
			{% for item in cc %}
				<li>{{ item }}</li>
			{% endfor %}
			</ul>
			{% endif %}

			{% if bcc or emails %}
			<h5>BCC:</h5>
			<ul>
			{% for item in bcc %}
				<li>{{ item }}</li>
			{% endfor %}
			{% for item in emails %}
				<li>{{ item }}</li>
			{% endfor %}
			</ul>
			{% endif %}

	      </div>
	    </div>
	  </div>
	</div>

	<a class="btn btn-success" href="?confirmed=True">{% trans "Send Emails" %}</a>
	<a class="btn btn-secondary" href="{% url 'emailStudents' %}">{% trans "Return To Form" %}</a>
{% endblock %}
