Files
oldmarketcustomserver/templates/admin.html
drel 9eca006d8a succ
succ
2025-10-18 03:11:05 +03:00

148 lines
4.5 KiB
HTML

<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OldMarket Admin</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
background: #f5f5f5;
}
.sidebar {
width: 250px;
background: #2c3e50;
color: white;
height: 100vh;
position: fixed;
padding: 20px;
}
.sidebar h2 {
margin-bottom: 30px;
text-align: center;
}
.sidebar ul {
list-style: none;
}
.sidebar li {
margin: 15px 0;
}
.sidebar a {
color: white;
text-decoration: none;
padding: 10px;
display: block;
border-radius: 5px;
transition: background 0.3s;
}
.sidebar a:hover {
background: #34495e;
}
.content {
margin-left: 250px;
padding: 40px;
}
.dashboard-cards {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 20px;
margin-top: 20px;
}
.card {
background: white;
padding: 30px;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
text-align: center;
}
.card h3 {
color: #2c3e50;
margin-bottom: 10px;
}
.card .number {
font-size: 2em;
font-weight: bold;
color: #3498db;
}
.sidebar .user-info {
background: #34495e;
padding: 10px;
border-radius: 5px;
margin-bottom: 20px;
text-align: center;
}
</style>
</head>
<body>
<div class="sidebar">
<h2>OldMarket Admin</h2>
<div class="user-info">
Вы вошли как: <strong>{{ username }}</strong>
</div>
<ul>
<li><a href="/admin">Дашборд</a></li>
<li><a href="/admin/apps">Управление приложениями</a></li>
<li><a href="/admin/reviews">Управление отзывами</a></li>
<li><a href="/api/apps" target="_blank">API приложений</a></li>
<li><a href="/admin/logout">Выйти</a></li>
</ul>
</div>
<div class="content">
<h1>Дашборд админ-панели</h1>
<p>Добро пожаловать в панель управления OldMarket</p>
<div class="dashboard-cards">
<div class="card">
<h3>Приложения</h3>
<div class="number" id="apps-count">0</div>
<p>всего в каталоге</p>
</div>
<div class="card">
<h3>Отзывы</h3>
<div class="number" id="reviews-count">0</div>
<p>всего отзывов</p>
</div>
<div class="card">
<h3>Загрузки</h3>
<div class="number" id="downloads-count">0</div>
<p>всего скачиваний</p>
</div>
</div>
</div>
<script>
// Загружаем статистику
async function loadStats() {
try {
const appsResponse = await fetch('/api/admin/apps');
const apps = await appsResponse.json();
document.getElementById('apps-count').textContent = apps.length;
let totalDownloads = 0;
let totalReviews = 0;
apps.forEach(app => {
totalDownloads += app.downloads || 0;
// Для отзывов нужно сделать отдельный запрос, упростим
totalReviews += app.review_count || 0;
});
document.getElementById('downloads-count').textContent = totalDownloads;
document.getElementById('reviews-count').textContent = totalReviews;
} catch (error) {
console.error('Error loading stats:', error);
}
}
loadStats();
</script>
</body>
</html>