{% extends "generic/base.html" %}
<!-- {% load static from static %} -->

{% load crispy_forms_tags %}

{% block css %}
{% endblock %}
{% block js %}
    <!--<script type="text/javascript" src="/admin/jsi18n/"></script>-->
    {{form.media}}

    <script type="text/javascript">
    </script>

    <!-- {{ form.media }} -->
{% endblock %}
{% block content %}
    <h2>Edit CID User / {{ciduser.cid}}</h2>
    Use this form to edit a CID user.
    <form action="" method="post" enctype="multipart/form-data" id="condition-form">
        {% csrf_token %}

        {{ form|crispy }}
        <input type="submit" class="submit-button" value="Submit" name="submit">
    </form>

    <h2>Exams</h2>
    The group is currently associated with the following exams. 

    <p>
        {% with object.get_cid_exams as exam_map %}
            {% for exam_type, exams in exam_map %}
                <h4>{{exam_type}}</h4>
                <ul>
                    {% for exam in exams %}
                        <li>
                            <a href="{{exam.get_absolute_url}}">{{exam}}</a>
                        </li>
                    {% endfor %}
                </ul>
            {% empty %}
                No exams.
            {% endfor %}
        {% endwith %}
    </p>

    <p>
        These should be edited via the exam candidate page. If you need to manually toggle you can do so <a href="{% url 'generic:update_cid_exams' object.pk %}">here</a> (you shouldn't)
    </p>

{% endblock %}