<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Student Dashboard</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
            padding: 0;
            background-color: #f4f4f4;
        }
        .container {
            width: 80%;
            margin: auto;
            background: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0px 0px 10px 0px #aaa;
        }
        h2 {
            text-align: center;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin: 20px 0;
        }
        th, td {
            border: 1px solid #ddd;
            padding: 10px;
            text-align: left;
        }
        th {
            background-color: #007bff;
            color: white;
        }
        .status-approved {
            color: green;
            font-weight: bold;
        }
        .status-pending {
            color: orange;
            font-weight: bold;
        }
        .status-rejected {
            color: red;
            font-weight: bold;
        }
        .button {
            display: inline-block;
            padding: 10px 20px;
            margin: 10px 0;
            font-size: 16px;
            text-align: center;
            color: white;
            background-color: #007bff;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            text-decoration: none;
        }
        .button:hover {
            background-color: #0056b3;
        }
        .logout {
            background-color: red;
        }
        .logout:hover {
            background-color: darkred;
        }
    </style>
</head>
<body>

<div class="container">
    <h2>Welcome to Your Dashboard</h2>

    <!-- Room Request Status -->
    <h3>Your Room Requests</h3>
    <table>
        <tr>
            <th>Room Number</th>
            <th>Block ID</th>
            <th>Status</th>
        </tr>
        <tr th:each="request : ${roomRequests}">
            <td th:text="${request.room.id.roomNumber}"></td>
            <td th:text="${request.room.id.blockId}"></td>
            <td>
                <span th:class="${request.status == 'Approved' ? 'status-approved' : (request.status == 'Rejected' ? 'status-rejected' : 'status-pending')}"
                      th:text="${request.status}">
                </span>
            </td>
        </tr>
    </table>

    <!-- Document Status -->
    <h3>Your Documents</h3>
    <table>
        <tr>
            <th>Document Name</th>
            <th>Status</th>
            <th>Employee Comments</th>
        </tr>
        <tr th:each="document : ${documents}">
            <td th:text="${document.documentName}"></td>
            <td>
                <span th:class="${document.getDStatus() == 'Approved' ? 'status-approved' : (document.getDStatus() == 'Rejected' ? 'status-rejected' : 'status-pending')}"
                      th:text="${document.getDStatus()}">
                </span>
            </td>
            <td th:text="${document.getDComment()} ?: 'No comments'"></td>
        </tr>
    </table>

    <a href="/" class="button logout">Logout</a>
</div>

</body>
</html>
