Files
robot-control-system/templates/cabinet.html

107 lines
3.7 KiB
HTML

{% extends "base.html" %}
{% block title %}Личный кабинет — Robot Management{% endblock %}
{% block nav %}
<form method="post" action="/logout" class="logout-form">
<button type="submit" class="btn btn-ghost">Выйти</button>
</form>
{% endblock %}
{% block content %}
<h1>Личный кабинет</h1>
<section class="grid">
<div class="card">
<h2>Профиль</h2>
<dl class="stats">
<div>
<dt>Email</dt>
<dd>{{ user.email }}</dd>
</div>
<div>
<dt>ID</dt>
<dd>{{ user.id }}</dd>
</div>
<div>
<dt>Рейтинг</dt>
<dd class="highlight">{{ "%.1f"|format(user.rating) }}</dd>
</div>
<div>
<dt>Баллы</dt>
<dd class="highlight">{{ user.points }}</dd>
</div>
<div>
<dt>Дата регистрации</dt>
<dd>{{ user.created_at.strftime("%d.%m.%Y %H:%M") }}</dd>
</div>
</dl>
</div>
<div class="card">
<h2>Активные сессии</h2>
{% if sessions %}
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Создана</th>
<th>Истекает</th>
</tr>
</thead>
<tbody>
{% for s in sessions %}
<tr>
<td>{{ s.id }}</td>
<td>{{ s.created_at.strftime("%d.%m.%Y %H:%M") }}</td>
<td>{{ s.expires_at.strftime("%d.%m.%Y %H:%M") }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="muted">Нет активных сессий</p>
{% endif %}
</div>
</section>
<section class="card">
<h2>Данные от внешних приложений</h2>
{% if external_data %}
<table class="table">
<thead>
<tr>
<th>Источник</th>
<th>Данные</th>
<th>Время</th>
</tr>
</thead>
<tbody>
{% for item in external_data %}
<tr>
<td>{{ item.source }}</td>
<td><code class="payload">{{ item.payload[:120] }}{% if item.payload|length > 120 %}…{% endif %}</code></td>
<td>{{ item.created_at.strftime("%d.%m.%Y %H:%M") }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="muted">Пока нет записей от внешних систем</p>
{% endif %}
</section>
<section class="card api-info">
<h2>API для внешних приложений</h2>
<p class="muted">Передавайте ключ в заголовке: <code>Authorization: Bearer &lt;API_KEY&gt;</code></p>
<ul class="api-list">
<li><code>GET /api/v1/users/{id}</code> — данные пользователя</li>
<li><code>GET /api/v1/users/by-email/{email}</code> — поиск по email</li>
<li><code>GET /api/v1/users/{id}/sessions</code> — активные сессии</li>
<li><code>POST /api/v1/users/{id}/data</code> — запись данных</li>
<li><code>GET /api/v1/users/{id}/data</code> — чтение данных</li>
</ul>
<p><a href="/docs" target="_blank">Открыть Swagger-документацию →</a></p>
</section>
{% endblock %}