{% extends "admin/base_site.html" %}
{% load i18n admin_urls admin_static admin_modify l10n %}
{% block extrahead %}{{ block.super }}
    <script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>
    {{ media }}
{% endblock %}

{% block extrastyle %}{{ block.super }}
    <link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}"/>{% endblock %}

{% block coltype %}colM{% endblock %}

{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} change-form{% endblock %}

{% block breadcrumbs %}
    <div class="breadcrumbs">
        <a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
        &rsaquo; <a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a>
        &rsaquo; {% if has_change_permission %}
        <a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a>{% else %}
        {{ opts.verbose_name_plural|capfirst }}{% endif %}
        &rsaquo; {% if add %}{% trans 'Repeat task' %} {{ opts.verbose_name }}{% else %}
        {{ original|truncatewords:"18" }}{% endif %}
    </div>
{% endblock %}

{% block content %}
    <div id="content-main">
    <h1>{{ obj.name }}</h1>
    <p>{{ description|safe }}</p>
<table>
    <tr><th>{% trans 'Calendar' %}</th><th>{% trans 'Agent' %}</th>{% for category in categories %}<th>{{ category }} <small><a href="{% url 'ical' organization_pk=obj.pk category_pk=category.pk title=category.name %}?{{ api_key_variable }}={{ obj.access_token }}">{% trans 'iCal' %}</a></small></th>{% endfor %}</tr>
{% for agent_data in statistics %}<tr>
<td><a href="{% url 'ical' organization_pk=obj.pk agent_pk=agent_data.0.pk title=agent_data.0.name %}?{{ api_key_variable }}={{ obj.access_token }}">{% trans 'iCal' %}</a></td>
{% for x in agent_data %}<td>{% if forloop.first %}<strong>{{ x }}</strong>

{% else %}{% trans 'tasks: ' %}{{ x.0 }}{% trans ', total time: ' %}{{ x.1|localize }}{% if x.2 %} (corrected value: {{ x.2|localize }}){% endif %}
{% endif %}
</td>{% endfor %}
</tr>
{% endfor %}

</table>

    </div>
<p class="changelink-box"><a href="{% url 'ical' organization_pk=obj.pk title=obj.name %}?{{ api_key_variable }}={{ obj.access_token }}" class="changelink">{% trans 'Global calendar (.ics)' %}</a></p>
<div class="submit-row">

    <p class="changelink-box"><a href="{% url 'admin:autoplanner_organization_change' obj.pk %}" class="changelink">{% trans 'Modify' %}</a></p>
</div>
{% endblock %}
