Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
306 lines
8.4 KiB
HTML
306 lines
8.4 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}Aktywnosc Uzytkownikow - Admin - Norda Biznes Partner{% endblock %}
|
|
|
|
{% block extra_css %}
|
|
<style>
|
|
.admin-header {
|
|
margin-bottom: var(--spacing-xl);
|
|
}
|
|
|
|
.admin-header h1 {
|
|
font-size: var(--font-size-3xl);
|
|
color: var(--text-primary);
|
|
margin: 0;
|
|
}
|
|
|
|
.admin-header p {
|
|
margin: var(--spacing-xs) 0 0 0;
|
|
color: var(--text-secondary);
|
|
}
|
|
|
|
.stats-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
|
gap: var(--spacing-lg);
|
|
margin-bottom: var(--spacing-2xl);
|
|
}
|
|
|
|
.stat-card {
|
|
background: var(--surface);
|
|
padding: var(--spacing-lg);
|
|
border-radius: var(--radius-lg);
|
|
box-shadow: var(--shadow);
|
|
text-align: center;
|
|
}
|
|
|
|
.stat-value {
|
|
font-size: var(--font-size-3xl);
|
|
font-weight: 700;
|
|
color: var(--primary);
|
|
}
|
|
|
|
.stat-label {
|
|
color: var(--text-secondary);
|
|
font-size: var(--font-size-sm);
|
|
margin-top: var(--spacing-xs);
|
|
}
|
|
|
|
.section {
|
|
background: var(--surface);
|
|
padding: var(--spacing-xl);
|
|
border-radius: var(--radius-lg);
|
|
box-shadow: var(--shadow);
|
|
margin-bottom: var(--spacing-xl);
|
|
}
|
|
|
|
.section h2 {
|
|
font-size: var(--font-size-xl);
|
|
margin-bottom: var(--spacing-lg);
|
|
color: var(--text-primary);
|
|
border-bottom: 2px solid var(--border);
|
|
padding-bottom: var(--spacing-sm);
|
|
}
|
|
|
|
.data-table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
}
|
|
|
|
.data-table th,
|
|
.data-table td {
|
|
padding: var(--spacing-md);
|
|
text-align: left;
|
|
border-bottom: 1px solid var(--border);
|
|
}
|
|
|
|
.data-table th {
|
|
font-weight: 600;
|
|
color: var(--text-secondary);
|
|
font-size: var(--font-size-sm);
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
}
|
|
|
|
.data-table tr:hover {
|
|
background: var(--background);
|
|
}
|
|
|
|
.data-table td.num {
|
|
text-align: right;
|
|
font-variant-numeric: tabular-nums;
|
|
}
|
|
|
|
.device-badge {
|
|
display: inline-block;
|
|
padding: 2px 8px;
|
|
border-radius: var(--radius-sm);
|
|
font-size: var(--font-size-xs);
|
|
font-weight: 500;
|
|
}
|
|
|
|
.device-desktop { background: #DBEAFE; color: #1D4ED8; }
|
|
.device-mobile { background: #D1FAE5; color: #065F46; }
|
|
.device-tablet { background: #FEF3C7; color: #D97706; }
|
|
.device-other { background: #F3F4F6; color: #6B7280; }
|
|
|
|
/* ---- DAU Chart (CSS-only bars) ---- */
|
|
.chart-container {
|
|
overflow-x: auto;
|
|
}
|
|
|
|
.bar-chart {
|
|
display: flex;
|
|
align-items: flex-end;
|
|
gap: 3px;
|
|
height: 180px;
|
|
padding-top: var(--spacing-sm);
|
|
}
|
|
|
|
.bar-col {
|
|
flex: 1;
|
|
min-width: 18px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
gap: 4px;
|
|
}
|
|
|
|
.bar-value {
|
|
font-size: 10px;
|
|
color: var(--text-secondary);
|
|
line-height: 1;
|
|
}
|
|
|
|
.bar {
|
|
width: 100%;
|
|
background: var(--primary);
|
|
border-radius: 3px 3px 0 0;
|
|
min-height: 2px;
|
|
transition: opacity 0.15s;
|
|
}
|
|
|
|
.bar:hover {
|
|
opacity: 0.8;
|
|
}
|
|
|
|
.bar-label {
|
|
font-size: 9px;
|
|
color: var(--text-secondary);
|
|
writing-mode: vertical-rl;
|
|
text-orientation: mixed;
|
|
transform: rotate(180deg);
|
|
height: 40px;
|
|
line-height: 1;
|
|
}
|
|
|
|
.text-muted {
|
|
color: var(--text-secondary);
|
|
font-size: var(--font-size-sm);
|
|
}
|
|
|
|
.table-scroll {
|
|
overflow-x: auto;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.stats-grid {
|
|
grid-template-columns: repeat(2, 1fr);
|
|
}
|
|
|
|
.bar-chart {
|
|
min-width: 600px;
|
|
}
|
|
|
|
.data-table th,
|
|
.data-table td {
|
|
padding: var(--spacing-sm);
|
|
font-size: var(--font-size-sm);
|
|
}
|
|
}
|
|
</style>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="container">
|
|
|
|
<!-- Header -->
|
|
<div class="admin-header">
|
|
<h1>Aktywnosc uzytkownikow</h1>
|
|
<p>Dane z ostatnich 30 dni (bez botow)</p>
|
|
</div>
|
|
|
|
<!-- Summary stat cards -->
|
|
<div class="stats-grid">
|
|
<div class="stat-card">
|
|
<div class="stat-value">{{ summary.total_sessions }}</div>
|
|
<div class="stat-label">Sesje</div>
|
|
</div>
|
|
<div class="stat-card">
|
|
<div class="stat-value">{{ summary.unique_users }}</div>
|
|
<div class="stat-label">Unikalni uzytkownicy</div>
|
|
</div>
|
|
<div class="stat-card">
|
|
<div class="stat-value">{{ summary.avg_duration_min }} min</div>
|
|
<div class="stat-label">Sredni czas sesji</div>
|
|
</div>
|
|
<div class="stat-card">
|
|
<div class="stat-value">{{ summary.total_pageviews }}</div>
|
|
<div class="stat-label">Odslony stron</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Daily Active Users chart -->
|
|
<div class="section">
|
|
<h2>Aktywni uzytkownicy dziennie</h2>
|
|
<div class="chart-container">
|
|
<div class="bar-chart">
|
|
{% for day in daily_active %}
|
|
<div class="bar-col" title="{{ day.label }}: {{ day.count }} uzytkownikow">
|
|
<span class="bar-value">{% if day.count > 0 %}{{ day.count }}{% endif %}</span>
|
|
<div class="bar" style="height: {{ day.pct }}%;"></div>
|
|
<span class="bar-label">{{ day.label }}</span>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Recent logins -->
|
|
<div class="section">
|
|
<h2>Ostatnie logowania</h2>
|
|
{% if recent_sessions %}
|
|
<div class="table-scroll">
|
|
<table class="data-table">
|
|
<thead>
|
|
<tr>
|
|
<th>Uzytkownik</th>
|
|
<th>Data</th>
|
|
<th>Urzadzenie</th>
|
|
<th>Przegladarka</th>
|
|
<th>Czas (min)</th>
|
|
<th>Odslony</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for s in recent_sessions %}
|
|
<tr>
|
|
<td>{{ s.user_name }}</td>
|
|
<td>{{ s.started_at.strftime('%d.%m.%Y %H:%M') if s.started_at else '-' }}</td>
|
|
<td>
|
|
{% set dt = s.device_type|lower %}
|
|
<span class="device-badge device-{{ dt if dt in ['desktop','mobile','tablet'] else 'other' }}">
|
|
{{ s.device_type }}
|
|
</span>
|
|
</td>
|
|
<td>{{ s.browser }}</td>
|
|
<td class="num">{{ s.duration_min }}</td>
|
|
<td class="num">{{ s.page_views_count }}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% else %}
|
|
<p class="text-muted">Brak danych o sesjach w ostatnich 30 dniach.</p>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<!-- Most active users -->
|
|
<div class="section">
|
|
<h2>Najbardziej aktywni uzytkownicy</h2>
|
|
{% if active_users %}
|
|
<div class="table-scroll">
|
|
<table class="data-table">
|
|
<thead>
|
|
<tr>
|
|
<th>#</th>
|
|
<th>Uzytkownik</th>
|
|
<th>Sesje</th>
|
|
<th>Laczny czas (min)</th>
|
|
<th>Odslony</th>
|
|
<th>Ostatnie logowanie</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for u in active_users %}
|
|
<tr>
|
|
<td>{{ loop.index }}</td>
|
|
<td>{{ u.name }}</td>
|
|
<td class="num">{{ u.session_count }}</td>
|
|
<td class="num">{{ u.total_time_min }}</td>
|
|
<td class="num">{{ u.total_pages }}</td>
|
|
<td>{{ u.last_login.strftime('%d.%m.%Y %H:%M') if u.last_login else '-' }}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% else %}
|
|
<p class="text-muted">Brak danych o aktywnosci uzytkownikow.</p>
|
|
{% endif %}
|
|
</div>
|
|
|
|
</div>
|
|
{% endblock %}
|