<!--

    Queue - A Queueing system that can be used to handle labs in higher education
    Copyright (C) 2016-2020  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="~{container}">
    <!--@thymesVar id="edition" type="nl.tudelft.labracore.api.dto.EditionDetailsDTO"-->
    <!--@thymesVar id="request" type="nl.tudelft.queue.model.LabRequest"-->

    <!--@thymesVar id="assistants" type="java.util.List<nl.tudelft.labracore.api.dto.PersonSummaryDTO>"-->

    <body>
        <section layout:fragment="content">
            <div class="breadcrumbs mb-5">
                <a th:href="@{/}">Home</a>
                <span>&gt;</span>
                <a th:href="@{/editions}">Courses</a>
                <span>&gt;</span>
                <a th:href="@{/request/{id}(id=${request.id})}" th:text="${'Request #' + request.id}"></a>
                <span>&gt;</span>
                <a th:href="@{/request/{id}/approve(id=${request.id})}">Approve</a>
            </div>

            <h1 class="font-800 mb-5" th:text="${'Request #' + request.id}"></h1>

            <th:block th:if="${#lists.isEmpty(assistants)}">
                <div class="colour-error">
                    <span>There are no other assistants in this course.</span>
                </div>
            </th:block>

            <th:block th:unless="${#lists.isEmpty(assistants)}">
                <form action="#" th:action="@{/request/{id}/forward(id=${request.id})}" method="post">
                    <div class="flex vertical gap-3 mb-5">
                        <div class="flex vertical gap-1">
                            <label for="inputAssistant">Assistant</label>
                            <select name="assistant" class="textfield" id="inputAssistant">
                                <option value="-1">Anyone but me</option>
                                <th:block th:each="assistant : ${assistants}">
                                    <option th:value="${assistant.id}" th:text="${assistant.displayName}"></option>
                                </th:block>
                            </select>
                        </div>

                        <div class="flex vertical gap-1">
                            <label for="inputComment">Comment</label>
                            <textarea
                                maxlength="250"
                                class="textfield"
                                id="inputComment"
                                name="reasonForAssistant"
                                required="required"
                                placeholder="Leave a comment to explain your forward to other TA's."></textarea>
                        </div>
                    </div>

                    <div>
                        <button type="submit" name="forward" class="button">Forward</button>
                    </div>
                </form>
            </th:block>
        </section>
    </body>
</html>
