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

{% block title %}{{ block.super }}Types{% endblock %}

{% block extra_head %}
{{ block.super }}
<link rel="stylesheet" href="{{ STATIC_URL }}css/events.css">
{% endblock %}

{% block body %}
<div class="t">
    {% event_nav request.user %}

    <h1>{% trans "Reassign Event Types" %}</h1>
    <div class="event-wrap">
        <div class="type-wrap">
            <div class="type-item">
                {{ type.name }} has {{ type.event_set.count }} event{{ type.event_set.count|pluralize }} associated
                {% if type.event_set.count > 0 %}
                    <ul class="associated-events">
                    {% for event in type.event_set.all %}
                        <li>
                        <a href="{% url event event.pk %}">{{ event }}</a>
                        ({{ event.start_dt|date:"l, M j, Y P" }} - {{ event.end_dt|date:"l, M j, Y P" }})
                        </li>
                    {% endfor %}
                    </ul>
                {% endif %}
            </div>
        </div>
		<div class="forms">
    	<form action="{% url event.reassign_type type.pk %}" method="post">{% csrf_token %}
            <div class="item">
                <div class="errs">{{ form.type.errors }}</div>
                <div class="label">{{ form.type.label }}</div>
                <div class="field" style="margin-left:150px">{{ form.type }}</div>
				<div class="clear"></div>
            </div>
			<input type="Submit" value="Reassign Events" />
        </form>
		</div>
    </div>
</div>
{% endblock %}
