{% extends "cms/home.html" %}
{% load crispy_forms_tags i18n %}

{% block title %}{% trans "Classes" %}{% endblock %}

{% block body_id %}classes{% endblock %}

{% block content %}
	{% block summary %}
		<div class="card card-body bg-light pb-0">
			<h5 class="card-title">{% trans "You've selected:" %}</h5>

			<table class="table">
			<tbody>
			{% for item in reg.temporaryeventregistration_set.all %}
				<tr>
					<td>{% if item.dropIn %}{% trans "DROP IN" %}: {% endif %}{{ item.event.name }}{% if item.role %} - {{ item.role.name }}{% endif %}</td>
					<td>{{ currencySymbol }}{{ item.price|floatformat:2 }}</td>
				</tr>
			{% endfor %}
			</tbody>
			{% if addonItems %}
			<tbody>
				{% for addon in addonItems %}
				<tr class="addons">
					<th>{% trans "Free Add-On" %}:</th><td>{{ addon.name }}</td>
				</tr>
				{% endfor %}
			</tbody>
			{% endif %}
			{% if discount_code_amount > 0 %}
			<tbody>
				{% for code in discount_codes %}
					<tr>
						<th>{% trans "Discount Code Applied" %}: {{ code.0 }}</th>
						<td>-{{ currencySymbol }}{{ code.2|floatformat:2 }}</td>
					</tr>
				{% endfor %}
			</tbody>
			{% endif %}
			<tbody>
				<tr style="font-size: 1.2em;">
					<th><em>{% trans "Subtotal" %}:</em></th>
					<th>{{ currencySymbol }}{{ discounted_subtotal|floatformat:2 }}</th>
				</tr>
			</tbody>

			</table>
		</div>
	{% endblock %}

	{# Display any warning or error messages associated with the previous form submission #}
	<div id="message-alerts">
    {% for message in messages %}
	    <div class="alert {% if message.level == DEFAULT_MESSAGE_LEVELS.ERROR %}alert-danger{% elif message.level == DEFAULT_MESSAGE_LEVELS.WARNING %}alert-warning{% else %}alert-info{% endif %}">{{ message }}</div>
    {% endfor %}
    </div>


	{% block form %}
		<h3 class="mt-5 mb-3">{% trans "Step 2: Provide Your Student Information" %}</h3>

		{% if show_ajax_form %}
			{% include "account/ajax_login.html" %}

		<div class="card">
			<div class="card-body">

		{% endif %}
				<form action="" method="post">
				    {% csrf_token %}
				    {% crispy form %}
				</form>
		{% if show_ajax_form %}
			</div>
		</div>
		{% endif %}
	{% endblock %}
{% endblock %}
