{% extends "cms/home.html" %}
{% load cms_tags danceschool_tags thumbnail i18n %}

{% block title %}
	{{ event_set.0.name }}
{% endblock %}

{% block meta_title %}
	{{ event_set.0.name }}
{% endblock %}

{% block meta_description %}
	{% blocktrans with name=event_set.0.name startTime=event_set.0.eventoccurrence_set.all.first.startTime|date:'l, F d, h:i A' endTime=event_set.0.eventoccurrence_set.all.first.endTime|date:'h:i A' location=event_set.0.location.name %}
	Join us for our event, {{ name }}, held {{ startTime }} - {{ endTime }} at {{ location }}.
	{% endblocktrans %}
{% endblock %}

{% block facebook_og_description %}
	{% blocktrans with name=event_set.0.name startTime=event_set.0.eventoccurrence_set.all.first.startTime|date:'l, F d, h:i A' endTime=event_set.0.eventoccurrence_set.all.first.endTime|date:'h:i A' location=event_set.0.location.name %}
	Join us for our event, {{ name }}, held {{ startTime }} - {{ endTime }} at {{ location }}.
	{% endblocktrans %}
{% endblock %}

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

{% block content %}
	<h1 class="my-4">{{ event_set.0.name }}</h1>

	{% for event in event_set %}
	<div class="row">
		<div class="col-md-4 order-2">
			<p>
			{% block register_link %}
			{% if event.registrationOpen and not event.soldOut and not event.registrationPassed %}
				<a class="btn btn-primary btn-lg" href="{% url 'registration' %}">{% trans "Register for this event!" %}</a>
			{% elif event.soldOut %}
				<button class="btn btn-secondary mr-2 my-2 btn-lg disabled">{% trans "Sold Out!" %}</button>
			{% elif event.registrationEnabled and not event.status == event.RegStatus.linkOnly %}
				<button class="btn btn-secondary mr-2 my-2 btn-lg disabled">{% trans "Registration Closed" %}</button>
			{% endif %}
			{% endblock %}
			</p>

			{% if 'core.change_event' in perms %}
			<p><a class="btn btn-outline-secondary" href="{% url 'admin:core_event_change' event.id %}">{% trans "Edit Event Details" %}</a></p>
			{% endif %}
			{% if 'core.view_registration_summary' in perms and event.registrationEnabled %}
			<p><a class="btn btn-outline-secondary" href="{% url 'viewregistrations' event.id %}">{% trans "View Registrations" %}</a></p>
			{% endif %}
		</div>
		<div class="col-md-8 order-1">
			<h3>{{ event.eventoccurrence_set.all.first.startTime|date:'l, F d, h:i A' }} - {{ event.eventoccurrence_set.all.first.endTime|date:'h:i A' }}</h3>

			<p class='address'>
			<strong>{{ event.location.name }}{% if event.room.name %} - {{ event.room.name }}{% endif %}</strong><br />
			{{ event.location.address }}<br />
			{{ event.location.city }}, {{ event.location.state }} {{ event.location.zip }}<br />
			<a href="{% page_url 'directions' as directions_url %}{{ directions_url }}#{{ event.location.name|slugify }}">{% trans "Map this" %}</a>

			{% if not event.registrationEnabled and not event.status == event.RegStatus.linkOnly %}
				<p class="font-italic">{% trans "Registration for this event is not required." %}</p>
			{% endif %}
			</p>
		</div>
	</div>

	<hr />

	{% endfor %}

	<div class="row">
		<div class="col-12">
			<h3>{% trans "About this Event" %}</h3>
			<div class='eventDescription'>
				{{ event_set.0.description|safe }}
			</div>
		</div>
	</div>
	
{% endblock %}