RPU v2, promo/bank система, админка, оптимизации
— RPU v2: бюджет удачи, потолок (ceiling), комбек после проигрышей, hot/cold анализ, интеграция с promo-фазами — Bank API: mock-банк для карты (депозит/вывод с балансом 1000₽) — Promo-сервис: автогенерация промокодов каждый час, типы (card_to_site, luck_boost, ceiling_boost, free_case, reset_streak) — Promo-фазы: LUCKY/NEUTRAL/UNLUCKY, переключение каждые 1-6ч — Admin: история транзакций (user_history), управление промокодами, управление promo-фазами, API фильтров/коллекций, RPU info — Database: WAL mode, новые поля RPU v2, TransactionLog, карточный баланс, статистики (streaks, ceiling, budget) — Frontend: /deposit, /promo/activate, /withdraw, /card-balance, /online-count, /rpu-info, lifespan вместо startup event — UI: user_history.html, улучшения профиля, кейсов, навигации — Cases: обновление cases.json (1892 строки новых данных) — Achievements: кэш коллекций, оптимизация is_custom проверок — Sounds: дополнительные звуковые эффекты — Upgrade: интеграция с RPU (множители, streaks) — .gitignore: исключены .db, .bak, __pycache__
This commit is contained in:
+152
-10
@@ -26,6 +26,8 @@
|
||||
flex-direction: column;
|
||||
position: sticky; top: 0; height: 100vh;
|
||||
flex-shrink: 0;
|
||||
z-index: 50;
|
||||
transition: transform 0.25s ease;
|
||||
}
|
||||
.admin-sidebar .sb-brand {
|
||||
padding: 1.25rem 1.25rem 0.75rem;
|
||||
@@ -73,6 +75,28 @@
|
||||
}
|
||||
.admin-sidebar .sb-footer a:hover { color: #f59e0b; }
|
||||
|
||||
/* ─── Sidebar overlay for mobile ─── */
|
||||
.sidebar-overlay {
|
||||
display: none;
|
||||
position: fixed; inset: 0;
|
||||
background: rgba(0,0,0,0.5);
|
||||
z-index: 49;
|
||||
}
|
||||
.sidebar-overlay.open { display: block; }
|
||||
|
||||
/* ─── Hamburger ─── */
|
||||
.hamburger {
|
||||
display: none;
|
||||
background: none;
|
||||
border: none;
|
||||
color: rgba(255,255,255,0.6);
|
||||
font-size: 1.3rem;
|
||||
cursor: pointer;
|
||||
padding: 0.25rem;
|
||||
line-height: 1;
|
||||
}
|
||||
.hamburger:hover { color: #fff; }
|
||||
|
||||
/* ─── Main area ─── */
|
||||
.admin-main {
|
||||
flex: 1;
|
||||
@@ -85,8 +109,10 @@
|
||||
padding: 0.85rem 1.5rem;
|
||||
background: rgba(17,18,22,0.8);
|
||||
backdrop-filter: blur(8px);
|
||||
-webkit-backdrop-filter: blur(8px);
|
||||
border-bottom: 1px solid rgba(255,255,255,0.04);
|
||||
position: sticky; top: 0; z-index: 10;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
.admin-topbar .at-title {
|
||||
font-size: 1rem; font-weight: 600;
|
||||
@@ -96,7 +122,10 @@
|
||||
font-size: 0.75rem; color: rgba(255,255,255,0.35);
|
||||
font-weight: 400;
|
||||
}
|
||||
.admin-topbar .at-actions { display: flex; align-items: center; gap: 0.75rem; }
|
||||
.admin-topbar .at-actions {
|
||||
display: flex; align-items: center; gap: 0.75rem;
|
||||
margin-left: auto;
|
||||
}
|
||||
.admin-topbar .at-actions .at-back {
|
||||
color: rgba(255,255,255,0.5); text-decoration: none;
|
||||
font-size: 0.8rem; display: flex; align-items: center; gap: 0.3rem;
|
||||
@@ -152,6 +181,7 @@
|
||||
.a-stat .as-value {
|
||||
font-size: 1.8rem; font-weight: 700;
|
||||
line-height: 1.1;
|
||||
word-break: break-word;
|
||||
}
|
||||
.a-stat .as-bar {
|
||||
position: absolute; bottom: 0; left: 0; height: 2px;
|
||||
@@ -196,6 +226,11 @@
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
/* ─── Responsive tables: card view on mobile ─── */
|
||||
.a-table-card-view {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* ─── Buttons ─── */
|
||||
.a-btn {
|
||||
display: inline-flex; align-items: center; gap: 0.35rem;
|
||||
@@ -255,6 +290,7 @@
|
||||
color: rgba(255,255,255,0.5);
|
||||
margin-bottom: 0.35rem;
|
||||
}
|
||||
select.a-input { cursor: pointer; }
|
||||
|
||||
/* ─── Badge ─── */
|
||||
.a-badge {
|
||||
@@ -272,6 +308,7 @@
|
||||
.a-overlay {
|
||||
position: fixed; inset: 0;
|
||||
background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
|
||||
-webkit-backdrop-filter: blur(4px);
|
||||
z-index: 100; display: none; align-items: center; justify-content: center;
|
||||
padding: 1rem;
|
||||
}
|
||||
@@ -283,13 +320,16 @@
|
||||
padding: 1.5rem;
|
||||
max-width: 460px; width: 100%;
|
||||
box-shadow: 0 20px 60px rgba(0,0,0,0.5);
|
||||
max-height: 90vh; overflow-y: auto;
|
||||
}
|
||||
.a-modal-wide { max-width: 700px; }
|
||||
.a-modal-title {
|
||||
font-size: 1rem; font-weight: 600; margin-bottom: 1rem;
|
||||
}
|
||||
.a-modal-actions {
|
||||
display: flex; gap: 0.5rem; margin-top: 1rem;
|
||||
justify-content: flex-end;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
/* ─── Grid helpers ─── */
|
||||
@@ -298,7 +338,14 @@
|
||||
.a-gap-sm { gap: 0.5rem; }
|
||||
.a-mt { margin-top: 1rem; }
|
||||
.a-mb { margin-bottom: 1rem; }
|
||||
.a-flex { display: flex; align-items: center; gap: 0.5rem; }
|
||||
.a-flex { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
|
||||
|
||||
/* ─── Search in top bar ─── */
|
||||
.search-form {
|
||||
display: flex; gap: 0.5rem; align-items: center;
|
||||
}
|
||||
.search-form .a-input { width: 200px; }
|
||||
.search-form .a-btn { flex-shrink: 0; }
|
||||
|
||||
/* ─── Empty state ─── */
|
||||
.a-empty {
|
||||
@@ -307,20 +354,86 @@
|
||||
}
|
||||
.a-empty .a-empty-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
|
||||
|
||||
@media(max-width:768px){
|
||||
.admin-sidebar { width: 56px; }
|
||||
.admin-sidebar .sb-brand span,
|
||||
.admin-sidebar .sb-nav a span:not(.sb-icon),
|
||||
.admin-sidebar .sb-footer span { display: none; }
|
||||
.admin-sidebar .sb-nav a { justify-content: center; padding: 0.65rem; }
|
||||
.admin-sidebar .sb-footer a { justify-content: center; }
|
||||
/* ─── Responsive ─── */
|
||||
@media(max-width: 1024px){
|
||||
.admin-sidebar { width: 200px; }
|
||||
}
|
||||
|
||||
@media(max-width: 768px){
|
||||
.admin-sidebar {
|
||||
position: fixed; left: 0; top: 0;
|
||||
transform: translateX(-100%);
|
||||
width: 260px;
|
||||
box-shadow: 4px 0 30px rgba(0,0,0,0.4);
|
||||
}
|
||||
.admin-sidebar.open { transform: translateX(0); }
|
||||
.admin-content { padding: 1rem; }
|
||||
.admin-topbar { padding: 0.7rem 1rem; }
|
||||
.admin-topbar .at-title .at-sub { display: none; }
|
||||
|
||||
.hamburger { display: inline-flex; }
|
||||
|
||||
.a-stats {
|
||||
grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
|
||||
gap: 0.75rem;
|
||||
}
|
||||
.a-stat { padding: 1rem; }
|
||||
.a-stat .as-value { font-size: 1.4rem; }
|
||||
|
||||
.search-form .a-input { width: 140px; }
|
||||
|
||||
.a-modal { margin: 0.5rem; padding: 1rem; border-radius: 12px; }
|
||||
|
||||
/* Card-style table on mobile */
|
||||
.a-table { display: none; }
|
||||
.a-table-card-view { display: flex; flex-direction: column; gap: 0.75rem; }
|
||||
.a-table-card {
|
||||
background: rgba(17,18,22,0.6);
|
||||
border: 1px solid rgba(255,255,255,0.05);
|
||||
border-radius: 10px;
|
||||
padding: 0.85rem;
|
||||
font-size: 0.82rem;
|
||||
}
|
||||
.a-table-card .tc-row {
|
||||
display: flex; justify-content: space-between;
|
||||
padding: 0.25rem 0;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
.a-table-card .tc-row .tc-label {
|
||||
color: rgba(255,255,255,0.35);
|
||||
font-size: 0.72rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.a-table-card .tc-row .tc-value {
|
||||
text-align: right;
|
||||
word-break: break-word;
|
||||
}
|
||||
.a-table-card .tc-actions {
|
||||
margin-top: 0.5rem; padding-top: 0.5rem;
|
||||
border-top: 1px solid rgba(255,255,255,0.04);
|
||||
display: flex; gap: 0.35rem; flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
|
||||
@media(max-width: 480px){
|
||||
html { font-size: 14px; }
|
||||
.admin-content { padding: 0.75rem; }
|
||||
.admin-topbar { padding: 0.6rem 0.75rem; }
|
||||
.a-stats { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
|
||||
.a-stat { padding: 0.75rem; }
|
||||
.a-stat .as-value { font-size: 1.2rem; }
|
||||
.a-card { padding: 0.85rem; }
|
||||
.search-form { width: 100%; }
|
||||
.search-form .a-input { width: 100%; }
|
||||
}
|
||||
{% block extra_styles %}{% endblock %}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="admin-sidebar">
|
||||
<div class="sidebar-overlay" id="sidebarOverlay"></div>
|
||||
|
||||
<div class="admin-sidebar" id="adminSidebar">
|
||||
<div class="sb-brand">
|
||||
<span style="font-size:1.2rem">⚡</span>
|
||||
<span>CS2 <span>Admin</span></span>
|
||||
@@ -344,6 +457,7 @@
|
||||
<div class="admin-main">
|
||||
<div class="admin-topbar">
|
||||
<div class="at-title">
|
||||
<button class="hamburger" id="hamburgerBtn" aria-label="Toggle menu">☰</button>
|
||||
{% block page_title %}Панель управления{% endblock %}
|
||||
</div>
|
||||
<div class="at-actions">
|
||||
@@ -357,6 +471,34 @@
|
||||
|
||||
{% block modals %}{% endblock %}
|
||||
<script src="/static/js/notifications.js"></script>
|
||||
<script>
|
||||
(function() {
|
||||
const sidebar = document.getElementById('adminSidebar');
|
||||
const overlay = document.getElementById('sidebarOverlay');
|
||||
const hamburger = document.getElementById('hamburgerBtn');
|
||||
|
||||
function toggleSidebar() {
|
||||
sidebar.classList.toggle('open');
|
||||
overlay.classList.toggle('open');
|
||||
}
|
||||
|
||||
if (hamburger) {
|
||||
hamburger.addEventListener('click', toggleSidebar);
|
||||
}
|
||||
if (overlay) {
|
||||
overlay.addEventListener('click', toggleSidebar);
|
||||
}
|
||||
|
||||
// Auto-close sidebar on nav click (mobile)
|
||||
sidebar.querySelectorAll('.sb-nav a').forEach(function(link) {
|
||||
link.addEventListener('click', function() {
|
||||
if (window.innerWidth <= 768) {
|
||||
toggleSidebar();
|
||||
}
|
||||
});
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
{% block scripts %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+266
-99
@@ -53,6 +53,32 @@
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="a-table-card-view">
|
||||
{% for c in cases %}
|
||||
<div class="a-table-card">
|
||||
<div class="tc-row">
|
||||
<span class="tc-label">Название</span>
|
||||
<span class="tc-value"><strong>{{ c.name }}</strong></span>
|
||||
</div>
|
||||
<div class="tc-row">
|
||||
<span class="tc-label">Цена</span>
|
||||
<span class="tc-value">{{ c.price_open }} ₽</span>
|
||||
</div>
|
||||
<div class="tc-row">
|
||||
<span class="tc-label">Тип</span>
|
||||
<span class="tc-value">{{ c.display_name|default('') }}</span>
|
||||
</div>
|
||||
<div class="tc-row">
|
||||
<span class="tc-label">Предметов</span>
|
||||
<span class="tc-value">{{ c.items_count }}</span>
|
||||
</div>
|
||||
<div class="tc-actions">
|
||||
<button class="a-btn a-btn-sm" onclick="openEditCaseModal('{{ c.name }}')">✏️ Редактировать</button>
|
||||
<button class="a-btn a-btn-danger a-btn-sm" onclick="deleteCase('{{ c.name }}')">🗑️</button>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -60,57 +86,90 @@
|
||||
{% block modals %}
|
||||
<!-- Create/Edit Case Modal -->
|
||||
<div class="a-overlay" id="caseModal">
|
||||
<div class="a-modal" style="max-width:600px">
|
||||
<div class="a-modal a-modal-wide" style="max-height:95vh;display:flex;flex-direction:column">
|
||||
<div class="a-modal-title" id="caseModalTitle">🎲 Создать кейс</div>
|
||||
<input type="hidden" id="editCaseName">
|
||||
<div class="a-row a-gap-sm">
|
||||
<div class="a-mb" style="flex:1">
|
||||
<label class="a-label">Название кейса (ID)</label>
|
||||
<input type="text" id="caseNameInput" class="a-input" placeholder="my_case">
|
||||
<div style="padding:0 1.5rem;flex:1;overflow-y:auto">
|
||||
<div class="a-row a-gap-sm">
|
||||
<div class="a-mb" style="flex:1">
|
||||
<label class="a-label">Название кейса (ID)</label>
|
||||
<input type="text" id="caseNameInput" class="a-input" placeholder="my_case">
|
||||
</div>
|
||||
<div class="a-mb" style="flex:1">
|
||||
<label class="a-label">Отображаемое название</label>
|
||||
<input type="text" id="caseDisplayName" class="a-input" placeholder="Мой кейс">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a-mb" style="flex:1">
|
||||
<label class="a-label">Отображаемое название</label>
|
||||
<input type="text" id="caseDisplayName" class="a-input" placeholder="Мой кейс">
|
||||
<div class="a-row a-gap-sm">
|
||||
<div class="a-mb" style="flex:1">
|
||||
<label class="a-label">Цена открытия</label>
|
||||
<input type="number" id="casePrice" class="a-input" value="250">
|
||||
</div>
|
||||
<div class="a-mb" style="flex:1">
|
||||
<label class="a-label">Ссылка на изображение</label>
|
||||
<input type="text" id="caseImage" class="a-input" placeholder="/static/cases/default.png">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a-mb">
|
||||
<label class="a-label">Описание (необязательно)</label>
|
||||
<input type="text" id="caseDescription" class="a-input" placeholder="Описание кейса...">
|
||||
</div>
|
||||
|
||||
<!-- Item browser section -->
|
||||
<div class="a-card" style="background:rgba(0,0,0,0.2);padding:0.75rem;margin-bottom:1rem">
|
||||
<div class="a-card-header" style="margin-bottom:0.5rem">📋 Предметы кейса <span id="itemCount" style="font-size:0.75rem;color:rgba(255,255,255,0.4)">(0)</span></div>
|
||||
|
||||
<!-- Selected items list -->
|
||||
<div id="caseItemsList" style="max-height:200px;overflow-y:auto;margin-bottom:0.75rem"></div>
|
||||
|
||||
<!-- Search + filters + add controls -->
|
||||
<div class="a-row a-gap-sm" style="margin-bottom:0.5rem">
|
||||
<input type="text" id="caseItemSearch" class="a-input a-input-sm" style="flex:2;min-width:120px" placeholder="🔍 Поиск..." oninput="searchCaseItems()">
|
||||
<select id="rarityFilter" class="a-input a-input-sm" style="flex:1;min-width:90px" onchange="searchCaseItems()">
|
||||
<option value="">Редкость</option>
|
||||
<option value="Consumer Grade">Consumer</option>
|
||||
<option value="Industrial Grade">Industrial</option>
|
||||
<option value="Mil-Spec">Mil-Spec</option>
|
||||
<option value="Restricted">Restricted</option>
|
||||
<option value="Classified">Classified</option>
|
||||
<option value="Covert">Covert</option>
|
||||
<option value="Rare Special Item">Rare Special</option>
|
||||
<option value="Contraband">Contraband</option>
|
||||
</select>
|
||||
<select id="collectionFilter" class="a-input a-input-sm" style="flex:1.2;min-width:100px" onchange="searchCaseItems()">
|
||||
<option value="">Коллекция</option>
|
||||
</select>
|
||||
<select id="sortBy" class="a-input a-input-sm" style="flex:0.7;min-width:80px" onchange="searchCaseItems()">
|
||||
<option value="">Сортировка</option>
|
||||
<option value="price_rub">Цена ↑</option>
|
||||
<option value="price_rub&desc">Цена ↓</option>
|
||||
<option value="name">Имя ↑</option>
|
||||
<option value="rarity">Редкость ↑</option>
|
||||
<option value="rarity&desc">Редкость ↓</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="a-row a-gap-sm" style="margin-bottom:0.5rem">
|
||||
<select id="typeFilter" class="a-input a-input-sm" style="flex:1;min-width:70px" onchange="searchCaseItems()">
|
||||
<option value="">Тип</option>
|
||||
</select>
|
||||
<select id="weaponFilter" class="a-input a-input-sm" style="flex:1;min-width:80px" onchange="searchCaseItems()">
|
||||
<option value="">Оружие</option>
|
||||
</select>
|
||||
<input type="number" id="minPrice" class="a-input a-input-sm" style="flex:0.6;min-width:60px" placeholder="Цена от" oninput="searchCaseItems()" value="0">
|
||||
<input type="number" id="maxPrice" class="a-input a-input-sm" style="flex:0.6;min-width:60px" placeholder="Цена до" oninput="searchCaseItems()" value="0">
|
||||
</div>
|
||||
|
||||
<!-- Search results -->
|
||||
<div id="caseItemResults" style="max-height:220px;overflow-y:auto;border:1px solid rgba(255,255,255,0.06);border-radius:6px;padding:0.25rem"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="a-row a-gap-sm">
|
||||
<div class="a-mb" style="flex:1">
|
||||
<label class="a-label">Цена открытия</label>
|
||||
<input type="number" id="casePrice" class="a-input" value="250">
|
||||
</div>
|
||||
<div class="a-mb" style="flex:1">
|
||||
<label class="a-label">Ссылка на изображение</label>
|
||||
<input type="text" id="caseImage" class="a-input" placeholder="/static/cases/default.png">
|
||||
</div>
|
||||
</div>
|
||||
<div class="a-mb">
|
||||
<label class="a-label">Описание (необязательно)</label>
|
||||
<input type="text" id="caseDescription" class="a-input" placeholder="Описание кейса...">
|
||||
</div>
|
||||
<div class="a-card" style="background:rgba(0,0,0,0.2);padding:0.75rem">
|
||||
<div class="a-card-header" style="margin-bottom:0.5rem">📋 Предметы кейса</div>
|
||||
<div id="caseItemsList"></div>
|
||||
<div class="a-flex a-mt" style="flex-wrap:wrap">
|
||||
<input type="text" id="caseItemSearch" class="a-input a-input-sm" style="flex:1;min-width:120px" placeholder="Поиск предмета..." oninput="searchCaseItems()">
|
||||
<button class="a-btn a-btn-sm" onclick="openAllItemsModal()">📦 Все предметы</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="a-modal-actions">
|
||||
<div class="a-modal-actions" style="padding:0.75rem 1.5rem;border-top:1px solid rgba(255,255,255,0.06)">
|
||||
<button class="a-btn" onclick="closeModal('caseModal')">Отмена</button>
|
||||
<button class="a-btn a-btn-primary" id="saveCaseBtn" onclick="saveCase()">💾 Сохранить</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- All items browser modal -->
|
||||
<div class="a-overlay" id="allItemsModal">
|
||||
<div class="a-modal" style="max-width:700px;max-height:80vh;display:flex;flex-direction:column">
|
||||
<div class="a-modal-title">📦 Все предметы</div>
|
||||
<input type="text" id="allItemsSearch" class="a-input a-input-sm a-mb" placeholder="Поиск..." oninput="searchAllItems()">
|
||||
<div id="allItemsGrid" style="flex:1;overflow-y:auto;display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:0.5rem"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Add case to section modal -->
|
||||
<div class="a-overlay" id="addCaseModal">
|
||||
<div class="a-modal" style="max-width:400px">
|
||||
@@ -145,13 +204,26 @@
|
||||
|
||||
{% block extra_styles %}
|
||||
<style>
|
||||
.ci-item { display:flex; align-items:center; gap:0.5rem; padding:0.35rem 0; border-bottom:1px solid rgba(255,255,255,0.03); font-size:0.78rem; }
|
||||
.ci-item img { width:32px; height:24px; object-fit:contain; }
|
||||
.ci-item .ci-info { flex:1; }
|
||||
.ci-item {
|
||||
display:flex; align-items:center; gap:0.5rem;
|
||||
padding:0.3rem 0.5rem; border-bottom:1px solid rgba(255,255,255,0.04);
|
||||
font-size:0.78rem; transition:background 0.15s;
|
||||
}
|
||||
.ci-item:hover { background:rgba(255,255,255,0.03); }
|
||||
.ci-item img { width:36px; height:28px; object-fit:contain; border-radius:3px; }
|
||||
.ci-item .ci-info { flex:1; line-height:1.3; }
|
||||
.ci-item .ci-rarity { font-size:0.65rem; color:rgba(255,255,255,0.35); }
|
||||
.all-item-card { background:rgba(0,0,0,0.15); border-radius:6px; padding:0.35rem; cursor:pointer; text-align:center; font-size:0.7rem; transition:all 0.15s; border:1px solid transparent; }
|
||||
.all-item-card:hover { border-color:rgba(245,158,11,0.3); background:rgba(245,158,11,0.05); }
|
||||
.all-item-card img { width:100%; height:40px; object-fit:contain; }
|
||||
.ci-result {
|
||||
display:flex; align-items:center; gap:0.5rem;
|
||||
padding:0.3rem 0.5rem; cursor:pointer;
|
||||
border-bottom:1px solid rgba(255,255,255,0.03);
|
||||
font-size:0.78rem; transition:all 0.12s; border-radius:3px;
|
||||
}
|
||||
.ci-result:hover { background:rgba(245,158,11,0.08); }
|
||||
.ci-result img { width:36px; height:28px; object-fit:contain; border-radius:3px; }
|
||||
.ci-result .ci-info { flex:1; line-height:1.3; }
|
||||
.ci-result .ci-meta { font-size:0.65rem; color:rgba(255,255,255,0.35); }
|
||||
.ci-result .ci-add { font-size:0.7rem; color:#f59e0b; }
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
@@ -159,17 +231,42 @@
|
||||
<script>
|
||||
let currentCaseItems = [];
|
||||
let editingCaseName = null;
|
||||
let searchDebounce = null;
|
||||
|
||||
// ─── Modals ──────────────────────────────────────────────────────────────────
|
||||
function closeModal(id) { document.getElementById(id).classList.remove('open'); }
|
||||
function openModal(id) { document.getElementById(id).classList.add('open'); }
|
||||
|
||||
// ─── Load page data ──────────────────────────────────────────────────────────
|
||||
let allCasesList = [];
|
||||
// ─── Load filter options ─────────────────────────────────────────────────────
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
const r = await fetch('/admin/api/cases/list');
|
||||
const d = await r.json();
|
||||
allCasesList = d.cases || [];
|
||||
allCasesList = await r.json();
|
||||
|
||||
// Load collections
|
||||
const cr = await fetch('/admin/api/collections');
|
||||
const cd = await cr.json();
|
||||
const colSel = document.getElementById('collectionFilter');
|
||||
(cd.collections || []).forEach(c => {
|
||||
const o = document.createElement('option');
|
||||
o.value = c; o.textContent = c;
|
||||
colSel.appendChild(o);
|
||||
});
|
||||
|
||||
// Load weapons + types
|
||||
const fr = await fetch('/admin/api/items/filters');
|
||||
const fd = await fr.json();
|
||||
const typeSel = document.getElementById('typeFilter');
|
||||
(fd.types || []).forEach(t => {
|
||||
const o = document.createElement('option');
|
||||
o.value = t; o.textContent = t;
|
||||
typeSel.appendChild(o);
|
||||
});
|
||||
const weaponSel = document.getElementById('weaponFilter');
|
||||
(fd.weapons || []).forEach(w => {
|
||||
const o = document.createElement('option');
|
||||
o.value = w; o.textContent = w;
|
||||
weaponSel.appendChild(o);
|
||||
});
|
||||
});
|
||||
|
||||
// ─── Create / Edit Case ──────────────────────────────────────────────────────
|
||||
@@ -185,6 +282,8 @@ function openCreateCaseModal() {
|
||||
document.getElementById('caseDescription').value = '';
|
||||
currentCaseItems = [];
|
||||
renderCaseItems();
|
||||
document.getElementById('caseItemSearch').value = '';
|
||||
document.getElementById('caseItemResults').innerHTML = '';
|
||||
openModal('caseModal');
|
||||
}
|
||||
|
||||
@@ -200,21 +299,34 @@ function openEditCaseModal(caseName) {
|
||||
document.getElementById('casePrice').value = c.price_open || 250;
|
||||
document.getElementById('caseImage').value = c.image_url || '';
|
||||
document.getElementById('caseDescription').value = c.description || '';
|
||||
currentCaseItems = (c.items || []).filter(i => typeof i === 'object');
|
||||
currentCaseItems = (c.items || []).filter(i => typeof i === 'object').map(i => {
|
||||
if (typeof i.id === 'number' && !i.market_hash_name) {
|
||||
return { id: i.id, name: i.name || 'Item #' + i.id, market_hash_name: i.name || '' };
|
||||
}
|
||||
return i;
|
||||
});
|
||||
renderCaseItems();
|
||||
document.getElementById('caseItemSearch').value = '';
|
||||
document.getElementById('caseItemResults').innerHTML = '';
|
||||
openModal('caseModal');
|
||||
}
|
||||
|
||||
function renderCaseItems() {
|
||||
const div = document.getElementById('caseItemsList');
|
||||
const count = currentCaseItems.length;
|
||||
document.getElementById('itemCount').textContent = `(${count})`;
|
||||
if (count === 0) {
|
||||
div.innerHTML = '<div style="font-size:0.75rem;color:rgba(255,255,255,0.3);padding:0.5rem 0">Нет предметов — добавьте через поиск выше</div>';
|
||||
return;
|
||||
}
|
||||
div.innerHTML = currentCaseItems.map((item, i) => `
|
||||
<div class="ci-item">
|
||||
<div class="ci-item" onclick="removeCaseItem(${i})" style="cursor:pointer">
|
||||
<img src="${item.image_url || '/static/placeholder.png'}" onerror="this.src='/static/placeholder.png'">
|
||||
<div class="ci-info">
|
||||
<div>${item.market_hash_name || item.name || '???'}</div>
|
||||
<div class="ci-rarity">${item.rarity || ''} • ${item.weapon || ''}</div>
|
||||
<div class="ci-rarity">${item.rarity || ''}${item.collection ? ' • ' + item.collection : ''}</div>
|
||||
</div>
|
||||
<button class="a-btn a-btn-danger a-btn-sm" onclick="removeCaseItem(${i})">✕</button>
|
||||
<span style="font-size:0.65rem;color:#ef4444;opacity:0.6">✕</span>
|
||||
</div>
|
||||
`).join('');
|
||||
}
|
||||
@@ -225,31 +337,105 @@ function removeCaseItem(idx) {
|
||||
}
|
||||
|
||||
function addCaseItem(item) {
|
||||
if (currentCaseItems.some(i => (i.market_hash_name || i.name) === (item.market_hash_name || item.name))) return;
|
||||
const key = (item.market_hash_name || item.name || '');
|
||||
if (currentCaseItems.some(i => (i.market_hash_name || i.name) === key)) return;
|
||||
currentCaseItems.push(item);
|
||||
renderCaseItems();
|
||||
}
|
||||
|
||||
function addAllFromCollection() {
|
||||
const sel = document.getElementById('collectionFilter');
|
||||
const coll = sel.value;
|
||||
if (!coll) { Notify.error('Выберите коллекцию'); return; }
|
||||
const rarity = document.getElementById('rarityFilter').value;
|
||||
const typeF = document.getElementById('typeFilter').value;
|
||||
const weaponF = document.getElementById('weaponFilter').value;
|
||||
let url = `/admin/api/items/by-collection?collection=${encodeURIComponent(coll)}`;
|
||||
if (rarity) url += `&rarity_filter=${encodeURIComponent(rarity)}`;
|
||||
if (typeF) url += `&type_filter=${encodeURIComponent(typeF)}`;
|
||||
if (weaponF) url += `&weapon_filter=${encodeURIComponent(weaponF)}`;
|
||||
fetch(url)
|
||||
.then(r => r.json())
|
||||
.then(items => {
|
||||
let added = 0;
|
||||
let skipped = 0;
|
||||
const alreadyIds = new Set(currentCaseItems.map(i => i.id));
|
||||
items.forEach(item => {
|
||||
if (alreadyIds.has(item.id)) {
|
||||
skipped++;
|
||||
return;
|
||||
}
|
||||
const key = (item.name || '');
|
||||
if (!currentCaseItems.some(i => (i.market_hash_name || i.name) === key)) {
|
||||
currentCaseItems.push(item);
|
||||
added++;
|
||||
}
|
||||
});
|
||||
renderCaseItems();
|
||||
let msg = `Добавлено ${added} предметов из "${coll}"`;
|
||||
if (skipped) msg += ` (${skipped} уже были в кейсе)`;
|
||||
Notify.success(msg);
|
||||
});
|
||||
}
|
||||
|
||||
async function searchCaseItems() {
|
||||
const q = document.getElementById('caseItemSearch').value;
|
||||
if (q.length < 2) return;
|
||||
const r = await fetch(`/admin/api/items/search?q=${encodeURIComponent(q)}`);
|
||||
const items = await r.json();
|
||||
// show as dropdown
|
||||
let html = '<div style="margin-top:0.5rem;max-height:200px;overflow-y:auto">';
|
||||
items.forEach(item => {
|
||||
html += `<div class="ci-item" style="cursor:pointer" onclick="addCaseItem(${JSON.stringify(item).replace(/"/g,'"')})">
|
||||
<img src="${item.image_url || '/static/placeholder.png'}" onerror="this.src='/static/placeholder.png'">
|
||||
<div class="ci-info"><div>${item.name}</div><div class="ci-rarity">${item.rarity} • ${item.price_rub||0} ₽</div></div>
|
||||
</div>`;
|
||||
});
|
||||
html += '</div>';
|
||||
const existing = document.getElementById('caseItemSearchResults');
|
||||
if (!existing) {
|
||||
const d = document.createElement('div'); d.id = 'caseItemSearchResults';
|
||||
document.getElementById('caseItemSearch').parentNode.appendChild(d);
|
||||
}
|
||||
document.getElementById('caseItemSearchResults').innerHTML = html;
|
||||
const rarity = document.getElementById('rarityFilter').value;
|
||||
const collection = document.getElementById('collectionFilter').value;
|
||||
const typeF = document.getElementById('typeFilter').value;
|
||||
const weaponF = document.getElementById('weaponFilter').value;
|
||||
const minP = document.getElementById('minPrice').value;
|
||||
const maxP = document.getElementById('maxPrice').value;
|
||||
const sortV = document.getElementById('sortBy').value;
|
||||
clearTimeout(searchDebounce);
|
||||
searchDebounce = setTimeout(async () => {
|
||||
const params = new URLSearchParams();
|
||||
if (q.length >= 2) params.set('q', q);
|
||||
if (rarity) params.set('rarity_filter', rarity);
|
||||
if (collection) params.set('collection_filter', collection);
|
||||
if (typeF) params.set('type_filter', typeF);
|
||||
if (weaponF) params.set('weapon_filter', weaponF);
|
||||
if (minP > 0) params.set('min_price', minP);
|
||||
if (maxP > 0) params.set('max_price', maxP);
|
||||
if (sortV) {
|
||||
const [field, order] = sortV.split('&');
|
||||
params.set('sort_by', field);
|
||||
if (order) params.set('sort_order', 'desc');
|
||||
}
|
||||
params.set('limit', '100');
|
||||
const r = await fetch(`/admin/api/items/search?${params.toString()}`);
|
||||
const items = await r.json();
|
||||
const div = document.getElementById('caseItemResults');
|
||||
if (items.length === 0) {
|
||||
div.innerHTML = '<div style="font-size:0.75rem;color:rgba(255,255,255,0.3);padding:0.5rem">Ничего не найдено</div>';
|
||||
return;
|
||||
}
|
||||
let html = '';
|
||||
if (collection) {
|
||||
html += `<div style="padding:0.3rem 0.5rem;font-size:0.7rem;color:rgba(255,255,255,0.4);display:flex;justify-content:space-between">
|
||||
<span>Найдено: ${items.length} предметов</span>
|
||||
<span onclick="addAllFromCollection()" style="cursor:pointer;color:#f59e0b">➕ Добавить все из коллекции</span>
|
||||
</div>`;
|
||||
}
|
||||
const alreadyIds = new Set(currentCaseItems.map(i => i.id));
|
||||
html += items.filter(item => !alreadyIds.has(item.id)).map(item => {
|
||||
const priceStr = item.price_rub > 0 ? item.price_rub.toLocaleString('ru') + '₽' : '';
|
||||
return `
|
||||
<div class="ci-result" onclick="addCaseItem(${JSON.stringify(item).replace(/"/g,'"')})">
|
||||
<img src="${item.image_url || '/static/placeholder.png'}" onerror="this.src='/static/placeholder.png'">
|
||||
<div class="ci-info">
|
||||
<div>${item.name}</div>
|
||||
<div class="ci-meta">${item.rarity}${item.weapon ? ' • ' + item.weapon : ''}${priceStr ? ' • ' + priceStr : ''}</div>
|
||||
</div>
|
||||
<div class="ci-add">+</div>
|
||||
</div>`;
|
||||
}).join('');
|
||||
const hidden = items.filter(item => alreadyIds.has(item.id)).length;
|
||||
if (hidden > 0) {
|
||||
html += `<div style="font-size:0.65rem;color:rgba(255,255,255,0.25);padding:0.3rem 0.5rem">${hidden} предмет(ов) уже в кейсе</div>`;
|
||||
}
|
||||
div.innerHTML = html;
|
||||
}, q.length >= 2 ? 200 : 300);
|
||||
}
|
||||
|
||||
async function saveCase() {
|
||||
@@ -263,11 +449,15 @@ async function saveCase() {
|
||||
fd.append('description', document.getElementById('caseDescription').value);
|
||||
fd.append('items_json', JSON.stringify(currentCaseItems));
|
||||
|
||||
const isEdit = editingCaseName !== null && editingCaseName !== name;
|
||||
const isEdit = editingCaseName !== null;
|
||||
const url = isEdit
|
||||
? `/admin/api/cases/update/${encodeURIComponent(editingCaseName)}`
|
||||
: '/admin/api/cases/create';
|
||||
|
||||
|
||||
if (isEdit && editingCaseName !== name) {
|
||||
fd.append('new_name', name);
|
||||
}
|
||||
|
||||
const r = await fetch(url, { method:'POST', body:fd });
|
||||
const d = await r.json();
|
||||
if (d.success) { window.location.reload(); }
|
||||
@@ -285,29 +475,6 @@ async function deleteCase(name) {
|
||||
});
|
||||
}
|
||||
|
||||
// ─── All Items Browser ───────────────────────────────────────────────────────
|
||||
async function openAllItemsModal() {
|
||||
openModal('allItemsModal');
|
||||
document.getElementById('allItemsSearch').value = '';
|
||||
await searchAllItems();
|
||||
}
|
||||
async function searchAllItems() {
|
||||
const q = document.getElementById('allItemsSearch').value;
|
||||
const r = await fetch(`/admin/api/items/search?q=${encodeURIComponent(q)}&limit=200`);
|
||||
const items = await r.json();
|
||||
document.getElementById('allItemsGrid').innerHTML = items.map(item => `
|
||||
<div class="all-item-card" onclick="addCaseItemFromAll(${JSON.stringify(item).replace(/"/g,'"')})">
|
||||
<img src="${item.image_url || '/static/placeholder.png'}" onerror="this.src='/static/placeholder.png'">
|
||||
<div style="margin-top:0.2rem;line-height:1.15">${item.name}</div>
|
||||
<div style="font-size:0.6rem;color:rgba(255,255,255,0.35)">${item.rarity}</div>
|
||||
</div>
|
||||
`).join('');
|
||||
}
|
||||
function addCaseItemFromAll(item) {
|
||||
addCaseItem(item);
|
||||
closeModal('allItemsModal');
|
||||
}
|
||||
|
||||
// ─── Mainpage Sections ───────────────────────────────────────────────────────
|
||||
function openAddSectionModal() {
|
||||
document.getElementById('newSectionName').value = '';
|
||||
@@ -336,7 +503,7 @@ async function deleteSection(tab) {
|
||||
function openAddCaseModal(tab) {
|
||||
document.getElementById('addCaseSectionName').textContent = tab;
|
||||
const sel = document.getElementById('addCaseSelect');
|
||||
sel.innerHTML = allCasesList.map(c => `<option value="${c}">${c}</option>`).join('');
|
||||
sel.innerHTML = allCasesList.map(c => `<option value="${c.name}">${c.display_name || c.name}</option>`).join('');
|
||||
sel.dataset.tab = tab;
|
||||
openModal('addCaseModal');
|
||||
}
|
||||
|
||||
@@ -4,6 +4,13 @@
|
||||
{% block page_title %}📊 Дашборд{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="a-card" style="margin-bottom:1rem;padding:0.75rem">
|
||||
<div style="display:flex;justify-content:space-between;align-items:center">
|
||||
<strong>🎭 Промо-фаза:</strong>
|
||||
<span id="promoPhaseInfo">Загрузка...</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="a-stats">
|
||||
<div class="a-stat">
|
||||
<div class="as-label">Пользователей</div>
|
||||
@@ -55,3 +62,23 @@
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
async function loadPromoPhase() {
|
||||
try {
|
||||
const r = await fetch('/admin/api/promo-phase');
|
||||
const d = await r.json();
|
||||
const el = document.getElementById('promoPhaseInfo');
|
||||
if (d.current_phase === 'LUCKY') {
|
||||
el.innerHTML = '<span style="color:#22c55e">🍀 LUCKY</span> (осталось ' + Math.floor(d.remaining_seconds / 60) + ' мин)';
|
||||
} else if (d.current_phase === 'UNLUCKY') {
|
||||
el.innerHTML = '<span style="color:#ef4444">💀 UNLUCKY</span> (осталось ' + Math.floor(d.remaining_seconds / 60) + ' мин)';
|
||||
} else {
|
||||
el.innerHTML = '<span style="color:#a3a3a3">⚪ NEUTRAL</span> (осталось ' + Math.floor(d.remaining_seconds / 60) + ' мин)';
|
||||
}
|
||||
} catch(e) {}
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', loadPromoPhase);
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -8,10 +8,11 @@
|
||||
{% endblock %}
|
||||
{% block top_actions %}
|
||||
<a href="/admin/users" class="at-back">← Назад</a>
|
||||
<a href="/admin/user/{{ target_user.id }}/history" class="a-btn" style="margin-left:0.5rem;font-size:0.82rem;">📜 История</a>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="a-stats" style="grid-template-columns:repeat(4,1fr)">
|
||||
<div class="a-stats">
|
||||
<div class="a-stat">
|
||||
<div class="as-label">Баланс</div>
|
||||
<div class="as-value">{{ target_user.balance|money }} ₽</div>
|
||||
@@ -49,6 +50,26 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- RPU v2 -->
|
||||
<div class="a-card">
|
||||
<div class="a-card-header">🎲 RPU v2 — подробно</div>
|
||||
<div id="rpuV2Stats" class="a-mb" style="font-size:0.82rem">
|
||||
<div class="a-row a-gap-sm" style="justify-content:space-around;text-align:center;margin-bottom:0.75rem">
|
||||
<div><div class="as-value" id="v2Ceiling" style="font-size:1.1rem">--</div><div class="as-label" style="font-size:0.65rem">Потолок / Депнуто</div></div>
|
||||
<div><div class="as-value" id="v2Budget" style="font-size:1.1rem">--</div><div class="as-label" style="font-size:0.65rem">Luck Budget</div></div>
|
||||
<div><div class="as-value" id="v2SessionSpent" style="font-size:1.1rem">--</div><div class="as-label" style="font-size:0.65rem">Сессия потрачено</div></div>
|
||||
<div><div class="as-value" id="v2HotScore" style="font-size:1.1rem">--</div><div class="as-label" style="font-size:0.65rem">Hot Score</div></div>
|
||||
<div><div class="as-value" id="v2PromoPhase" style="font-size:1.1rem">--</div><div class="as-label" style="font-size:0.65rem">Промо-фаза</div></div>
|
||||
</div>
|
||||
<div class="a-row a-gap-sm" style="justify-content:space-around;text-align:center">
|
||||
<div><div class="as-value" id="v2Comeback" style="font-size:1.1rem">--</div><div class="as-label" style="font-size:0.65rem">Комбек</div></div>
|
||||
<div><div class="as-value" id="v2BreakCount" style="font-size:1.1rem">--</div><div class="as-label" style="font-size:0.65rem">Пробитий</div></div>
|
||||
<div><div class="as-value" id="v2LossStreak" style="font-size:1.1rem">--</div><div class="as-label" style="font-size:0.65rem">Проигрышей подряд</div></div>
|
||||
<div><div class="as-value" id="v2SessionReset" style="font-size:1.1rem">--</div><div class="as-label" style="font-size:0.65rem">Сброс сессии</div></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Действия -->
|
||||
<div class="a-card">
|
||||
<div class="a-card-header">🔧 Действия</div>
|
||||
@@ -84,6 +105,27 @@
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="a-table-card-view">
|
||||
{% for item in inventory %}
|
||||
<div class="a-table-card">
|
||||
<div class="tc-row">
|
||||
<span class="tc-label">ID</span>
|
||||
<span class="tc-value">{{ item.id }}</span>
|
||||
</div>
|
||||
<div class="tc-row">
|
||||
<span class="tc-label">Название</span>
|
||||
<span class="tc-value">{{ item.market_hash_name[:40] }}{{'…' if item.market_hash_name|length > 40}}</span>
|
||||
</div>
|
||||
<div class="tc-row">
|
||||
<span class="tc-label">Редкость / Float</span>
|
||||
<span class="tc-value">{{ item.rarity }} / {{ "%.4f"|format(item.float_value) }}</span>
|
||||
</div>
|
||||
<div class="tc-actions">
|
||||
<button class="a-btn a-btn-danger a-btn-sm" onclick="deleteItem({{ item.id }})">🗑️ Удалить</button>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -251,6 +293,24 @@ async function loadRPU() {
|
||||
document.getElementById('rpuSpent').textContent = Math.round(d.stats.total_spent).toLocaleString() + ' ₽';
|
||||
document.getElementById('rpuOpened').textContent = d.stats.total_opened.toLocaleString();
|
||||
document.getElementById('rpuAutoStatus').textContent = d.auto_adjust ? '✅' : '❌';
|
||||
|
||||
// ── RPU v2 ──
|
||||
if (d.v2) {
|
||||
const v = d.v2;
|
||||
document.getElementById('v2Ceiling').textContent = Math.round(v.ceiling.current_ceiling).toLocaleString('ru') + '₽ / ' + Math.round(v.ceiling.total_deposited).toLocaleString('ru') + '₽';
|
||||
document.getElementById('v2Budget').textContent = v.session.luck_budget + '%';
|
||||
document.getElementById('v2Budget').style.color = v.session.luck_budget < 30 ? '#ef4444' : v.session.luck_budget > 70 ? '#22c55e' : '#f59e0b';
|
||||
document.getElementById('v2SessionSpent').textContent = Math.round(v.session.session_spent).toLocaleString('ru') + '₽';
|
||||
document.getElementById('v2HotScore').textContent = v.hot_cold.hot_score;
|
||||
document.getElementById('v2HotScore').style.color = v.hot_cold.hot_score > 0.5 ? '#22c55e' : v.hot_cold.hot_score < -0.5 ? '#ef4444' : '#f59e0b';
|
||||
const ph = v.promo_phase;
|
||||
document.getElementById('v2PromoPhase').textContent = ph.phase;
|
||||
document.getElementById('v2PromoPhase').style.color = ph.phase === 'LUCKY' ? '#22c55e' : ph.phase === 'UNLUCKY' ? '#ef4444' : '#f59e0b';
|
||||
document.getElementById('v2Comeback').textContent = v.comeback.active ? '✅ x' + v.comeback.multiplier.toFixed(1) + ' (' + v.comeback.openings_left + ')' : '❌';
|
||||
document.getElementById('v2BreakCount').textContent = v.ceiling.break_count + ' (' + v.ceiling.break_session + ' сесс)';
|
||||
document.getElementById('v2LossStreak').textContent = v.comeback.consecutive_loss_count + ' (' + Math.round(v.comeback.consecutive_loss_value).toLocaleString('ru') + '₽)';
|
||||
document.getElementById('v2SessionReset').textContent = v.session.reset_date ? new Date(v.session.reset_date).toLocaleString('ru') : '—';
|
||||
}
|
||||
} catch(_) {}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
{% extends "admin/base.html" %}
|
||||
{% block title %}История {{ target_user.username }} — Админ-панель{% endblock %}
|
||||
{% block nav_users %}active{% endblock %}
|
||||
{% block page_title %}
|
||||
📜 История {{ target_user.username }}
|
||||
<span class="at-sub">ID {{ target_user.id }}</span>
|
||||
{% endblock %}
|
||||
{% block top_actions %}
|
||||
<a href="/admin/user/{{ target_user.id }}" class="at-back">← Профиль</a>
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_styles %}
|
||||
<style>
|
||||
.rarity-Covert, .rarity-Rare\ Special\ Item, .rarity-Extraordinary { color: #eb4b4b; }
|
||||
.rarity-Classified { color: #d32ce6; }
|
||||
.rarity-Restricted { color: #8847ff; }
|
||||
.rarity-Mil-Spec, .rarity-Mil-Spec\ Grade { color: #4b69ff; }
|
||||
.rarity-Industrial\ Grade { color: #5e98d9; }
|
||||
.rarity-Consumer\ Grade { color: #b0b0b0; }
|
||||
.mono { font-family: monospace; font-size: 0.72rem; }
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="a-stats" style="margin-bottom:1rem">
|
||||
<div class="a-stat"><div class="as-label">Потолок</div><div class="as-value">{{ "%.0f"|format(ceiling) }} ₽</div></div>
|
||||
<div class="a-stat"><div class="as-label">Текущая ценность</div><div class="as-value">{{ "%.0f"|format(total_value) }} ₽</div></div>
|
||||
<div class="a-stat"><div class="as-label">Luck budget</div><div class="as-value">{{ "%.1f"|format(rpu.luck_budget) }}%</div></div>
|
||||
<div class="a-stat"><div class="as-label">Hot score</div><div class="as-value">{{ "%.0f"|format(rpu.hot_score or 0) }}</div></div>
|
||||
<div class="a-stat"><div class="as-label">Ceiling mult</div><div class="as-value">{{ "%.2f"|format(rpu.ceiling_multiplier) }}</div></div>
|
||||
<div class="a-stat"><div class="as-label">Комбек</div><div class="as-value">{{ rpu.comeback_active }}</div></div>
|
||||
</div>
|
||||
|
||||
<div class="a-flex a-mb" style="gap:0.5rem">
|
||||
<button class="a-btn a-btn-primary tab-btn active" onclick="switchTab('openings')">📦 Открытия ({{ openings|length }})</button>
|
||||
<button class="a-btn tab-btn" onclick="switchTab('upgrades')">⬆️ Апгрейды ({{ upgrades|length }})</button>
|
||||
<button class="a-btn tab-btn" onclick="switchTab('transactions')">💳 Транзакции ({{ transactions|length }})</button>
|
||||
</div>
|
||||
|
||||
<div id="tab-openings" class="tab-content" style="display:block">
|
||||
<div class="a-table-wrap">
|
||||
<table class="a-table">
|
||||
<thead><tr><th>ID</th><th>Дата</th><th>Кейс</th><th>Предмет</th><th>Редкость</th><th>Float</th></tr></thead>
|
||||
<tbody>
|
||||
{% for o in openings %}
|
||||
<tr>
|
||||
<td class="mono">{{ o.id }}</td>
|
||||
<td>{{ o.opened_at.strftime('%d.%m %H:%M') }}</td>
|
||||
<td>{{ o.case_name }}</td>
|
||||
<td>{{ o.item_name }}</td>
|
||||
<td><span class="rarity-{{ o.rarity|replace(' ', '\\ ') }}">{{ o.rarity }}</span></td>
|
||||
<td>{{ "%.4f"|format(o.float_value) if o.float_value else '—' }}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr><td colspan="6" class="a-empty" style="padding:2rem">Нет открытий</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="tab-upgrades" class="tab-content" style="display:none">
|
||||
<div class="a-table-wrap">
|
||||
<table class="a-table">
|
||||
<thead><tr><th>ID</th><th>Дата</th><th>Вход</th><th>Цель</th><th>Результат</th><th>Базовый шанс</th><th>RPU шанс</th></tr></thead>
|
||||
<tbody>
|
||||
{% for u in upgrades %}
|
||||
<tr>
|
||||
<td class="mono">{{ u.id }}</td>
|
||||
<td>{{ u.created_at.strftime('%d.%m %H:%M') }}</td>
|
||||
<td>{{ u.input_item_name }}</td>
|
||||
<td>{{ u.target_item_name }}</td>
|
||||
<td style="color:{% if u.success %}#22c55e{% else %}#ef4444{% endif %}">{% if u.success %}✅ Успех{% else %}❌ Провал{% endif %}</td>
|
||||
<td>{{ "%.1f"|format(u.probability * 100 if u.probability else 0) }}%</td>
|
||||
<td>{{ "%.1f"|format(u.rpu_adjusted_probability * 100 if u.rpu_adjusted_probability else 0) }}%</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr><td colspan="7" class="a-empty" style="padding:2rem">Нет апгрейдов</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="tab-transactions" class="tab-content" style="display:none">
|
||||
<div class="a-table-wrap">
|
||||
<table class="a-table">
|
||||
<thead><tr><th>ID</th><th>Дата</th><th>Тип</th><th>Сумма</th><th>Комиссия</th><th>Детали</th></tr></thead>
|
||||
<tbody>
|
||||
{% for t in transactions %}
|
||||
<tr>
|
||||
<td class="mono">{{ t.id }}</td>
|
||||
<td>{{ t.created_at.strftime('%d.%m %H:%M') }}</td>
|
||||
<td>
|
||||
{% if t.tx_type == 'card_to_site' %}<span class="a-badge a-badge-success">Депозит</span>
|
||||
{% elif t.tx_type == 'site_to_card' %}<span class="a-badge a-badge-banned">Вывод</span>
|
||||
{% elif t.tx_type == 'promo_bonus' %}<span class="a-badge" style="background:rgba(234,179,8,0.12);color:#eab308">Промо</span>
|
||||
{% else %}<span class="a-badge a-badge-user">{{ t.tx_type }}</span>{% endif %}
|
||||
</td>
|
||||
<td>{{ "%.0f"|format(t.amount) }} ₽</td>
|
||||
<td>{% if t.fee %}{{ "%.0f"|format(t.fee) }} ₽{% else %}—{% endif %}</td>
|
||||
<td style="max-width:300px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">{{ t.details or '' }}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr><td colspan="6" class="a-empty" style="padding:2rem">Нет транзакций</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
function switchTab(name) {
|
||||
document.querySelectorAll('.tab-content').forEach(el => el.style.display = 'none');
|
||||
document.querySelectorAll('.tab-btn').forEach(el => el.classList.remove('active'));
|
||||
document.getElementById('tab-' + name).style.display = 'block';
|
||||
document.querySelector('.tab-btn[onclick="switchTab(\'' + name + '\')"]').classList.add('active');
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -3,8 +3,8 @@
|
||||
{% block nav_users %}active{% endblock %}
|
||||
{% block page_title %}👥 Пользователи{% endblock %}
|
||||
{% block top_actions %}
|
||||
<div class="a-flex">
|
||||
<input type="text" id="userSearch" class="a-input a-input-sm" style="width:200px" placeholder="Поиск по имени..." value="{{ search or '' }}">
|
||||
<div class="search-form a-flex">
|
||||
<input type="text" id="userSearch" class="a-input a-input-sm" placeholder="Поиск по имени..." value="{{ search or '' }}">
|
||||
<button class="a-btn a-btn-primary" onclick="searchUsers()">🔍 Найти</button>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -50,6 +50,40 @@
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="a-table-card-view">
|
||||
{% for u in users %}
|
||||
<div class="a-table-card">
|
||||
<div class="tc-row">
|
||||
<span class="tc-label">ID</span>
|
||||
<span class="tc-value">{{ u.id }}</span>
|
||||
</div>
|
||||
<div class="tc-row">
|
||||
<span class="tc-label">Имя</span>
|
||||
<span class="tc-value"><a href="/admin/user/{{ u.id }}" style="color:#f59e0b;text-decoration:none;font-weight:500">{{ u.username }}</a></span>
|
||||
</div>
|
||||
<div class="tc-row">
|
||||
<span class="tc-label">Баланс</span>
|
||||
<span class="tc-value">{{ u.balance|money }} ₽</span>
|
||||
</div>
|
||||
<div class="tc-row">
|
||||
<span class="tc-label">Статус</span>
|
||||
<span class="tc-value">
|
||||
{% if u.is_admin %}<span class="a-badge a-badge-admin">Админ</span>{% endif %}
|
||||
{% if u.is_banned %}<span class="a-badge a-badge-banned">Забанен</span>{% endif %}
|
||||
{% if not u.is_admin and not u.is_banned %}<span class="a-badge a-badge-user">Игрок</span>{% endif %}
|
||||
</span>
|
||||
</div>
|
||||
<div class="tc-row">
|
||||
<span class="tc-label">Кейсов / Контр / Предм</span>
|
||||
<span class="tc-value">{{ u.case_openings }} / {{ u.contracts }} / {{ u.inventory_count }}</span>
|
||||
</div>
|
||||
<div class="tc-actions">
|
||||
<a href="/admin/user/{{ u.id }}" class="a-btn a-btn-sm">✏️ Редактировать</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="a-empty">
|
||||
|
||||
Reference in New Issue
Block a user