{% extends '__layout__.html' %}
{% block title %}Admin{% endblock %}
{% block head %}
<link href="/static/css/admin.css" rel="stylesheet"/> <!-- Its just easier to resuse this-->
<style>
    .show-on-hover {
        filter: blur(4px);
        transition: 0.2s;
    }
    .show-on-hover:hover {
        filter: blur(0px);
        transition: 0.2s;
    }
    .bg-dark {
        background-color: var(--surface-alt) !important;
        box-shadow: 0px 0px 5px 0px rgb(0,0,0);
    }
</style>
{% endblock %}
{% block content %}
<div id="main">
    <div class="container" style="max-width: 1200px;">
        <a class="mb-2" href="/admin/manage-users/{{userObj.id}}"> < Return to User Page</a>
        <div class="d-flex align-items-center">
            <img height="100px" style="aspect-ratio: 1/1;" class="rounded-2" src="/Thumbs/Avatar.ashx?userId={{userObj.id}}&x=100&y=100">
            <div>
                <h1 class="m-0 {% if userObj.accountstatus == 1 %}text-body{% elif userObj.accountstatus == 2 %}text-warning{% elif userObj.accountstatus == 3%}text-danger{% else %}text-decoration-line-through text-body{%endif%}">{{userObj.username}}<span class="text-secondary"> Game Sessions</span></h1>
                <p class="text-secondary m-0" style="font-size: 12px;">UserId: <span class="text-body">{{userObj.id}}</span></p>
            </div>
        </div>
        <table class="table table-dark table-striped">
            <thead>
              <tr class="rounded-top">
                <th scope="col" style="width: 5%;">ID</th>
                <th scope="col" style="width: 27.5%;">JobId</th>
                <th scope="col" style="width: 22.5%;">Joined At</th>
                <th scope="col" style="width: 22.5%;">Left At</th>
                <th scope="col" style="width: 22.5%;">Place</th>
              </tr>
            </thead>
            <tbody class="table-group-divider" style="border-color: var(--linebreak);">
            {% for session in GameSessions: %}
              <tr>
                <th scope="row">{{session.id}}</th>
                <td>{{session.serveruuid}}</td>
                <td>{{session.joined_at}} UTC</td>
                <td>{{session.left_at}} UTC</td>
                <td><a class="text-primary" href="/games/{{session.place_id}}/--">{{get_place_name(session.place_id)}}</a> ({{session.place_id}})</td>
              </tr>
            {% endfor %}
            </tbody>
        </table>
        {% if len(GameSessions.items) == 0: %}
        <div class="text-center">
            <p class="text-secondary">No Game Session Logs Found</p>
        </div>
        {%endif%}
        <div class="align-items-center d-flex justify-content-center mt-2 mb-2">
            <a class="ms-auto m-0 text-decoration-none {% if not GameSessions.has_prev %}text-secondary{%endif%}" {% if GameSessions.has_prev %}href="/admin/manage-users/{{userObj.id}}/game-sessions?page={{GameSessions.prev_num}}"{%endif%}>Previous</a>
            <p class="ms-2 me-2 text-body m-0">Page {{GameSessions.page}} of {{GameSessions.pages}}</p>
            <a class="me-auto m-0 text-decoration-none {% if not GameSessions.has_next %}text-secondary{%endif%}" {% if GameSessions.has_next %}href="/admin/manage-users/{{userObj.id}}/game-sessions?page={{GameSessions.next_num}}"{%endif%}>Next</a>
        </div>
    </div>
</div>
{% endblock %}