<!--

    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="request" type="nl.tudelft.queue.dto.view.requests.SelectionRequestViewDTO"-->

    <body>
        <th:block th:fragment="request-info">
            <div class="surface p-0">
                <h4 class="surface__header">Info</h4>

                <div class="surface__content flex vertical">
                    <dl>
                        <dt class="fw-500">Request by</dt>
                        <dd th:text="${request.requester.displayName}"></dd>

                        <th:block>
                            <dt class="fw-500 mt-3">Group</dt>
                            <dd th:text="${request.studentGroupName()}"></dd>
                        </th:block>

                        <dt class="fw-500 mt-3">Course</dt>
                        <dd th:text="${edition.course.name}"></dd>

                        <dt class="fw-500 mt-3">Session</dt>
                        <dd th:text="${request.session.name}"></dd>

                        <dt class="fw-500 mt-3">Room</dt>
                        <dd th:if="${request.room.building == null}" th:text="${request.room.name}"></dd>
                        <dd th:unless="${request.room.building == null}" th:text="|${request.room.building.name} - ${request.room.name}|"></dd>

                        <dt class="fw-500 mt-3">Status</dt>
                        <dd th:include="request/status :: status(${request.eventInfo.status})"></dd>

                        <th:block th:unless="${#strings.isEmpty(request.eventInfo.reasonForStudent)}">
                            <dt class="fw-500 mt-3">Reason</dt>
                            <dd th:text="${request.eventInfo.reasonForStudent}"></dd>
                        </th:block>
                    </dl>

                    <div
                        class="flex vertical mb-3"
                        th:if="${@permissionService.canFinishRequest(request.id) and !request.getEventInfo().getStatus().isSelected()}">
                        <a href="#" th:href="@{/request/{id}/reject(id=${request.id})}" class="button" data-type="error">Reject</a>
                    </div>
                </div>
            </div>
        </th:block>
    </body>
</html>
