<!--

    Queue - A Queueing system that can be used to handle labs in higher education
    Copyright (C) 2016-2024  Delft University of Technology

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as
    published by the Free Software Foundation, either version 3 of the
    License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.

-->
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{edition/view}">
    <!--@thymesVar id="edition" type="nl.tudelft.labracore.api.dto.EditionDetailsDTO"-->

    <head>
        <title th:text="|Info - ${edition.course.name} (${edition.name})|"></title>
    </head>

    <body>
        <section class="flex vertical" layout:fragment="subcontent">
            <div class="flex">
                <div class="surface p-0">
                    <h3 class="surface__header">Course ID</h3>
                    <div class="surface__content" th:text="${edition.id}"></div>
                </div>
            </div>

            <div class="grid auto-fill align-start">
                <div class="surface p-0" th:with="teachers = ${@roleDTOService.teacherNames(edition)}">
                    <h3 class="surface__header">Teachers</h3>

                    <div class="surface__content p-5" th:if="${#lists.isEmpty(teachers)}">
                        <span>No teachers</span>
                    </div>

                    <ul role="list" class="list divided surface__content" th:unless="${#lists.isEmpty(teachers)}">
                        <li th:each="teacher : ${teachers}" class="pbl-3" th:text="${teacher}"></li>
                    </ul>
                </div>

                <div class="surface p-0" th:with="headTAs = ${@roleDTOService.headTANames(edition)}">
                    <h3 class="surface__header">Head TAs</h3>

                    <div class="surface__content p-5" th:if="${#lists.isEmpty(headTAs)}">
                        <span>No head TAs</span>
                    </div>

                    <ul role="list" class="list divided surface__content" th:unless="${#lists.isEmpty(headTAs)}">
                        <li th:each="headTA : ${headTAs}" class="pbl-3" th:text="${headTA}"></li>
                    </ul>
                </div>

                <div class="surface p-0" th:with="assistants = ${@roleDTOService.assistantNames(edition)}">
                    <h3 class="surface__header">Assistants</h3>

                    <div class="surface__content p-5" th:if="${#lists.isEmpty(assistants)}">
                        <span>No assistants</span>
                    </div>

                    <ul class="surface__content list divided" role="list" th:unless="${#lists.isEmpty(assistants)}">
                        <li th:each="assistant : ${assistants}" class="pbl-3" th:text="${assistant}"></li>
                    </ul>
                </div>

                <div class="surface p-0" th:with="modules = ${edition.getModules()}">
                    <h3 class="surface__header">Modules</h3>

                    <div class="surface__content p-5" th:if="${#lists.isEmpty(modules)}">
                        <div>Please configure a module</div>
                    </div>

                    <ul role="list" class="list divided surface__content" th:unless="${#lists.isEmpty(modules)}">
                        <li th:each="module : ${modules}" class="pbl-3" th:text="${module.name}"></li>
                    </ul>
                </div>
            </div>

            <div th:if="${@permissionService.canManageEdition(edition.id)}">
                <h3 class="font-500 mb-3">Options</h3>

                <div class="flex wrap gap-3">
                    <a th:href="@{/edition/{id}/archive(id=${edition.id})}" class="button" data-style="outlined" data-type="error">Archive edition</a>
                    <form class="d-inline" th:action="@{/edition/{editionId}/visibility(editionId=${edition.id})}" method="post">
                        <button class="button" data-style="outlined">
                            <span th:if="${edition.hidden}">Unhide in Queue</span>
                            <span th:unless="${edition.hidden}">Hide in Queue</span>
                        </button>
                    </form>
                    <a th:href="@{/edition/{id}/requests/export(id=${edition.id})}" class="button" data-style="outlined">Export all labs</a>
                    <a th:href="@{/edition/{id}/requests/signofflist.csv(id=${edition.id})}" class="button" data-style="outlined">
                        Export latest status of student submission requests
                    </a>
                </div>
            </div>
        </section>
    </body>
</html>
