<!--

    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/>.

-->
<html lang="en" xmlns:th="http://www.thymeleaf.org">
    <!--@thymesVar id="qSession" type="nl.tudelft.queue.dto.view.labs.AbstractSlottedLabViewDTO"-->

    <body>
        <th:block th:fragment="slotted-lab-info">
            <div class="surface p-0">
                <h3 class="surface__header">Time Slot info</h3>

                <div class="surface__content">
                    <dl>
                        <dt class="fw-500">Slot selection opens at</dt>
                        <dd th:text="${#temporals.format(qSession.slottedLabConfig.selectionOpensAt, 'dd MMMM yyyy HH:mm')}"></dd>

                        <th:block th:if="${qSession.slottedLabConfig.isConsecutive()}">
                            <dt class="fw-500 mt-3">Consecutive filling settings</dt>
                            <dd
                                th:text="|This lab requires ${qSession.slottedLabConfig.getConsideredFullPercentage() + '%'}
                    of a slot to be occupied for subsequent slots to open, whilst permitting ${qSession.slottedLabConfig.getPreviousEmptyAllowedThreshold()} previous slots to be below that threshold.|"></dd>
                        </th:block>

                        <th:block th:if="${@permissionService.canTakeRequest(qSession.id)}">
                            <dt class="fw-500 mt-3">Enqueueing rules</dt>
                            <dd th:if="${qSession.canSelectDueSlots}">Students can take slots that have passed</dd>
                            <dd th:unless="${qSession.canSelectDueSlots}">Students cannot take slots that have passed</dd>
                            <dd th:if="${qSession.slottedLabConfig.disableLateEnrollment}">
                                Students can not enroll in slots that have already started
                            </dd>
                            <dd th:unless="${qSession.slottedLabConfig.disableLateEnrollment}">
                                Students can enroll in slots that have already started
                            </dd>

                            <dt class="fw-500 mt-3">Request taking rules</dt>
                            <dd th:if="${qSession.earlyOpenTime == 0}">A slot request can be taken from the start of that slot</dd>
                            <dd
                                th:unless="${qSession.earlyOpenTime == 0}"
                                th:text="|A slot request can be taken from ${qSession.earlyOpenTime} minutes before the start of that slot|"></dd>
                            <dt class="fw-500 mt-3">Number of booked slots:</dt>
                            <dd th:text="|${qSession.slotsOccupied} / ${qSession.maxSlots}|"></dd>
                        </th:block>
                    </dl>
                </div>
            </div>
        </th:block>
    </body>
</html>
