{% extends 'popojutrze/modules/_base.html' %}
{% load embed_video_tags %}
{% block content %}
    <div class="container">
        <div class="row">
            <div class="col-4">
                <div class="row">
                    <div class="col-3">
                        {% include 'popojutrze/modules/_navigation.html' with navigation_item='learn' narrow_nav=True %}
                    </div>
                    <div class="col-9">
                        {% include 'tasks/modules/_navigation_timeline.html' with tasks=tasks wide_nav=True %}
                    </div>
                </div>
            </div>
            <div class="col-8">
                <div class="wrapper">
                    <div class="row">
                        <div class="col-12">
                            <div class="title title--extended">
                                <h2>{{ selected_task.title }}</h2>
                                <a href="{% url 'tasks:path-detail' path_slug=selected_task.path.slug path_id=selected_task.path.id %}">
                                    <div class="title--extended__arrow"></div>
                                </a>
                                <div class="title--extended__description">
                                    {{ selected_task.subtitle }}
                                </div>
                                <div class="title__status">
                                    <div class="title__status__item">
                                        <div class="title__status__item__head">
                                            Postęp
                                        </div>
                                        <div class="title__status__item__content">
                                            <div class="title__status__item__content--bolder">
                                                {{ task_progress }}%
                                            </div>
                                        </div>
                                    </div>
                                    <div class="title__status__item">
                                        <div class="title__status__item__head">
                                            Zadanie
                                        </div>
                                        <div class="title__status__item__content">
                                            <div class="title__status__item__content--bolder">
                                                {{ selected_task.get_in_path_position }}
                                            </div>
                                            / {{ selected_task.path.tasks.active.count }}
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-12">
                            <div class="static-box">
                                <div class="static-box__image">
                                    {% if selected_task.yt_video %}
                                        {% video selected_task.yt_video as task_video %}
                                        {% video task_video %}
                                        {% endvideo %}
                                    {% endif %}
                                </div>
                                <div class="static-box__title">
                                    <p>{{ selected_task.header }}</p>
                                </div>
                                <div class="static-box__description">
                                    <p>
                                        {{ selected_task.description|safe }}
                                    </p>
                                </div>
                            </div>
                        </div>
                    </div>
                    {% if selected_task.instruction %}
                        <div class="row">
                            {% include 'tasks/modules/_instruction_list.html' with instruction=selected_task.instruction %}
                        </div>
                    {% endif %}
                    {% if not task_answer %}
                        {# Forma do umieszczenia 1 filmu #}
                        <div class="row">
                            {% include 'tasks/modules/_add_presentation_form.html' with video_number='1' form=form path_is_blocking=selected_task.path.is_path_blocking %}
                        </div>
                        <div class="row">
                            {% include 'tasks/modules/_movie_instruction.html' %}
                        </div>
                    {% else %}
                        {% if task_answer.video_1 %}
                            {# Prezentacja 1 po uploadzie #}
                            <div class="row">
                                <div class="title__default-gray">
                                    <p>Twoja prezentacja</p>
                                </div>
                                {% include 'tasks/modules/_your_presentation.html' with apprentice_video=task_answer.video_1 %}
                            </div>
                            {% if task_answer.video_1.mentor_text_score and task_answer.video_1.mentor_scores.count > 0 %}
                                {# Ocena mentora wraz z czwiczeniami #}
                                <div class="row">
                                    <div class="title__default-gray">
                                        <p>Ocena mentora</p>
                                    </div>
                                    {% include 'tasks/modules/_mentor_description_degree_box.html' with score=task_answer.video_1.mentor_text_score %}
                                    <div class="col-12">
                                        {% include 'tasks/modules/_mentor_degree_box.html' with scores=task_answer.video_1.mentor_scores.group_averages average=task_answer.video_1.mentor_scores.average %}
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="title__default-gray">
                                        <p>Polecane ćwiczenia</p>
                                    </div>
                                    <div class="col-12">
                                        <div class="col3-left-picture-container">
                                            {% for etp in exercise_task_positions %}
                                                {% include 'tasks/modules/_exercise_box.html' with etp=etp %}
                                            {% endfor %}
                                        </div>
                                    </div>
                                </div>
                                {% if all_exercises_done %}
                                    {% if task_answer.video_2 %}
                                        {# Prezentacja 2 po uploadzie #}
                                        <div class="row">
                                            <div class="title__default-gray">
                                                <p>Twoja prezentacja</p>
                                            </div>
                                            {% include 'tasks/modules/_your_presentation.html' with apprentice_video=task_answer.video_2 %}
                                        </div>

                                        {# Ocena spolecznosci #}
                                        <div class="row">
                                            <div class="title__default-gray">
                                                <p>Ocena społeczności</p>
                                            </div>
                                            {% include 'tasks/modules/_social_vote_list.html' with atmcav=task_answer.video_2.get_likes %}
                                        </div>
                                        <div class="row">
                                            {% include 'popojutrze/modules/_notification_button.html' with notification_context=vote_notification_context %}
                                        </div>

                                        {% if random_task_answer_from_task_answer.count > 0 %}
                                            <div class="row">
                                                <div class="title__default-gray">
                                                    <p>Obejrzyj inne prezentacje z tego zadania</p>
                                                </div>
                                                <div class="col-12">
                                                    <div class="polaroid-box">
                                                        {% for answer in random_task_answer_from_task_answer %}
                                                            {% include 'tasks/modules/_task_answers_box.html' with task_answer=answer %}
                                                        {% endfor %}
                                                    </div>
                                                </div>
                                            </div>
                                        {% endif %}
                                    {% else %}
                                        {# Forma do umieszczenia 2 filmu #}
                                        <div class="row">
                                            {% include 'tasks/modules/_add_presentation_form.html' with video_number='2' form=form path_is_blocking=selected_task.path.is_path_blocking %}
                                        </div>
                                        <div class="row">
                                            {% include 'tasks/modules/_movie_instruction.html' %}
                                        </div>
                                    {% endif %}
                                {% else %}
                                    <div class="row">
                                        {% include 'tasks/modules/_notification_icon_left.html' with notification_context=exercises_notification_context %}
                                    </div>
                                {% endif %}
                            {% else %}
                                {# Oczekiwanie na ocene mentora po uploadzie 1 #}
                                <div class="row">
                                    {% include 'tasks/modules/_notification_icon_left.html' with notification_context=mentor_notification_context %}
                                </div>
                                <div class="row">
                                    {% include 'popojutrze/modules/_notification_button.html' with notification_context=articles_notification_context %}
                                </div>
                            {% endif %}
                        {% endif %}
                    {% endif %}
                </div>
            </div>
        </div>
    </div>
    {% if first_submit or second_submit %}
        {% include 'tasks/modules/_submit_confirmation_popup.html' %}
    {% endif %}
{% endblock %}
