{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}
<div class="boxes" id="groups">
    <div class="contentblock">
        <h2>
            {% trans "My Groups" %}
        </h2>
        <div class="content">
            <ul class="wm-list">
                {% if groups %}
                {% for group in groups %}
                <li class="wm">
                    <div class="summary">
                        <div class="name">{{ group.name }}</div>
                        <div class="clear"></div>
                    </div>
                    <div class="details">
                        <ul>
                            <li>
                                {% trans "Course" %}:
                                <span class="value">
                                    {% if group.course %}
                                    {{group.course.name}}
                                    {% else %}
                                    {% trans "Not assigned" %}
                                    {% endif %}
                                </span>
                            </li>
                            <li>
                                {% trans "Semester" %}:
                                <span class="value">{{group.semester.name}}</span>
                            </li>
                            <li>
                                {% trans "Owner(s)" %}:
                                <span class="value">{{group.owner_list}}</span>
                            </li>
                            <li>
                                {% trans "Member count" %}:
                                <span class="value">{{group.member_count}}</span>
                            </li>
                            <li>
                                &nbsp;
                                <span class="value"><a href="/group/show/{{group.id}}">{% trans "More details" %}</a></span>
                            </li>
                        </ul>
                    </div>
                </li>
                {% endfor %}
                {% else %}
                <div id="new-wm-tooltip">
                    <div id="new-wm-tooltip-container">
                        <p>
                            {% trans "You have no groups" %}
                        </p>
                        <p>
                            {% trans "Create a new one, and add your students to the new group" %}
                        </p>
                        <div id="new-wm-tooltip-tail"></div>
                    </div>
                </div>
                {% endif %}
                <li class="wm" id="new-group">
                    <div class="summary">
                        <div class="name">{% trans "Create new group" %}</div>
                        <div class="clear"></div>
                    </div>
                    <div id="new-group-wizard" style="display: none">
                        <form action="/group/new/" method="POST">
                            <h3>{% trans "Create new group" %}</h3>
                            <h4>{% trans "Group name" %}</h4>
                            <p>
                                <input type="text" name="name" id="new-group-name" />
                            </p>
                            <h4>{% trans "Semester" %}</h4>
                            <p>
                                <select name="semester" id="new-group-semester">
                                    {% for semester in semesters %}
                                    <option value="{{semester.id}}">{{semester.name}}</option>
                                    {% endfor %}
                                </select>
                            </p>
                            <h4>{% trans "Members" %}</h4>
                            <p>
                                <textarea name="members" placeholder="{% trans 'Student NEPTUN codes, one per line' %}" id="new-group-members"></textarea>
                            </p>
                            <h4>{% trans "Summary" %}</h4>
                            <p>
                                <strong>{% trans "Group name" %}:</strong> <span id="new-group-summary-name"></span><br />
                                <strong>{% trans "Semester" %}:</strong> <span id="new-group-summary-semester"></span><br />
                                <strong>{% trans "Member count" %}:</strong> <span id="new-group-summary-count"></span><br />
                            </p>
                            <p>
                                {% csrf_token %}
                                <input type="submit" value="{% trans "Done" %}">
                            </p>
                        </form>
                    </div>
                </li>
            </ul>
        </div>
    </div>
</div>
