{% extends 'teacher/discipline/MapBase' %} 

{% set step_5 = 'active' %}

{% block discipline_media %}
    {{ HTML.script('media/js/discipline/EditStudents.js')|raw }}
    {{ HTML.style('media/less/teacher/discipline/EditStudents.css')|raw }}
{% endblock %}

{% macro outputStudent(Student) %}
    <div id="{{ Student.ID }}" class="Student {% if Student.Type == 'detach' %}StatusUnbind{% else %}StatusBind{% endif %}">
        <span class="Name">{{ Student.Last }} {{ Student.First }} {{ Student.Second  }}</span>
        {% if Student.Type == 'detach' %}
            <button class="action Action_BindStudent">Прикрепить студента</button>
        {% else %}
            <button class="action Action_UnbindStudent">Отсоединить студента</button>
        {% endif %}
    </div>
{% endmacro %}


{% import 'teacher/discipline/EditStudents' as idx %}

{% block map_content %}

<div class="StudentsList">
    <input type="hidden" class="HiddenInputFacultyID" value="{{ Discipline.FacultyID }}">
    
    <div class="GeneralStudentsList">
        <h2 class="BlueTitle">Основные студенты</h2>
        {% for group in Groups %}
            <div class="GradeAndGroupTitle ActionShowHideGroupContainer" id="{{ group.GroupID }}">
                <span class="info">{{ group.Degree }}, курс {{ group.GradeNum }} группа {{ group.GroupNum }}</span>
                <span class="Action">Открыть список ▼</span>
            </div>

            <div class="GroupContainer">
                <div class="hideListAction"></div>
                {% for student in group.students %}
                    {{ idx.outputStudent(student) }}
                {% endfor %}
              <!--  <button class="btn_editStudents">Отсоединить всех</button> -->
            </div>
        {% endfor %}    
    </div>



    <div class="AttachedStudentsList">
        <h2 class="BlueTitle">Прикрепленные студенты</h2>
        {% for group in GroupsAttached %}
            <div class="GroupContainerAttached" id="{{ group.GroupID }}">
                <div class="groupInfo"><div class = "groupInfoAlone">{{ group.GradeNum }}.{{ group.GroupNum }}</div></div>
                {% for student in group.students %}
                    {{ idx.outputStudent(student) }}
                {% endfor %}
            </div>
        {% endfor %}    
    </div>
    

        



    <div class="SearchStudents">
        <h2 class="BlueTitle">Поиск студентов</h2>
        <div class="SearchSettings">
            <select class="SelectGrade defaultForm">
                <option value="0">Выберите курс:</option>
                {% for Grade in GradesList %}
                    <option value="{{ Grade.ID }}" {% if Grade.ID == Discipline.GradeID %}selected{% endif %}>{{ Grade.Title }}</option>
                {% endfor %}
            </select>
            <select class="SelectStudyGroup defaultForm">
                <option value="0">Выберите группу:</option>
                {% for Group in StudyGroups %}
                    <option value="{{ Group.ID }}">Группа {{ Group.GroupNum }} - {{ Group.SpecName }}</option>
                {% endfor %}
            </select>
            <input type="text" class="InputStudentName defaultForm P1Width" placeholder="Фамилия Имя Отчество" value="">
            <button class="searchBtn defaultForm BlueButton P2Width">Поиск</button>
        </div>
        <div class="SearchResult"></div>
    </div>
</div>
{% endblock %}