<link rel="stylesheet" href="../static/css/project.css"/>
{% extends "base.html" %} {% block content %}
<div class="projects_page">
    <div class="link_back_block">
        <a class="link_back" href="../">
            <p class="link_back_text">К проектам</p>
        </a>
    </div>
    <div class="project_header">
        <div class="edit_block">
            {% if current_user.id == project.creator %}
            <div class="edit_button">
                <a id="edit_button" class="edit_button_link" href="">
                    <p class="edit_button_text">Редактировать</p>
                </a>
            </div>
            {% else %}
            <p style="width: 12vw;"> </p>
            {% endif %}
        </div>
        <div class="brand_block">
            <img class="project_logo" src="../{{project.photo}}"/>
            <p class="name_project header_title">{{ project.name }}</p>
        </div>
        <div class="notification_block">

        </div>
    </div>
    <div class="body_block">
        <div class="head_staff_block">
            <h3 class="header_title">Участники</h3>
            <div class="collaborator_block">
                <div class="staff_block">
                    {% for user in staff %}
                    <div class="user">
                        <a class="link_to_user" href="/user/{{ user.login }}">
                            <img class="user_logo" src="../{{user.photo}}">
                            <p class="user_names">{{user.name}}</p>
                        </a>
                    </div>
                    {% endfor %}
                </div>
            </div>
        </div>
        <div class="header_task_block">
            <div class="head_task">
                <h3 class="header_title_2">Задачи</h3>
                <div class="new_task_block">
                    <a class="new_task_link" id="new_task_link" href="{{ project.id }}/quest/new">
                        <p class="new_task_text">Добавить</p>
                    </a>
                </div>
            </div>
            <div class="task_block">
                <div class="task">
                    {% for quest in quests %}
                    <div class="accordion list_quests" id="accordionPanelsStayOpen{{ quest.id }}">
                        <div class="accordion-item quest">
                            <h2 class="accordion-header quest_header" id="panelsStayOpen-heading{{ quest.id }}">
                                <button class="accordion-button quest_header_button" type="button"
                                        data-bs-toggle="collapse"
                                        data-bs-target="#panelsStayOpen-collapse{{ quest.id }}" aria-expanded="true"
                                        aria-controls="panelsStayOpen-collapse{{ quest.id }}">
                                    <div class="quest_button_block_one">
                                        <div class="quest_title_block">
                                            <p class="quest_title">{{ quest.name }}</p>
                                        </div>
                                    </div>
                                    {% if quest.overdue == 'yes' and quest.realized != 1 %}
                                    <div class="deadline_block alert alert-danger" role="alert">
                                        {{ quest.time_left }}
                                    </div>
                                    {% elif quest.overdue == 'today' and quest.realized != 1 %}
                                    <div class="deadline_block alert alert-warning" role="alert">
                                        Дедлайн сегодня
                                    </div>
                                    {% elif quest.overdue == 'no' and quest.realized != 1 %}
                                    <div class="deadline_block alert alert-success" role="alert">
                                        {{ quest.time_left }}
                                    </div>
                                    {% elif quest.overdue == '' and quest.realized != 1 %}
                                    <div class="deadline_block alert alert-warning" role="alert">
                                        Дедлайна нет
                                    </div>
                                    {% else %}
                                    <div class="deadline_block alert alert-success" role="alert">
                                        Задача выполнена
                                    </div>
                                    {% endif %}
                                </button>
                            </h2>
                            <div id="panelsStayOpen-collapse{{ quest.id }}"
                                 class="accordion-collapse collapse quest_body_block"
                                 aria-labelledby="panelsStayOpen-heading{{ quest.id }}">
                                <div class="accordion-body quest_body">
                                    {% if quest.realized == 0 %}
                                    <div class="quest_body">
                                        <div class="quest_description_block">
                                            <p class="quest_description_title">Описание</p>
                                            <div class="quest_description">
                                                <p class="quest_description_text">{{ quest.description }}</p>
                                            </div>
                                        </div>
                                        <div class="quest_solve_button">
                                            <a class="quest_solve_link" href="{{ project.id }}/quest/{{ quest.id }}">
                                                <p class="quest_solve_text">Решить</p>
                                            </a>
                                        </div>
                                    </div>
                                    {% else %}
                                    <div class="quest_body">
                                        <div class="quest_description_block">
                                            <p class="quest_description_title">Описание</p>
                                            <div class="quest_description">
                                                <p class="quest_description_text">{{ quest.description }}</p>
                                            </div>
                                        </div>
                                        <div class="quest_solve_button">
                                            <a class="quest_solve_link" href="{{ project.id }}/quest/{{ quest.id }}">
                                                <p class="quest_solve_text">Посмотреть</p>
                                            </a>
                                        </div>
                                    </div>
                                    {% endif %}
                                </div>
                            </div>
                        </div>
                    </div>
                    {% endfor %}
                </div>
            </div>
        </div>
    </div>
    <div class="files_block">
        <div class="head_files">
            <h2 class="files_title">Файлы</h2>
            <form action="" method="post" class="file_form" id="file_form" enctype="multipart/form-data">
                {{ form_file.hidden_tag() }}
                <div class="form_data bottom_data">
                    {{ form_file.file(class="input_data", id="selectedFile", type="file", style="display: none;") }}
                    {% for error in form_file.file.errors %}
                    <div class="alert alert-danger" role="alert">{{ error }}</div>
                    {% endfor %}
                </div>
                {{ form_file.submit(type="submit", id="upload_button", class="btn btn-success upload_button",
                style="display: none;") }}
                <button type="button" class="upload_button btn btn-primary" id="select_file_button"
                        onclick="push_file()">Добавить
                </button>
            </form>
        </div>
        <div class="list_files_block">
            <div class="list_files">
                {% for item in file_tree %}
                {% if item['type'] == 'file' %}
                <div class="file">
                    <div class="file_head">
                        <nav class="file_head_group" style="--bs-breadcrumb-divider: '>';" aria-label="breadcrumb">
                            <ol class="breadcrumb file_head_path">
                                {% for path in item['current_path'] %}
                                <li class="breadcrumb-item active file_path" aria-current="page">{{ path }}</li>
                                {% endfor %}
                            </ol>
                        </nav>
                    </div>
                    <div class="file_buttons">
                        <div class="btn-group file_buttons_groud">
                            {% if current_user.id == project.creator or item['object'].user == current_user.id %}
                            <a href="../project/{{ project.id }}/file/{{ item['object'].id }}/delete?from=project"
                               class="btn btn-primary file_delete"><p class="button_text">Удалить</p></a>
                            {% endif %}
                            <a href="../../../{{ item['path'] }}" download="" class="btn btn-primary file_download"><p
                                    class="button_text">Скачать</p></a>
                        </div>
                    </div>
                </div>
                {% elif item['type'] == 'folder' %}

                {% endif %}
                {% endfor %}
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="../static/js/project.js"></script>
{% endblock %}