<!--

    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 di•••••••••••stributed 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"-->

    <!--@thymesVar id="qSession" type="nl.tudelft.queue.model.QueueSession"-->
    <!--@thymesVar id="request" type="nl.tudelft.queue.dto.create.RequestCreateDTO"-->

    <!--@thymesVar id="rooms" type="java.util.List<nl.tudelft.labracore.api.dto.RoomSummaryDTO>"-->
    <!--@thymesVar id="assignments" type="java.util.List<nl.tudelft.labracore.api.dto.AssignmentSummaryDTO>"-->
    <!--@thymesVar id="types" type="java.util.Map<java.lang.Long, java.util.Set<java.lang.String>>"-->

    <!--@thymesVar id="rType" type="java.lang.String"-->

    <!--@thymesVar id="message" type="java.lang.String"-->

    <body>
        <section layout:fragment="subcontent">
            <h3 class="font-500 mb-3" th:text="${'Session #' + qSession.id}"></h3>

            <form
                th:action="@{/lab/{id}/enqueue/{rType}(id=${qSession.id}, rType=${rType})}"
                th:object="${request}"
                method="post"
                class="flex vertical"
                id="enqueue-form">
                <th:block layout:fragment="enqueue-body"></th:block>

                <div>
                    <button type="submit" name="enqueue" id="enqueue" class="button">Enqueue</button>
                </div>
            </form>

            <script>
                document.addEventListener("DOMContentLoaded", function () {
                    document.getElementById("enqueue-form").addEventListener("submit", function () {
                        document.getElementById("enqueue").setAttribute("disabled", "");
                    });
                });
            </script>
        </section>
    </body>
</html>
